Looking For Input For HMA Strategy

METAL

Well-known member
Plus
I really think this is going to be a good strategy. I need to still add Labels so it will work with Macro Recorder. That isn't necessary though. I would like every ones feedback and criticism. Try it out. I will attempt to add labels. I also may add a couple of filters. Not sure if I will need them because with my testing so far, as long as you lengthen the Fast HMA, you can cut out most of the pullbacks and chop.

Latest Code:
HMA_V2 https://tos.mx/s900BxW

Code:
#Metal's-HMA-Strat-V1
#Credit @dap711 for providing the base code here https://usethinkscript.com/threads/moving-average-master-strategy-for-thinkorswim.13975/post-118000

input price = close;
input fastLength = 20;
input fastDisplace = 0;
input slowLength = 50;
input slowDisplace = 0;

plot Fast_HMA = MovingAverage(AverageType.HULL, price, fastLength)[-fastDisplace];
plot Slow_HMA = MovingAverage(AverageType.HULL, price, slowLength)[-slowDisplace];

Fast_HMA.DefineColor("Up", GetColor(1));
Fast_HMA.DefineColor("Down", GetColor(0));
Fast_HMA.AssignValueColor(if Fast_HMA > Fast_HMA[1] then Fast_HMA.Color("Up") else Fast_HMA.Color("Down"));

Slow_HMA.DefineColor("Up", GetColor(1));
Slow_HMA.DefineColor("Down", GetColor(0));
Slow_HMA.AssignValueColor(if Slow_HMA > Slow_HMA[1] then Slow_HMA.Color("Up") else Slow_HMA.Color("Down"));

plot BuySignal = if (Slow_HMA[1] <= Slow_HMA[2] and Slow_HMA > Slow_HMA[1]) then Slow_HMA else Double.NaN;
BuySignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
BuySignal.AssignValueColor(Color.GREEN);
BuySignal.SetLineWeight(3);

plot SellSignal = if (Slow_HMA[1] >= Slow_HMA[2] and Slow_HMA < Slow_HMA[1]) then Slow_HMA else Double.NaN;
SellSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
SellSignal.AssignValueColor(Color.RED);
SellSignal.SetLineWeight(3);

plot BuyExit = if (Fast_HMA[1] >= Fast_HMA[2] and Fast_HMA < Fast_HMA[1]) then Fast_HMA else Double.NaN;
BuyExit.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
BuyExit.AssignValueColor(Color.YELLOW);
BuyExit.SetLineWeight(3);

plot SellExit = if (Fast_HMA[1] <= Fast_HMA[2] and Fast_HMA > Fast_HMA[1]) then Fast_HMA else Double.NaN;
SellExit.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
SellExit.AssignValueColor(Color.YELLOW);
SellExit.SetLineWeight(3);

AddOrder(OrderType.BUY_TO_OPEN, BuySignal, open[-1], 100, Color.GREEN, Color.GREEN);
AddOrder(OrderType.SELL_TO_CLOSE, SellSignal, open[-1], 100, Color.RED, Color.RED);
AddOrder(OrderType.SELL_TO_OPEN, BuyExit, open[-1], 100, Color.YELLOW, Color.YELLOW);
AddOrder(OrderType.BUY_TO_CLOSE, SellExit, open[-1], 100, Color.YELLOW, Color.YELLOW);
 
Last edited:
  • Love
Reactions: IPA
@METAL I hope all is well. Where you able to complete this strategy ?
Could you share the latest working version? Did you get it auto-trade successfully?
Thanks in advance.
I had a few different renditions, however this is the one I use everyday. I use a 2m TF for entries and exits. I use 17 for fast HMA and 34 for slow HMA. Depending on how you trade, you may want to adjust the lengths. For instance, I have had great success using 5 for fast and 10 for slow when scalping SPX.
https://tos.mx/Uq8Sd31
 
I had a few different renditions, however this is the one I use everyday. I use a 2m TF for entries and exits. I use 17 for fast HMA and 34 for slow HMA. Depending on how you trade, you may want to adjust the lengths. For instance, I have had great success using 5 for fast and 10 for slow when scalping SPX.
https://tos.mx/Uq8Sd31
Many thanks for your quick reply and sharing strategy updates.
I shall wait till tomorrow to import the shared item (facing the same TOS issue that started upon migration).
Have you automated your strategy (I could not help to notice you have mentioned Macro Recorder in your previous posts) ? Thanks again.
 
Many thanks for your quick reply and sharing strategy updates.
I shall wait till tomorrow to import the shared item (facing the same TOS issue that started upon migration).
Have you automated your strategy (I could not help to notice you have mentioned Macro Recorder in your previous posts) ? Thanks again.
No. I trade manually.
 

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
508 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