OPEN-SOURCE SCRIPT
Signal Expectancy Analyzer [SpokoStocks]

Signal Expectancy Analyzer answers one question: on this chart, what has actually happened after a signal in the past? It covers majority of indicator in TradingView's Technicals panel as an event, lets you connect any other indicator, and ranks all of them against each other on the symbol and timeframe you trade.
WHAT IT SHOWS
• A statistics table for the selected signal at four horizons (5, 10, 20 and 40 bars by default): number of signals, win rate, average and median forward return, the baseline return of any bar over the same horizon, the edge over that baseline, a t-statistic, and the average maximum favourable and adverse excursion.
• A leaderboard that ranks all 43 built-in signals by their edge at the primary horizon, so you can see which standard indicators have historically worked on this chart and which have not.
• A projected cone from the most recent signal: the average historical path and a one-standard-deviation band, drawn forward on the price chart.
• Signal markers coloured by outcome at the primary horizon: won, lost, or still pending.
• A compact return distribution in the table.
SIGNALS INCLUDED
Every indicator from the Technicals panel, each as a bullish and a bearish event: RSI(14) oversold and overbought, Stochastic(14,3) crosses in the extreme zones, CCI(20) crossing ±100, ADX(14) directional crosses, Awesome Oscillator zero cross, Momentum(10) zero cross, MACD(12,26,9) signal cross, Stochastic RSI crosses in the extreme zones, Williams %R(14) crossing −80 and −20, Bull Bear Power(13) zero cross, Ultimate Oscillator crossing 30 and 70, close crossing EMA(20), SMA(50) and SMA(200), golden and death cross, close crossing the Ichimoku cloud, Hull MA(9) turns, close crossing VWMA(20). Also Bollinger Band touches, N-bar low and high closes, gaps, and an external source that takes any plot from any other indicator on your chart.
Every signal is an event, the first bar its condition becomes true, never a state, and a cooldown prevents clustered signals from being counted several times. Each signal has a natural direction, so a bearish signal counts a falling market as a win.
HOW IT WORKS
The script cannot look into the future, so it works backwards: on every bar it checks which signals fired h bars ago and records the return from that bar's close to the current close, together with the highest and lowest price reached in between. Baseline is the average h-bar return of every bar on the chart, which is what a random entry would have earned; edge is the signal's average minus that baseline. The t-statistic is the average divided by its standard error; values beyond ±2 suggest the result is unlikely to be noise. The cone is the bar-by-bar average path after all past occurrences of the selected signal, with one standard deviation either side, anchored to the latest signal's close.
HOW TO USE IT
1. Apply the indicator to the chart and timeframe you actually trade.
2. Read the leaderboard first. Signals near the top with a t-statistic beyond 2 and at least 30 occurrences deserve attention; the rest is noise on this chart.
3. Select any signal to study it in depth, or connect your own indicator through the external source.
4. Compare edge with baseline. A high win rate with no edge simply means the market was trending.
5. Use average MFE and MAE to set targets and stops that match how the signal has behaved.
6. Use the cone as a visual expectation for an open signal, not as a prediction.
LIMITATIONS
• Results depend on the history loaded on the chart and change as bars are added.
• Testing 43 signals at once invites false positives: with that many comparisons, a few will look good by chance. Treat the leaderboard as a screening step and confirm on other timeframes and symbols.
• Overlapping signals share bars, so returns are not fully independent and the t-statistic is indicative rather than exact.
• The cone assumes the future distribution resembles the past and ignores regime changes.
• The external source only triggers on the transition above zero.
WHAT IT SHOWS
• A statistics table for the selected signal at four horizons (5, 10, 20 and 40 bars by default): number of signals, win rate, average and median forward return, the baseline return of any bar over the same horizon, the edge over that baseline, a t-statistic, and the average maximum favourable and adverse excursion.
• A leaderboard that ranks all 43 built-in signals by their edge at the primary horizon, so you can see which standard indicators have historically worked on this chart and which have not.
• A projected cone from the most recent signal: the average historical path and a one-standard-deviation band, drawn forward on the price chart.
• Signal markers coloured by outcome at the primary horizon: won, lost, or still pending.
• A compact return distribution in the table.
SIGNALS INCLUDED
Every indicator from the Technicals panel, each as a bullish and a bearish event: RSI(14) oversold and overbought, Stochastic(14,3) crosses in the extreme zones, CCI(20) crossing ±100, ADX(14) directional crosses, Awesome Oscillator zero cross, Momentum(10) zero cross, MACD(12,26,9) signal cross, Stochastic RSI crosses in the extreme zones, Williams %R(14) crossing −80 and −20, Bull Bear Power(13) zero cross, Ultimate Oscillator crossing 30 and 70, close crossing EMA(20), SMA(50) and SMA(200), golden and death cross, close crossing the Ichimoku cloud, Hull MA(9) turns, close crossing VWMA(20). Also Bollinger Band touches, N-bar low and high closes, gaps, and an external source that takes any plot from any other indicator on your chart.
Every signal is an event, the first bar its condition becomes true, never a state, and a cooldown prevents clustered signals from being counted several times. Each signal has a natural direction, so a bearish signal counts a falling market as a win.
HOW IT WORKS
The script cannot look into the future, so it works backwards: on every bar it checks which signals fired h bars ago and records the return from that bar's close to the current close, together with the highest and lowest price reached in between. Baseline is the average h-bar return of every bar on the chart, which is what a random entry would have earned; edge is the signal's average minus that baseline. The t-statistic is the average divided by its standard error; values beyond ±2 suggest the result is unlikely to be noise. The cone is the bar-by-bar average path after all past occurrences of the selected signal, with one standard deviation either side, anchored to the latest signal's close.
HOW TO USE IT
1. Apply the indicator to the chart and timeframe you actually trade.
2. Read the leaderboard first. Signals near the top with a t-statistic beyond 2 and at least 30 occurrences deserve attention; the rest is noise on this chart.
3. Select any signal to study it in depth, or connect your own indicator through the external source.
4. Compare edge with baseline. A high win rate with no edge simply means the market was trending.
5. Use average MFE and MAE to set targets and stops that match how the signal has behaved.
6. Use the cone as a visual expectation for an open signal, not as a prediction.
LIMITATIONS
• Results depend on the history loaded on the chart and change as bars are added.
• Testing 43 signals at once invites false positives: with that many comparisons, a few will look good by chance. Treat the leaderboard as a screening step and confirm on other timeframes and symbols.
• Overlapping signals share bars, so returns are not fully independent and the t-statistic is indicative rather than exact.
• The cone assumes the future distribution resembles the past and ignores regime changes.
• The external source only triggers on the transition above zero.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.