Not ready for live trading
Supertrend Strategy Dashboard
Pine Script v4 β’ Binance BTC/USDT β’ Research & paper trading only
How to read this page: start in the control panel below to define your mode and risk assumptions, use the roadmap card to track which build phase you are in, then walk through the accordions for setup steps, required code fixes, and risk warnings before deploying any bot.
Strategy control panel
Simulate running the Supertrend + 200 EMA system, keep risk settings explicit, and track your implementation phase.
Mode
Run status
Last started:
This dashboard never places real orders. Use it to stay aligned with your trading plan, then execute via TradingView/Binance.
Risk per trade
Of account equity per entry.
Daily loss limit
Block new signals once this is hit.
Trade frequency
ATR / EMA planning
Mirror these values in your Pine script / bot config.
This panel tracks your intended configuration only; no API keys or live balances are ever read here.
Recent activity
Mode changes, saved configs, and roadmap updates will appear here so you can reconstruct what you changed and when.
Roadmap to Autonomous Trading Bot
Six phases from broken code to fully automated trading.
Account Setup
1. Create Binance Account
- Go to binance.com (international)
- Sign up with email and phone number
- Enable 2FA (Google Authenticator or SMS) β mandatory
2. Complete KYC Verification
- Profile β Identification, select Colombia
- Use CΓ©dula de CiudadanΓa or Passport and facial verification
- Approval typically 10β30 minutes; basic verification allows ~2 BTC daily withdrawal
Funding Your Account
Option 1: P2P Trading (Recommended)
- Buy Crypto β P2P Trading β Buy USDT with COP
- Pick a verified merchant (>98% rating, 1000+ trades)
- Payment methods: Bancolombia, Nequi, Daviplata; 0β1% above market
- Funds settle 5β30 minutes after payment confirmation
Option 2: Crypto Deposit
- Wallet β Fiat and Spot β Deposit, choose asset
- Select the correct network (TRC20 for USDT is cheapest)
- Double-check network to avoid loss
Option 3: Credit/Debit Card
- Buy Crypto β Credit/Debit Card
- Instant but 2β4% fees; may not work with all Colombian banks
Enable Futures Trading
1. Activate Futures Account
- Derivatives β USD-M Futures β βOpen Nowβ
- Complete quiz and accept terms; account starts at 0 balance
2. Transfer Funds to Futures Wallet
- Wallet β Fiat and Spot β USDT β Transfer
- From Spot to USD-M Futures; transfer is instant and free
Configure Trading Settings
1. Set Up BTC/USDT Perpetual
- Futures β BTCUSDT β choose βBTCUSDT Perpetualβ (most liquid)
2. Adjust Leverage
- Click leverage indicator; set to 1x or 2x max
- Strategy assumes 1x leverage for sizing
3. Set Margin Mode
- Select Isolated Margin to limit risk per position
- Avoid Cross Margin for this strategy
4. Position Mode
- Settings β Position Mode β choose One-Way Mode
- Matches the reversal logic; Hedge Mode not needed
API Setup for Bot Trading
1. Create API Keys
- Profile β API Management β βCreate APIβ (label it βTrading Bot - BTC Supertrendβ)
- Complete 2FA; store API Key and Secret immediately
2. Configure Restrictions
- Enable: Reading β, Futures β
- Disable: Spot & Margin Trading β, Withdrawals β (never enable)
3. IP Whitelist
- Add VPS/home IPs so keys only work from trusted hosts
- Supports multiple IPs (primary + backup)
Test Your Setup (Manual)
- Place a tiny market order (e.g., 0.001 BTC)
- Place then cancel a limit order
- Set a manual stop loss
- Transfer funds Spot β Futures
- Verify Isolated margin and 1β2x leverage
- Test API connection (start read-only)
Fees & Limits
- Futures fees: Maker 0.02%, Taker 0.04% (BNB pays -10%)
- Funding: Every 8 hours (00:00/08:00/16:00 UTC); typical 0.01β0.03% per period
- Position limits: Large caps (e.g., 1x up to ~1000 BTC); this strategy unlikely to hit them
Colombia Tax Considerations
- Crypto gains may be subject to income tax (0β39% brackets)
- DIAN requires reporting holdings/transactions
- Capital gains from crypto trading are taxable; keep detailed records
Troubleshooting
Can't access Binance: Should work without VPN; try binance.com, check ISP blocks.
P2P payment not confirming: Message merchant, upload proof, open dispute after ~30 mins.
Withdrawal to Colombian bank fails: Sell USDT for COP via P2P instead of direct withdrawal.
API orders failing: Verify Futures permission, IP whitelist, sufficient margin, and min notional (>$10).
Pre-Bot Checklist
- Account created and KYC complete
- 2FA enabled
- Funds in Spot wallet (via P2P/other) and transferred to USD-M Futures
- Futures activated; leverage 1β2x; Isolated margin; One-Way mode
- Manual test trades executed
- API keys created, withdrawals disabled, IP whitelisted, connection tested
Step 1: Fix Critical Issues (Week 1-2)
Goal: Make the strategy functionally correct and safe to test
- β Fix position sizing calculation to properly convert USD risk to BTC quantity
- β Add stop loss and take profit to every trade
- β Implement daily loss limit ($500 recommended)
- β Add maximum trades per day (5 recommended)
- β Add minimum bars between trades (10-20 bars)
- β Improve EMA filter with buffer zone (0.5% recommended)
- β Review and adjust risk parameters ($230 max loss needs revision)
Deliverable: Updated Pine Script with all critical fixes implemented
Step 2: Backtest & Optimize (Week 3-4)
Goal: Validate strategy performance and optimize parameters
- π Backtest on 2-3 years of BTC data (include 2022 bear, 2024 bull)
- π Test parameter variations (ATR period: 8-14, Multiplier: 3.0-5.0)
- π Include realistic trading costs (0.1-0.2% per round trip)
- π Calculate key metrics: Sharpe ratio, max drawdown, win rate, profit factor
- π Test across different market conditions (trending vs ranging)
- π Out-of-sample validation (test on data not used for optimization)
- π Monte Carlo simulation for robustness testing
Success Criteria: Sharpe ratio > 1.0, Max DD < 25%, Profit factor > 1.3
Deliverable: Comprehensive backtest report with optimized parameters
Step 3: Paper Trading (Week 5-12)
Goal: Test strategy in real-time without risking capital
- π Set up paper trading account (TradingView, Binance testnet)
- π Connect to real-time data feed
- π Track all signals and simulated trades
- π Document performance weekly
- π Monitor slippage and execution differences vs backtest
- π Test during various market conditions (volatile, quiet, trending)
- π Compare paper results to backtest expectations
- π Identify any bugs or unexpected behavior
Success Criteria: 2-3 months of profitable paper trading, performance within 80% of backtest
Deliverable: Paper trading journal with all trades documented and analyzed
Step 4: Build Trading Bot (Week 13-16)
Goal: Create autonomous system for order execution
Technical Stack Options:
- Python: ccxt library for exchange API, pandas for data, backtrader/zipline for backtesting
- JavaScript/Node: ccxt, tulind for indicators, lightweight and fast
- Hosting: VPS (AWS, DigitalOcean) or dedicated server with 99.9% uptime
Core Components to Build:
- π€ Data Feed Manager: Connect to Binance WebSocket for real-time price data
- π€ Indicator Calculator: ATR, Supertrend, 200 EMA calculation engine
- π€ Signal Generator: Detect crossovers and entry/exit conditions
- π€ Order Executor: Place, modify, cancel orders via Binance API
- π€ Position Manager: Track open positions, P&L, exposure
- π€ Risk Manager: Enforce daily loss limits, max position size, trade frequency
- π€ Error Handler: Reconnection logic, API rate limit management
- π€ Logging System: Record all decisions, orders, errors for debugging
- π€ Alert System: Telegram/email notifications for trades and errors
- π€ Dashboard: Web interface to monitor bot status and performance
Security Considerations:
- API keys with IP whitelist and withdraw restrictions
- Encrypted storage of credentials
- Rate limiting to avoid API bans
- Kill switch mechanism for emergency shutdown
Deliverable: Fully functional trading bot tested on testnet
Step 5: Live Testing with Small Capital (Week 17-24)
Goal: Validate bot in production with minimal risk
- π° Start with 10-20% of intended total capital
- π° Use minimum position sizes (0.5-1% risk per trade)
- π° Monitor bot 24/7 for first week
- π° Check-in twice daily minimum afterward
- π° Compare live performance to paper trading
- π° Document all trades and analyze discrepancies
- π° Test bot recovery from connection issues
- π° Verify all risk controls are working (daily loss, max trades)
- π° Calculate actual slippage and fee impact
What to Watch For:
- Execution delays causing different entry prices
- Slippage higher than expected
- Orders failing or getting rejected
- Bot making unexpected decisions
- Performance degradation vs paper trading
Success Criteria: 2 months profitable, max DD < 15%, no critical bugs
Deliverable: Proven bot operation with real money, full trade log analysis
Step 6: Full Autonomous Operation (Week 25+)
Goal: Scale to full intended capital with confidence
- π Gradually increase capital allocation (25% β 50% β 75% β 100%)
- π Increase position sizes proportionally
- π Continue monitoring daily but reduce intervention
- π Weekly performance reviews and strategy adjustments
- π Monthly comprehensive analysis
- π Set up automated monitoring and alerts
- π Build redundancy (backup server, failover system)
- π Maintain detailed audit trail
Ongoing Maintenance:
- Monitor for market regime changes
- Adjust parameters if strategy starts underperforming
- Update code for exchange API changes
- Regular system health checks
- Keep capital aside for exchange outages or API issues
When to Pause or Stop:
- Drawdown exceeds 25%
- Strategy stops working as expected
- Market structure changes fundamentally
- Major regulatory or exchange issues
Total Timeline Summary
- Weeks 1-2: Fix code
- Weeks 3-4: Backtest thoroughly
- Weeks 5-12: Paper trade (2-3 months)
- Weeks 13-16: Build bot infrastructure
- Weeks 17-24: Live test with small capital (2 months)
- Week 25+: Full autonomous operation
Total: ~6 months minimum from current broken state to full autonomous trading.
1. Broken Position Sizing Logic
Critical β The strategy calculates position size in "contracts" without accounting for BTC's actual price, causing zero or incorrect positions.
floor(0.46) = 0 contracts = NO POSITION
Why it fails: The formula divides USD risk by USD distance, giving a ratio, not BTC quantity. It needs to convert to actual BTC units.
2. Missing Risk Controls
Critical β No safety mechanisms protecting your capital:
- No stop loss orders β Relies only on Supertrend crossover to exit
- No take profit levels β Trades run indefinitely until reversal
- No daily loss limit β Could lose entire account in bad streak
- No maximum drawdown protection β No circuit breaker
- No trade frequency caps β Could overtrade in choppy markets
3. Risk Parameters Don't Match BTC
Critical β $230 max loss with 20 max contracts creates dangerous misalignment:
- Typical Supertrend stop distance: $1,500 - $3,000
- With $230 risk β position size: 0.08-0.15 BTC = $7,600-$14,250
- But 20 contracts (if = 20 BTC) = $1,900,000 exposure
- Either positions are too small to be viable, or max contracts is dangerously high
4. Immediate Reversal Creates Whipsaw Risk
High Priority β Strategy instantly flips longβshort on every signal, causing:
- Death by fees: 0.1-0.2% per round trip Γ many trades = substantial drag
- Choppy market carnage: Price oscillating near 200 EMA triggers multiple reversals
- Slippage compounds losses: Market orders on volatile BTC = poor fills
- No cooldown period: Can enter, exit, reverse all within minutes
1. Fix Position Sizing for Crypto
Replace the broken contract calculation with proper BTC quantity calculation:
// Option A: Risk percentage of equity
risk_percent = input(2.0, title="Risk % Per Trade") / 100
equity = strategy.equity
risk_amount = equity * risk_percent
// Calculate USD position size based on risk
position_size_usd = risk_amount / risk_per_unit_long
// Convert to BTC quantity
btc_qty = position_size_usd / close
strategy.entry("Long", strategy.long, qty=btc_qty)// Option B: Fixed USD notional
usd_position_size = input(1000, title="Position Size USD")
btc_qty = usd_position_size / close
strategy.entry("Long", strategy.long, qty=btc_qty)2. Add Stop Loss & Take Profit
Protect every trade with proper risk management:
// Stop loss at Supertrend line
stop_loss_long = up
stop_loss_short = dn
// Take profit at 2:1 risk/reward ratio
risk_long = close - stop_loss_long
take_profit_long = close + (risk_long * 2.0)
risk_short = stop_loss_short - close
take_profit_short = close - (risk_short * 2.0)
// Apply to entry orders
strategy.entry("Long", strategy.long, qty=btc_qty)
strategy.exit("Exit Long", "Long",
stop=stop_loss_long, limit=take_profit_long)3. Implement Daily Loss Limit
Prevent catastrophic losing streaks:
// Track daily P&L
max_daily_loss = input(500, title="Max Daily Loss USD")
var float daily_pnl = 0.0
var int current_day = dayofmonth
// Reset at start of new day
if (dayofmonth != current_day)
daily_pnl := 0.0
current_day := dayofmonth
// Update with closed trade results
if (strategy.closedtrades > 0)
last_trade = strategy.closedtrades.profit(strategy.closedtrades - 1)
daily_pnl := daily_pnl + last_trade
// Block new trades if limit hit
allow_trades = daily_pnl > -max_daily_loss
if (longCondition and allow_trades)
strategy.entry("Long", strategy.long, qty=btc_qty)4. Add Trade Frequency Filter
Prevent overtrading in choppy conditions:
// Minimum bars between trades
min_bars_between = input(10, title="Min Bars Between Trades")
var int last_trade_bar = 0
can_trade = bar_index - last_trade_bar >= min_bars_between
if (longCondition and can_trade)
strategy.entry("Long", strategy.long, qty=btc_qty)
last_trade_bar := bar_index// Maximum trades per day
var int trades_today = 0
var int last_day = 0
if (dayofmonth != last_day)
trades_today := 0
last_day := dayofmonth
max_daily_trades = input(5, title="Max Trades Per Day")
if (longCondition and trades_today < max_daily_trades)
strategy.entry("Long", strategy.long, qty=btc_qty)
trades_today := trades_today + 15. Improve EMA Filter Logic
Add buffer zone to reduce whipsaws around 200 EMA:
// Create buffer zone around EMA
ema_buffer_percent = input(0.5, title="EMA Buffer %") / 100
ema_upper = ema200 * (1 + ema_buffer_percent)
ema_lower = ema200 * (1 - ema_buffer_percent)
// Stricter entry conditions
longCondition = crossover(close, dn) and close > ema_upper
shortCondition = crossunder(close, up) and close < ema_lower
// Optional: Add trend strength confirmation
ema_slope = ema200 - ema200[10]
strong_uptrend = ema_slope > 0
strong_downtrend = ema_slope < 0
longCondition = longCondition and strong_uptrend
shortCondition = shortCondition and strong_downtrendHow the Strategy Works
This is a trend-following reversal system that aims to stay in the market at all times, flipping between long and short positions based on Supertrend crossovers filtered by the 200 EMA.
Core Components
- Supertrend Indicator: ATR-based dynamic support/resistance bands (Period: 6, Multiplier: 4.2)
- 200 EMA Filter: Major trend indicator β only longs above, only shorts below
- Position Sizing: Dynamic based on distance to Supertrend line (risk per trade)
- Entry Logic: Crossover signals combined with EMA filter confirmation
- Exit Logic: Immediate reversal on opposite signal (no flat periods)
Entry Conditions
Long Entry: Price crosses above lower Supertrend band AND price is above 200 EMA
Short Entry: Price crosses below upper Supertrend band AND price is below 200 EMA
Trade Execution Flow
- Supertrend identifies potential trend change (crossover)
- 200 EMA confirms we're on correct side of major trend
- Position size calculated based on distance to Supertrend line
- Trade entered immediately with no confirmation bar
- Position held until opposite crossover occurs
- On opposite signal, close current position and reverse
Best Market Conditions
β Thrives in:
- Strong trending markets (sustained 10%+ directional moves)
- Clear breaks and holds above/below 200 EMA
- High volatility with strong directional bias
- Low frequency of false breakouts
β Struggles in:
- Choppy/ranging markets (60-70% of the time for most assets)
- Price oscillating around the 200 EMA
- Low volatility consolidation periods
- Multiple false breakouts and whipsaws
- Weekend low liquidity periods (higher slippage)
Expected Trading Costs
Binance BTC/USDT Futures:
- Maker fee: 0.02% (limit orders)
- Taker fee: 0.04% (market orders)
- Average slippage: 0.01-0.05% depending on size
- Round trip cost: ~0.1-0.2%
Why This Strategy Needs Serious Work
The current implementation has fundamental flaws that could result in:
- Zero positions being entered due to broken position sizing
- Uncapped losses without stop losses or daily limits
- Rapid account depletion from overtrading in choppy markets
- Fee erosion eating 10-20% of returns even when profitable
Market Reality Check
Backtested β Real Trading: Parameters optimized for past data often fail forward. Markets change, volatility regimes shift, and correlation structures break down.
60-70% Chop Time: Most markets spend the majority of time ranging or consolidating. Trend-following strategies make money 30-40% of the time and bleed slowly the rest.
Psychological Warfare: Following a system through a 30% drawdown requires discipline most traders don't have. Many abandon strategies right before they become profitable.
Technical & Operational Risks
- API Failures: Exchange outages during volatile moves can trap you in positions
- Slippage Surprises: Weekend or low liquidity periods = worse fills than backtested
- Funding Costs: If using perpetual futures, funding rates can be 0.01-0.1% every 8 hours
- Bugs & Errors: Code mistakes can enter wrong sizes, miss exits, or double-enter
Black Swan Events
Historical backtests can't account for:
- Exchange hacks or insolvency (FTX, Mt.Gox)
- Regulatory shocks (China ban, ETF news)
- Flash crashes with 20-40% drops in minutes
- Liquidity crises where you can't exit at any reasonable price
When to Stop Trading Immediately
Halt the strategy if any of these occur:
- Daily loss limit exceeded (that's why you need one)
- Drawdown exceeds 25% of account
- 5+ consecutive losing trades
- Strategy behavior appears abnormal or unexpected
- Major market structure change (e.g., regulatory announcement)
- Exchange experiencing technical difficulties
Recommended Approach
- Fix all critical issues documented in this report
- Backtest thoroughly on 2-3 years of data including crashes
- Paper trade for 2-3 months with real-time data and realistic fees
- Start with 10-20% of intended capital and tiny position sizes (0.5-1% risk)
- Scale up slowly only after 3+ months of consistent profitability
- Never increase risk after winning streaks (stay disciplined)
Report Generated: December 2025 β’ Strategy: Supertrend with 200 EMA Filter (Pine Script v4) β’ Target Market: Binance BTC/USDT
β οΈ Not financial advice. All trading carries risk of loss.