◆ New — Strategy Validator, Code Fixer & Prop Compliance Checker are live. Try one free →
Home / Case studies / Strategy with an unwired risk input
Case study · Strategy with an unwired risk input

The stop-loss that isn't actually a stop-loss

A strategy exposes a tidy 'Stop %' input in its settings, so it looks risk-managed. But the input is never connected to an exit — a subtle bug our engine is specifically built to catch.

The code

//@version=6
strategy("Trend rider", overlay = true)

stopPerc = input.float(2.0, "Stop %")
ema = ta.ema(close, 50)

if ta.crossover(close, ema)
    strategy.entry("Long", strategy.long)

What our engine found

92/ 100
Strategy Health Score™ · code correctness
Clean
0 critical0 high1 medium0 info
mediumline 4 · IN

Intent mismatch: a stop/risk input is declared but never wired into a strategy.exit(stop=...) — the risk control doesn't exist in the executed logic.

Why it matters

Our engine flags an intent mismatch: a stop/risk input is declared but never wired into a strategy.exit(stop=...). The dropdown promises a stop-loss, the executed logic has none, and the backtest quietly runs with no protective stop at all — so its drawdown is not the drawdown you'd actually experience. Either register the input via strategy.exit("x", stop = ...) or remove the dead control so the settings tell the truth.

Takeaways

Run your own script through the same engine — get your Strategy Health Score →

Code-correctness analysis only — not financial advice, and not a measure of profitability. The code shown is a representative community pattern, not any specific author's script. Trading involves substantial risk of loss.

Catch the bug that compiles.Run auditGet Pro