OPEN-SOURCE SCRIPT
Mean Reversion Pro

๐ Mean Reversion Pro โ Data-Driven Edge on Any Market, Any Timeframe
Most mean reversion indicators tell you the price is "too far" from the moving average. This one tells you exactly how far is statistically worth trading โ using your own chart's historical data as proof.
Works on all instruments and timeframes: futures (NQ, ES, CL, GCโฆ), crypto (BTC, ETH, SOLโฆ), forex (EUR/USD, GBP/USDโฆ), indices (SPX, DAX, NASDAQโฆ), stocks, commodities โ anything with a price and volume.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ WHAT THIS INDICATOR DOES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Mean Reversion Pro silently analyses every historical instance where price deviated from a moving average by a given distance. For each of 15 tested threshold levels it computes:
โข Win rate โ % of times price returned to the MA within the timeout
โข Expectancy โ (win-rate ร avg MFE) โ (loss-rate ร avg MAE)
โข Profit Factor โ gross gain / gross loss ratio
โข Avg MAE โ average adverse excursion (how far against you before reverting)
โข Avg MFE โ average favourable excursion (how far in your favour)
โข Avg return time โ average bars needed to reach the MA
It then automatically selects the threshold with the highest expectancy that also satisfies your minimum win-rate and minimum occurrences filters โ and only then shows a signal. No manual optimisation. No curve-fitting.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ๏ธ KEY FEATURES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Universal โ works on futures, crypto, forex, indices, stocks, commodities
โ 3 threshold modes: fixed Points, ATR multiples, Z-Score (adapts to any volatility regime)
โ 5 MA types: EMA, SMA, WMA, VWMA, Hull MA
โ Auto-optimised threshold โ the indicator finds the best level by itself
โ Real-time dashboard: win-rate, expectancy, profit factor, MAE, MFE, return time (Long & Short)
โ Dynamic bands: 1ร and 1.5ร optimal threshold zones drawn on the chart
โ Non-repainting signals โ only fires on confirmed, closed bars
โ Optional filters: trend (EMA 50), volume, US session, minimum ATR
โ Minimum history guard โ signals are held until enough bars have been analysed
โ All parameters fully exposed and documented with tooltips
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ WHO IS THIS FOR
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โข Futures traders โ NQ, MNQ, ES, MES, CL, GC, SI, ZBโฆ
โข Crypto traders โ BTC, ETH, SOL and all altcoins on any exchange
โข Forex traders โ all major, minor and exotic pairs
โข Index traders โ SPX, NDX, DAX, FTSE, CAC, Nikkeiโฆ
โข Stock traders and swing traders looking for mean reversion pullbacks
โข Prop firm traders who need a systematic, rules-based edge
โข Any trader tired of arbitrary support/resistance levels with no statistical backing
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง HOW TO USE IT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. Apply to any chart on any timeframe
2. Let at least 500 bars load (recommended: 1000โ2000 for robust statistics)
3. Choose Threshold Mode:
โ Points โ best for futures and indices (fixed price distances)
โ ATR โ best for crypto and forex (volatility-adjusted)
โ Z-Score โ best for statistical/quant approaches
4. Set your minimum Win Rate (default 65%) and minimum Occurrences (default 15)
5. A signal appears only when all statistical conditions are met AND your filters pass
6. Read the dashboard to assess setup quality before entering a trade
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก WHY EXPECTANCY MATTERS MORE THAN WIN RATE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
A strategy with 80% win rate can still lose money if the average loss is 5ร the average win. Mean Reversion Pro uses expectancy โ the only metric that combines win rate, average gain and average loss into a single number โ as its selection criterion. A signal only appears when the math is in your favour.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๏ธ DISCLAIMER
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This indicator is a decision-support tool only. It does not provide financial advice and does not guarantee future results. Past statistical performance is not indicative of future performance. Always use proper risk management.
Most mean reversion indicators tell you the price is "too far" from the moving average. This one tells you exactly how far is statistically worth trading โ using your own chart's historical data as proof.
Works on all instruments and timeframes: futures (NQ, ES, CL, GCโฆ), crypto (BTC, ETH, SOLโฆ), forex (EUR/USD, GBP/USDโฆ), indices (SPX, DAX, NASDAQโฆ), stocks, commodities โ anything with a price and volume.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ WHAT THIS INDICATOR DOES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Mean Reversion Pro silently analyses every historical instance where price deviated from a moving average by a given distance. For each of 15 tested threshold levels it computes:
โข Win rate โ % of times price returned to the MA within the timeout
โข Expectancy โ (win-rate ร avg MFE) โ (loss-rate ร avg MAE)
โข Profit Factor โ gross gain / gross loss ratio
โข Avg MAE โ average adverse excursion (how far against you before reverting)
โข Avg MFE โ average favourable excursion (how far in your favour)
โข Avg return time โ average bars needed to reach the MA
It then automatically selects the threshold with the highest expectancy that also satisfies your minimum win-rate and minimum occurrences filters โ and only then shows a signal. No manual optimisation. No curve-fitting.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ๏ธ KEY FEATURES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Universal โ works on futures, crypto, forex, indices, stocks, commodities
โ 3 threshold modes: fixed Points, ATR multiples, Z-Score (adapts to any volatility regime)
โ 5 MA types: EMA, SMA, WMA, VWMA, Hull MA
โ Auto-optimised threshold โ the indicator finds the best level by itself
โ Real-time dashboard: win-rate, expectancy, profit factor, MAE, MFE, return time (Long & Short)
โ Dynamic bands: 1ร and 1.5ร optimal threshold zones drawn on the chart
โ Non-repainting signals โ only fires on confirmed, closed bars
โ Optional filters: trend (EMA 50), volume, US session, minimum ATR
โ Minimum history guard โ signals are held until enough bars have been analysed
โ All parameters fully exposed and documented with tooltips
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ WHO IS THIS FOR
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โข Futures traders โ NQ, MNQ, ES, MES, CL, GC, SI, ZBโฆ
โข Crypto traders โ BTC, ETH, SOL and all altcoins on any exchange
โข Forex traders โ all major, minor and exotic pairs
โข Index traders โ SPX, NDX, DAX, FTSE, CAC, Nikkeiโฆ
โข Stock traders and swing traders looking for mean reversion pullbacks
โข Prop firm traders who need a systematic, rules-based edge
โข Any trader tired of arbitrary support/resistance levels with no statistical backing
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง HOW TO USE IT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. Apply to any chart on any timeframe
2. Let at least 500 bars load (recommended: 1000โ2000 for robust statistics)
3. Choose Threshold Mode:
โ Points โ best for futures and indices (fixed price distances)
โ ATR โ best for crypto and forex (volatility-adjusted)
โ Z-Score โ best for statistical/quant approaches
4. Set your minimum Win Rate (default 65%) and minimum Occurrences (default 15)
5. A signal appears only when all statistical conditions are met AND your filters pass
6. Read the dashboard to assess setup quality before entering a trade
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก WHY EXPECTANCY MATTERS MORE THAN WIN RATE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
A strategy with 80% win rate can still lose money if the average loss is 5ร the average win. Mean Reversion Pro uses expectancy โ the only metric that combines win rate, average gain and average loss into a single number โ as its selection criterion. A signal only appears when the math is in your favour.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๏ธ DISCLAIMER
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This indicator is a decision-support tool only. It does not provide financial advice and does not guarantee future results. Past statistical performance is not indicative of future performance. Always use proper risk management.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.