SuperAPI AI Directory

bb-scalper

General & other

View repository

Updated 10-13 16:10

About this skill

🎯 BB Bidirectional Arbitrage Strategy — Complete Strategy Document

Version: v2.0 Triple Filter | Updated: 2026-08-11 Positioning: Crypto Contract 10x Leverage Bidirectional Arbitrage Skill Supported Coins: USDT Perpetual Contracts (Mainstream First)


Zero, In One Sentence

Bollinger Bands narrowing = sideways oscillation → buy at lower band, sell at upper band; sell at upper band, buy at lower band. Don't bet on direction, just capture the statistical edge of range oscillation.


One, Strategy Intuition: A Coin Rolling in a Bowl

Imagine a bowl — the left side is the lower band, the right side is the upper band. A coin rolls back and forth inside:

        上轨 ═══════════ 🔴 做空入场 ────
        │                                │
        │   价格在碗里来回弹                │
        │                                │
        下轨 ═══════════ 🟢 做多入场 ─────

Long Logic: The coin rolls to the left side of the bowl (%B < 0.15) → high probability it bounces back → buy, wait for it to roll to the right before selling

Short Logic: The coin rolls to the right side of the bowl (%B > 0.85) → high probability it bounces back → sell, wait for it to roll to the left before buying

But the market's bowl can deform — sometimes it narrows (no room to profit), sometimes it tilts (cannot trade in a trend). So we needtriple filterto confirm the bowl is stable and flat.


Two, Core Math: Why "Band-to-Band" Is the Only Solution

❌ Wrong Approach: Take Profit at Middle Band (The First Pit We Fell Into)

做多: 入场=下轨 → 止盈=中轨 → 收益=1σ
      止损=下轨下面 → 风险=1σ + 缓冲
      RR = 1σ / (1σ + 0.15%) < 1  ← 永远亏多赚少!

Scanned 20 coins, 15 were oscillating, none had RR exceeding 1.1. Mathematical dead end, not a parameter issue.

✅ Correct Approach: Band-to-Band (Solution One)

做多: 入场=下轨 → 止盈=上轨 → 收益=2σ
      止损=下轨外 0.15% → 风险 ≈ 1σ + 0.15%
      RR = 2σ / (1σ + 0.15%) ≈ 2:1 到 4:1 ✅

In One Sentence: Take profit must be placed at the opposite band — capture the entire range, not just up to the middle band.


Three, Triple Filter (v2.0 Core)

🔴 Filter One: Trend Filter

Check: 1h candle Bollinger Band middle band slope

做多: 1h 中轨不能明显下行(斜率 > -0.06%)
做空: 1h 中轨不能明显上行(斜率 < +0.06%)

斜率 < 0.03% = 走平 ✅ 最优
斜率 0.03%-0.06% = 弱趋势,顺方向可以做
斜率 > 0.06% = 明确趋势,禁止逆势

Why: The bowl bottom is sinking → the coin won't bounce when it hits the bottom → false breakout sweeps stop loss. The trend filter confirms the bowl is lying flat.

Actual Effect: Just now scanning, the short signals for ETH/SOL/BTC/INJ were all blocked by "1h middle band rising" — these were exactly the culprits in v1.0 with 6-8 consecutive stop losses.


🟡 Filter Two: RSI Confirmation

Check: Whether the price is already overbought/oversold

做多: RSI < 55 才做(不在高位接盘)
       RSI 30-45 加分(超卖反弹概率大)

做空: RSI > 45 才做(不在低位砸盘)
       RSI 55-70 加分(超买回落概率大)

Intuition: Lower band + RSI 70 = trend just started, will continue falling, buying is catching a falling knife.


🟢 Filter Three: BB Sweet Spot

Check: Whether the Bollinger Band width is appropriate

< 0.8%:  太窄 → 10x 利润不够覆盖滑点+手续费 → 跳过
0.8-2.5%: 甜区 → 可以做
> 2.5%:  太宽 → 不是真横盘,是波动行情 → 跳过

Quick Reference for Coin Widths:

Width Coin Examples Judgment
0.71% XRP ❌ Too Narrow
0.87% BTC ⚠️ Just Barely Meets Threshold
0.88% AVAX ✅ Sweet Spot
1.13% NEAR ✅ Sweet Spot Center
2.75% ATOM ❌ Too Wide
47.5% TUT ❌ Crash Market

Four, Dynamic Width Adaptation (🎯 Advanced)

Currently fixed sweet spot 0.8-2.5%. But can we based on BB widthdynamically adjustinstead of a one-size-fits-all approach?

Analysis

