Moving Average alerts for ThinkOrSwim


New member
Hello all!! Hope the market is treating you all well. I have for you today two alert templates to help you find entry points once you have done your DD and determined trend direction SPY alert uptrend (5 min) and SPY alert downtrend (5 min) . The two conditions are simple, for example on the SPY alert downtrend (set the alert for any stock or option you want): it 1. checks to see if the underlying stock or option bid or last price is ABOVE the MA 15 (moving average for the last 15 periods) on a 5 min time chart AND 2. the current MA 15 is lower than the previous MA 15 from the last bar or dot (in my case). If both conditions are true it sends my an email, text, and push notification of the action in near real time telling me it would now be a great time to enter into a short position IF I deemed the overall 10-15 min trend is still in a downtrend. With it you get specific notifications to catch all of the good entry point if you are not looking at the stock 24/7 and have determined trend direction and missed earlier entries 👍🏽. Any questions let me know and I pray this helps someone. Remember… “leave your emotions at the login screen. You’re not a psychic. You can be right or wrong, but if you’re always ready for both scenarios and cut your losses short you’ll be successful 😉!”

Uptrend shared link:
downtrend shared link:

Last edited by a moderator:
Thank you. I'd appreciate it if you could provide the code (Is this code suitable for 30 Mts and a one-hour time frame or only 5 Mts?). I'd like to add this to my existing study set as a study.
Hello, this was a shared alert.
  • click the link and add the alert,
  • you’ll be able to edit the alert and underlying symbol and change the time frame from 5 min to whichever you’d like in MARKET WATCH, ALERTS TAB,
  • RIGHT CLICK ALERT, CREATE SIMILAR ALERT. Where it says PRICE, click the drop down menu where STUDY is and go to edit.
  • At the top it will say 5M next to CONDITION SETUP.
You can also create it from scratch by
  • right click on chart,
  • create alert.
  • Once in the Create Alert on Price menu, choose your symbol.
  • In the Price drop down menu,
  • choose STUDY and go to edit in the next column on highlighting it.
  • In there change your timeframe at the top to whichever you’d prefer.
  • In the condition window, delete any condition there and choose add condition.
  • Choose price condition and either bid or last or whichever variable you want price wise.
  • Next choose is GREATER THAN, then choose MovingAverage and set it on weighted and 15 period or whichever determining factor you prefer.
  • Now you have a trigger when the price is higher than the MovingAverage you’ll get an alert.
  • Next add another condition where the MovingAverage is LESS THAN the MovingAverage and add offset 1 to the moving average in the second list.
  • That is the downtrend alert. When the moving average is trending down and the price goes above it you’ll get an alert.
  • To make an uptrend alert switch the GREATER THAN for LESS THAN in the price condition and LESS THAN for GREATER THAN in the moving averages condition.
Last edited by a moderator:
Thank you so much for taking the time to explain everything so thoroughly. I was able to change the time frame from 5 minutes to 30 minutes by following your directions.

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
146 Online
Create Post

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.