MA Crossover Strategy?

Lyled7

New member
Can someone help me code this:

I use a MA cross strategy - EMA9 and EMA21. I'm looking for when the 9 crosses above the 21 to highlight that first candle where the cross happens, and then an alert for when the next candle breaks the high of that "crossover" candle. Example below - the first green candle immediately after the red one, would be my crossover candle, and then i'd want to know if/when the next candle, or few candles, breaks the high of that. hopefully that makes sense. Thanks.
Screen Shot 2024-03-26 at 3.36.13 PM.png
 
Can someone help me code this:

I use a MA cross strategy - EMA9 and EMA21. I'm looking for when the 9 crosses above the 21 to highlight that first candle where the cross happens, and then an alert for when the next candle breaks the high of that "crossover" candle. Example below - the first green candle immediately after the red one, would be my crossover candle, and then i'd want to know if/when the next candle, or few candles, breaks the high of that. hopefully that makes sense. Thanks.

try starting with this , it does stuff when an average crosses another.
then remove the extra stuff, and change

} else if date_en and xup then {
# buy
buy_price = price;

to be something that saves the high,

} else if xup then {
# buy
buy_high = high;

then change /create formulas to compare close to buy_high

https://usethinkscript.com/threads/...used-in-thinkorswim.13822/page-12#post-139792
 
try starting with this , it does stuff when an average crosses another.
then remove the extra stuff, and change

} else if date_en and xup then {
# buy
buy_price = price;

to be something that saves the high,

} else if xup then {
# buy
buy_high = high;

then change /create formulas to compare close to buy_high

https://usethinkscript.com/threads/...used-in-thinkorswim.13822/page-12#post-139792
Sorry - not following. are you saying use the code from post 139792 and then use the code you have written above?
 
Sorry - not following. are you saying use the code from post 139792 and then use the code you have written above?
you said help me. so i mentioned a possible code for you to start with and modify. instead of having to start from scratch.
the linked study and the code snippets will have to be changed.
try some things and see how you do.
 
you said help me. so i mentioned a possible code for you to start with and modify. instead of having to start from scratch.
the linked study and the code snippets will have to be changed.
try some things and see how you do.

i can't make this work. i'm not super familiar w/ coding. can you help?
 
Last edited by a moderator:

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
327 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