BB宽度 1%:  10x 杠杆 → 轨对轨 10% 收益 | 止损 1.5% | RR 6.7:1
BB宽度 2%:  10x 杠杆 → 轨对轨 20% 收益 | 止损 2.3% | RR 8.7:1
BB宽度 3%:  10x 杠杆 → 轨对轨 30% 收益 | 止损 3.2% | RR 9.4:1

The RR numbers look better, but they don't hold up physically:

  1. The wider it is → the less it's a true range. With a 3% wide oscillation range, price needs more time to go from the lower band to the upper band → the probability of a mid-way reversal greatly increases → the actual win rate plummets

  2. Stop-loss distance gets larger. 0.15% × 3% = a larger absolute stop-loss → a larger loss per trade → consecutive stop-losses are more damaging

  3. When the market is 2-3% wide, it's usually not RANGING, it's the early stage of TRENDING—RSI has already given a direction, and the trend filter will most likely reject it

Conclusion

BB Width State Strategy Conclusion
< 0.8% Too narrow Don't trade. Wait for the BB to expand.
0.8-1.5% Optimal NEAR tier, standard strategy
1.5-2.5% Tradable Accept a lower win rate (~25-30%), but higher RR
2.5-4% Wait and see Wait for it to narrow below 2.5% before entering
> 4% Don't trade Volatile market, not an arbitrage mode

Recommendation: The current v2.0 sweet spot of 0.8-2.5% is optimal—it already covers the most stable ranging zone. Widening to 3-4% will introduce a large number of false signals, and instead reduce net returns. Validate on a small scale first and let the data speak.


V. Backtest Data

Performance Summary

Coin Backtest Period Signals Win Rate Avg Win Avg Loss Cumulative PnL
NEAR 168h 31 35% +13.2% -2.5% +95.4%
DOGE 72h 9 44% +7.8% -2.5% +18.6%
INJ 72h 13 23% +11.3% -2.5% +9.0%

TUTUSDT Counterexample

Metric TUTUSDT NEARUSDT
BB Width 47.5% 1.13%
Number of Signals 100 31
Win Rate 1% 35%
Capital $100 $-69 (blown account) +$95
Cause of Death Extremely large width + one-sided decline = repeatedly stopped out by BB false signals

VI. Trading Parameter Table

Parameter Value Description
BB Period 20 20 candles
BB Standard Deviation 2.0 2σ Bollinger Bands
Entry Trigger %B < 0.15 (long) / > 0.85 (short) Price approaching the band
Take Profit Opposite band (band to band) 2σ space
Stop Loss 0.15% beyond the entry band Tight stop-loss
Leverage 10x Fixed
Risk per Trade 2% of capital
Max Position $100 notional value
SL Cooldown 3 candles after consecutive stop-losses Prevent clustered stop-losses
Max Holding 12 candles (3h) Forced close on timeout

VII. Script Framework

projects/bb-scalper/
├── SKILL.md              ← 你正在读的(策略文档)
├── cli/
│   ├── kline_fetch.py    → 查询合约 K 线数据
│   ├── trade_exec.py     → 对接币安交易接口(入场/止盈/止损)
│   ├── trade_log.py      → 记录 + 统计交易记录
│   └── simulate.py       → 模拟交易(不实际下单)
├── core/
│   ├── strategy.py       → 策略核心逻辑(BB + 三重过滤)
│   └── filters.py        → 趋势/RSI/甜区过滤器
└── config.yaml           → 可调参数(甜区/杠杆/仓位等)

CLI Interface Design

# 1. K线查询
python cli/kline_fetch.py --symbol NEARUSDT --interval 15m --limit 100
python cli/kline_fetch.py --scan                          # 扫 20 主流合约

# 2. 交易执行
python cli/trade_exec.py --symbol NEARUSDT --side LONG \
  --entry 1.592 --tp 1.610 --sl 1.589 --qty 6

# 3. 交易记录
python cli/trade_log.py --list                            # 列出所有交易
python cli/trade_log.py --summary                         # 统计摘要
python cli/trade_log.py --export-csv trades.csv

# 4. 模拟交易
python cli/simulate.py --symbol NEARUSDT --hours 168      # 历史回测
python cli/simulate.py --paper                            # 实时模拟(不下单)

VIII. Risk Description

Risk Mitigation
False breakout sweeping stop-losses (65% frequency) Tight stop-loss (-2.5%), frequent small losses but not fatal
Big moves break out of the range Trend filter interception + cooldown mechanism
Slippage (stop-loss gap) Only trade major contracts (USDT perpetuals have good liquidity)
Fees Rail-to-rail profit (~10%) far exceeds fees (0.04%)
Overtrading Triple filter ≥ filters out 60% of noise signals

