Mean Reversion VWAP For ThinkOrSwim

Abutterfly

New member
VIP
Don't know if anyone posted this version of the VWAP in watchlist. My version takes the difference and gets the percentage of ATR at any moment. So, if Percentage is over or under 30% ATR, we should bet the reversal , or they call this mean reversion.........

Code:
# ATR
def atrLength = 14;
def atr = Average(TrueRange(high, close, low), atrLength);

plot vwap1 = vwap();

AssignBackgroundColor(if close > vwap1 then Color.GREEN else if close < vwap1 then Color.RED else Color.dark_gray);
def vwapP = round((close - vwap1)/ ATR *100,1);
addlabel( yes, vwapP+" %" , if close > vwap then color.black else color.white);
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Very cool as always!! I tweaked it a tad adding some other variables to the buy and sells to catch them earlier in the initial move - I added buy arrows when the (5 EMA crosses above VWAP - optional), EMA slope changes from negative to positive, EMA’s rate of change is increasing, volume is above average volume.
I added sell arrows when the (5 EMA crosses below VWAP- optional), EMA slope changes from positive to negative, EMA’s rate of change is decreasing and volume is below average.
https://tos.mx/!AkVU3wun

Works on any time frame, you can adjust length, volume period, or sensitivity of slope/ROC as needed.
The BuyArrow and SellArrow plots only show when all enhanced conditions align.

1754326420634.png

1754326789434.png
 
Last edited:
Very cool as always!! I tweaked it a tad adding some other variables to the buy and sells to catch them earlier in the initial move - I added buy arrows when the (5 EMA crosses above VWAP - optional), EMA slope changes from negative to positive, EMA’s rate of change is increasing, volume is above average volume.
I added sell arrows when the (5 EMA crosses below VWAP- optional), EMA slope changes from positive to negative, EMA’s rate of change is decreasing and volume is below average.
https://tos.mx/!AkVU3wun

Works on any time frame, you can adjust length, volume period, or sensitivity of slope/ROC as needed.
The BuyArrow and SellArrow plots only show when all enhanced conditions align.

View attachment 25361


You rock ant ! This time no labels? lol. Wondering if you have those impliedmove labels shared somewhere too? Thanks as always!

Also thinking about adding your alphatrends 5sma as a dropdown option here to see the quality of the signals.
 
You rock ant ! This time no labels? lol. Wondering if you have those impliedmove labels shared somewhere too? Thanks as always!

Also thinking about adding your alphatrends 5sma as a dropdown option here to see the quality of the signals.
I made it thermal identifying if it is a bear stack or bull stack or mixed, and added labels and added which average is where in the current order .
https://tos.mx/!4WXwIFjJ
1754440793493.png

In the chart below the 100 MA is lagging or lower than the rest --
Summary: When MA100 Lags

SignalMeaning
MA100 < Shorter MAsLong-term trend is still catching up
Short MAs turning upShort-term momentum increasing
MA100 flat/downMarket may be in early reversal or sideways
MA100 starting to curlLong-term trend may be shifting upward
1754441075920.png

If you’re using this thermal-style MA stack, a bullish stack with MA100 lagging is like a "warming signal" — it tells you that momentum is building, and a larger trend shift might be on the horizon, but it’s not fully confirmed yet by long-term participants.
 
You rock ant ! This time no labels? lol. Wondering if you have those impliedmove labels shared somewhere too? Thanks as always!

Also thinking about adding your alphatrends 5sma as a dropdown option here to see the quality of the signals.
Here is an example of how to use this new info of which MA is leading or lagging with a chart example at the end:
Given Moving Averages:

MA LengthValue
MA9107.24
MA21107.16 ⬅️ Lagging
MA34107.20
MA50107.25
MA100107.72 ⬆️ Highest

What This Configuration Suggests:

🔹 1. MA21 Lagging Implies a Mid-Term Pullback or Slowdown
  • The MA21 being below both MA9 and MA34 suggests:
    • There was a recent price pullback or sideways action in the last few weeks (mid-term).
    • The short-term price (MA9) is recovering faster than the 21-period average.
    • The 21-period average is catching up, but not there yet.
Interpretation: Momentum is returning, but the mid-term trend hasn't fully flipped bullish yet.

🔹 2. MA100 Still on Top = Long-Term Bearish Overhang
  • Since MA100 is at 107.72, and all others are below:
    • The long-term trend is still bearish (or not yet bullish).
    • This suggests that prices were lower recently but still underperforming over the last ~100 bars.
Interpretation: You're likely in an early-stage recovery, but no confirmed full-trend reversal yet.

🔹 3. Slight MA Spread = Consolidation or Coiling
  • All MAs are clustered tightly between 107.16 and 107.25 (except for MA100):
    • This usually happens during low volatility or compression zones.
    • Price may be preparing for a breakout — direction to be confirmed by price and volume.
Interpretation: Market is coiling, and MA21 lagging slightly may just be a delay in catching up due to past dip.

Summary:

SignalInference
MA21 below MA9, MA34, MA50Mid-term lag → still reflecting a past dip
MA9 > MA21Short-term bounce/recovery underway
MA100 above allLong-term trend is still downward or flattening
MAs tightly groupedCompression → breakout likely approaching


Actionable Use (if trading):
  • If price breaks above MA100 with rising volume → stronger bullish confirmation.
  • If MAs begin to align in order (9 > 21 > 34 > 50 > 100) → that’s a bullish stack.
  • If MA21 begins rising and crosses above MA34 or MA50 → look for follow-through strength.
1754441915080.png
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
281 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top