Learn how to build powerful mean reversion scanners and strategies for ThinkOrSwim using the 50-day Simple Moving Average
Download IndicatorDiscover how to build custom mean reversion scanners that automatically find high-probability trading opportunities when stocks deviate from their 50-day Simple Moving Average.
In this detailed tutorial, you’ll learn to create 3 powerful scans:
Whether you’re a day trader or swing trader, these scanners will help you spot mean reversion opportunities before major price movements back to the 50-day moving average, giving you a significant edge in sideways and choppy market conditions.
The 50-day Simple Moving Average stands as one of the most watched and respected technical indicators in trading. When stock prices stretch too far from this crucial level, they often snap back like a rubber band – creating profitable mean reversion opportunities for savvy traders. This comprehensive guide will teach you how to systematically identify and trade these high-probability setups using custom ThinkOrSwim scanners and proven strategies.
The 50-day SMA represents the average closing price over the past 50 trading days, making it a powerful gauge of intermediate-term sentiment. Unlike shorter moving averages that can be noisy, or longer ones that lag significantly, the 50-day strikes the perfect balance for mean reversion strategies.
Here’s why professional traders rely on 50-day SMA reversion:
Mean reversion trading operates on a simple principle: prices that move too far from their average tend to return to that average over time. The 50-day SMA serves as our “mean” or center point, and we profit when stretched prices snap back.
The key is identifying when a stock has moved far enough from its 50-day SMA to create a high-probability reversion setup. This typically occurs when:
Unlike trend-following strategies that can suffer during choppy markets, mean reversion to the 50-day SMA thrives in sideways conditions where stocks oscillate around their moving averages.
Our first scanner identifies stocks that have moved significantly away from their 50-day SMA and are showing signs of potential reversion. This forms the foundation for all our mean reversion strategies.
The core logic measures the percentage distance between the current price and the 50-day SMA:
def sma50 = SimpleMovingAvg(close, 50);
def percentFromSMA = ((close - sma50) / sma50) * 100;
plot bullishReversion = percentFromSMA = -15;
plot bearishReversion = percentFromSMA >= 5 and percentFromSMA <= 15;
This scanner looks for stocks trading 5-15% away from their 50-day SMA. The range is crucial - stocks closer than 5% haven't moved far enough to create compelling setups, while those beyond 15% may be experiencing fundamental changes rather than temporary deviations.
Bullish Reversion Signals: Stocks trading 5-15% below their 50-day SMA
Bearish Reversion Signals: Stocks trading 5-15% above their 50-day SMA
While single-timeframe analysis can identify potential setups, adding multi-timeframe confirmation dramatically improves success rates. This scanner ensures that the reversion setup aligns across multiple timeframes.
The strategy combines daily 50-day SMA analysis with shorter-term confirmation:
def sma50Daily = SimpleMovingAvg(close, 50);
def sma20 = SimpleMovingAvg(close, 20);
def percentFromSMA50 = ((close - sma50Daily) / sma50Daily) * 100;
def shortTermMomentum = close > sma20;
plot multiTimeframeReversion =
(percentFromSMA50 = 6 and !shortTermMomentum);
This scanner identifies stocks where:
Multi-timeframe confirmation reduces false signals and increases the probability of successful mean reversion trades.
The most reliable mean reversion setups occur when institutional money starts flowing in the direction of the expected reversion. This scanner combines our distance analysis with volume confirmation to identify the highest-probability opportunities.
def sma50 = SimpleMovingAvg(close, 50);
def percentFromSMA = ((close - sma50) / sma50) * 100;
def avgVolume = SimpleMovingAvg(volume, 20);
def volumeConfirmation = volume > avgVolume * 1.5;
def priceAction = close > open; # For bullish reversions
plot volumeReversion =
percentFromSMA = -12 and
volumeConfirmation and
priceAction;
This scanner identifies the cream of the crop - stocks showing:
Volume confirmation is crucial because it indicates that smart money is stepping in to buy the dip or sell the rip, supporting the expected reversion move.
Beyond scanning, you'll want visual indicators to track reversion setups on your charts. Here's how to build a comprehensive 50-day SMA reversion indicator:
# 50-Day SMA Reversion Indicator
declare lower;
input length = 50;
def sma = SimpleMovingAvg(close, length);
def percentDistance = ((close - sma) / sma) * 100;
plot distance = percentDistance;
plot upperThreshold = 8;
plot lowerThreshold = -8;
plot reversionZoneUpper = 12;
plot reversionZoneLower = -12;
distance.SetDefaultColor(Color.WHITE);
upperThreshold.SetDefaultColor(Color.YELLOW);
lowerThreshold.SetDefaultColor(Color.YELLOW);
reversionZoneUpper.SetDefaultColor(Color.RED);
reversionZoneLower.SetDefaultColor(Color.GREEN);
AddCloud(upperThreshold, reversionZoneUpper, Color.LIGHT_RED, Color.LIGHT_RED);
AddCloud(lowerThreshold, reversionZoneLower, Color.LIGHT_GREEN, Color.LIGHT_GREEN);
This indicator plots the percentage distance from the 50-day SMA in a lower panel, with colored zones indicating when stocks are stretched enough for reversion trades.
Now that you can identify reversion setups, here are proven rules for trading them profitably:
Bullish Reversion Strategy:
Bearish Reversion Strategy:
Market Context Analysis: Mean reversion works best in ranging or mildly trending markets. During strong trending phases, stocks can stay "stretched" from their moving averages for extended periods. Use broader market indicators like VIX or market breadth to determine when conditions favor reversion trading.
Sector Rotation Awareness: Some sectors naturally trade at premiums or discounts to their moving averages. Technology stocks might consistently trade above their 50-day SMA during growth phases, while utilities might trade below during risk-on periods. Adjust your thresholds based on sector characteristics.
Earnings Calendar Consideration: Avoid reversion trades within 5 days of earnings announcements, as fundamental catalysts can override technical mean reversion tendencies.
Options Strategies: Consider using options for reversion trades to limit risk and increase return potential. Iron condors work well when you expect a stock to revert to its 50-day SMA, while long straddles can profit from the volatility of the reversion move itself.
Mean reversion trading requires disciplined risk management because not every stretched stock will revert quickly:
Reversion to the 50-day SMA works best in specific market conditions:
Ideal Conditions:
Avoid During:
To validate your reversion strategies, track these key metrics:
Use ThinkOrSwim's Strategy Tester to backtest your reversion rules and optimize parameters for different market conditions.
Reversion to the 50-day SMA works well combined with:
Trading reversion to the 50-day moving average provides a systematic approach to profiting from one of the market's most reliable tendencies. By combining proper scanning techniques, disciplined entry and exit rules, and solid risk management, you can build a profitable strategy that thrives in the choppy, sideways markets that challenge many other approaches.
Remember that mean reversion is a probability game, not a certainty. Some stocks will continue trending away from their 50-day SMA, which is why proper risk management and position sizing are crucial. Focus on finding the highest-probability setups using volume confirmation and multi-timeframe analysis, and always respect your stop losses.
Start by paper trading these strategies to get comfortable with the timing and mechanics. Once you've proven the approach works for your trading style, gradually increase position sizes while maintaining strict risk management. The 50-day SMA reversion strategy can become a cornerstone of a diversified trading approach that performs well across various market conditions.
# 50-Day SMA Reversion Scanner for ThinkOrSwim
# Generated by TOS Indicators
# Full tutorial: tosindicators.com/indicators/reversion-to-50-sma
# Scan 1: Basic Reversion Setup
def sma50 = SimpleMovingAvg(close, 50);
def percentFromSMA = ((close – sma50) / sma50) * 100;
plot bullishReversion = percentFromSMA = -15;
plot bearishReversion = percentFromSMA >= 5 and percentFromSMA sma20;
plot multiTimeframeReversion =
(percentFromSMA = 6 and !shortTermMomentum);
# Scan 3: Volume-Confirmed Reversion
def avgVolume = SimpleMovingAvg(volume, 20);
def volumeConfirmation = volume > avgVolume * 1.5;
def bullishPriceAction = close > open;
plot volumeReversion =
percentFromSMA = -12 and
volumeConfirmation and
bullishPriceAction;
# Reversion Distance Indicator (Lower Study)
declare lower;
plot distance = percentFromSMA;
plot upperThreshold = 8;
plot lowerThreshold = -8;
plot reversionZoneUpper = 12;
plot reversionZoneLower = -12;
distance.SetDefaultColor(Color.WHITE);
upperThreshold.SetDefaultColor(Color.YELLOW);
lowerThreshold.SetDefaultColor(Color.YELLOW);
reversionZoneUpper.SetDefaultColor(Color.RED);
reversionZoneLower.SetDefaultColor(Color.GREEN);
AddCloud(upperThreshold, reversionZoneUpper, Color.LIGHT_RED, Color.LIGHT_RED);
AddCloud(lowerThreshold, reversionZoneLower, Color.LIGHT_GREEN, Color.LIGHT_GREEN);Want the .ts file and the one-click import? Both come with a free account.
Here are some resources that you may find useful:
Join 40,000+ traders using institutional-grade tools for ThinkOrSwim.
Get the Bundle