Position sizing mismatch
If qty mode and exchange contract model are misaligned, orders can be dramatically over- or under-sized.
Risk & Strategy
Core issues, required code-level fixes, and operational stop conditions before any scale-up.
Position sizing mismatch
If qty mode and exchange contract model are misaligned, orders can be dramatically over- or under-sized.
No enforced downside cap
Without hard stops and daily loss limits, a single adverse regime can cause catastrophic drawdown.
Whipsaw-sensitive reversal logic
Always-in-market reversal behavior can churn fees heavily during range-bound conditions around the EMA.
Cost drag under market-order flow
Round-trip fees plus slippage can erase expected edge if trade frequency remains high.
// Risk percentage model
risk_percent = input(1.0, title="Risk % Per Trade") / 100
risk_amount = strategy.equity * risk_percent
position_size_usd = risk_amount / risk_per_unit_long
btc_qty = position_size_usd / close
strategy.entry("Long", strategy.long, qty=btc_qty)
stop_loss_long = up
risk_long = close - stop_loss_long
take_profit_long = close + (risk_long * 2.0)
strategy.entry("Long", strategy.long, qty=btc_qty)
strategy.exit("Exit Long", "Long", stop=stop_loss_long, limit=take_profit_long)
max_daily_loss = input(500, title="Max Daily Loss USD")
min_bars_between = input(10, title="Min Bars Between Trades")
max_daily_trades = input(5, title="Max Trades Per Day")
allow_trades = daily_pnl > -max_daily_loss and trades_today < max_daily_trades and bar_index - last_trade_bar >= min_bars_between
ema_buffer_percent = input(0.5, title="EMA Buffer %") / 100
ema_upper = ema200 * (1 + ema_buffer_percent)
ema_lower = ema200 * (1 - ema_buffer_percent)
longCondition = crossover(close, dn) and close > ema_upper
shortCondition = crossunder(close, up) and close < ema_lower
This material is for system design and operational planning only. It is not financial advice. Trading leveraged products can result in full capital loss.