Win Rate With Its Error Bar (Wilson 95%)

A win rate is a measurement, and a measurement on a few dozen trades has an error bar that strategy reports don't print. This script puts it on the chart.
It trades one deliberately dull rule bar by bar: long when the close crosses above a simple moving average, out when it crosses back below, measured at the signal bar's close with no commissions or slippage. Every closed trade counts as a win or a loss, and a flat exit counts as a loss.
Blue is the running win rate. The teal band is its Wilson 95% score interval. Red is the breakeven win rate implied by the rule's own payoff so far, 1 / (1 + average win / average loss), or a fixed value you choose.
Two things worth watching. The band narrows slowly: halving its width takes roughly four times the trades, because it shrinks with the square root of the count. And the question that matters is not where the blue line is but whether the bottom of the band has cleared the red one. The table shows the closed-trade count, the interval, and how many trades the current win rate would need before the lower end clears breakeven.
Open source so you can swap in your own rule and watch the same arithmetic. Arithmetic on your chart, not a result of mine. Nothing here is investment advice.
It trades one deliberately dull rule bar by bar: long when the close crosses above a simple moving average, out when it crosses back below, measured at the signal bar's close with no commissions or slippage. Every closed trade counts as a win or a loss, and a flat exit counts as a loss.
Blue is the running win rate. The teal band is its Wilson 95% score interval. Red is the breakeven win rate implied by the rule's own payoff so far, 1 / (1 + average win / average loss), or a fixed value you choose.
Two things worth watching. The band narrows slowly: halving its width takes roughly four times the trades, because it shrinks with the square root of the count. And the question that matters is not where the blue line is but whether the bottom of the band has cleared the red one. The table shows the closed-trade count, the interval, and how many trades the current win rate would need before the lower end clears breakeven.
Open source so you can swap in your own rule and watch the same arithmetic. Arithmetic on your chart, not a result of mine. Nothing here is investment advice.
Ten checks before you believe a backtest — the free one-page checklist: quanticator.app/tv · No-repaint HTF Template Pack (Pine v6, $39): jordonharrell.gumroad.com/l/norepaint-htf-template-pack
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
Ten checks before you believe a backtest — the free one-page checklist: quanticator.app/tv · No-repaint HTF Template Pack (Pine v6, $39): jordonharrell.gumroad.com/l/norepaint-htf-template-pack
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.