9. Usage Principles

  1. Use only in range-bound, oscillating markets. In trending markets, BB arbitrage = giving away money.
  2. Prioritize demo account verification. First use simulate.py --paper to run for a week, confirm performance before going live.
  3. Diversify coins. Do not bet on just one coin; allocate a portion each to NEAR/AVAX/INJ.
  4. Run scan once before each execution. Confirm the triple filter still passes.
  5. Pause when BB width > 4% or RSI is extreme. Wait for the market to calm down before entering.

10. Coin Selection Criteria (monthly/weekly filter, 🎯 2026-08-11 verified)

Derived from 30/60/90-day backtests + monthly/weekly analysis.Coin selection is more important than parameters—with the same strategy, coins with good range-bound quality earn 500-1400% per month, while poor coins draw down 50%+ and you can't hold on.

Core patterns

  1. "Monthly oscillation" ≠ "suitable". ETH/LINK monthly net direction ≈ 0 but monthly amplitude 44-49%, which is "large-amplitude fluctuation" not "range-bound"—BB arbitrage still repeatedly stops out (ETH 90-day drawdown 53%).
  2. True range-bound = small amplitude + mild direction. Only suitable when monthly amplitude < 50% and |net direction| < 25%.
  3. Amplitude is more important than direction. Coins with monthly amplitude < 40% (BTC/BNB) naturally have low drawdown; monthly amplitude > 100% (NEAR 168%) has large fluctuations, good short-term but long-term drawdown spikes.
  4. High drawdown ≠ acceptable high return. LINK (+739% drawdown 57%)/ARB (+636% drawdown 50%)/LTC (+401% drawdown 61%)—live trading would halve the account, and most people can't hold on.

Coin selection scoring table (by monthly)

Monthly characteristics Judgment Example
Amplitude < 40% + |net direction| < 15% ✅ First choice, most stable range-bound BTC / BNB
Amplitude < 50% + |net direction| < 25% ✅ Suitable SOL / XRP
Amplitude < 60% + single-direction downtrend ⚠️ Can trade, watch the trend filter DOT / ATOM
Amplitude > 100% or |net direction| > 40% ❌ Volatile/trending market, avoid NEAR / INJ
Amplitude 40-50% but |net direction| ≈ 0 ⚠️ Large-amplitude oscillation, pseudo range-bound ETH / LINK

Operational Workflow

A. Full-market scan (🎯 2026-08-13 added, replaces manual coin selection)

Binance USDT perpetual contracts 527, checking each manually is too slow. Use a three-level funnel of "pre-screen → deep analysis → recommend":

  1. Lightweight pre-screen of 527 → 30 candidates
    • Pull Binance exchangeInfo, filter out those without liquidity (24h volume too low), non-USDT perpetuals, non-TRADING status
    • Filter out coins with abnormal prices (market cap too small/order book too thin)
    • Keep only contracts with good liquidity and tradability
  2. Deep analysis of 30 → recommend 3-5
    • Bollinger Bands dimension: whether the 7-day 15m BB width stays consistently in the sweet zone (0.8%-2.5%) and is stable (low standard deviation); %B can repeatedly touch the bands (<0.15 or >0.85)
    • Trend/Momentum dimension: 7-day 1h middle-band slope near 0 (|slope|<0.03%); 30-day net direction mild (|net direction|<10%); moderate amplitude (10-40%); RSI centered at 40-60
    • Backtest dimension: run cli/backtest_daily.py --days 7/30, check cumulative PnL positive, max drawdown < 20%, average daily trades ≥ 2, high proportion of days with trades
  3. Cross-validation: only coins that all three dimensions (Bollinger Bands + Trend + Backtest)agree are bullish onare selected; if any dimension clearly contradicts (e.g., good backtest but strong trend), downgrade
  4. Start testnet paper trading:python3 cli/paper_testnet.py --symbols <推荐币> --capital 500 run 7-day validation

B. Monthly filter (original method, as supplementary confirmation)

  1. Pull monthly candles (6) to calculateamplitude = (high-low)/starting point andnet direction = (current price-starting point)/starting point
  2. Filter out coins with amplitude > 60% or |net direction| > 30%
  3. Run on the remaining coins cli/backtest_daily.py --days 30 --min-daily 2 checkmax drawdown < 20% and average daily trades ≥ 2
  4. Before each entry still run scan to confirm the 15m triple filter passes (coin selection is long-term filtering, 15m is entry filtering)

Tianshu · 2026-08-11