Exponential Hull Moving Average (EHMA) for ThinkorSwim

skynetgen

Well-known member
There was a study somewhere which said that exponential hull ma is best. Here is EHMA for TOS, converted from tradingview.

Code:
#skynetgen
#exponential hull ma. from #https://www.tradingview.com/script/FOcqi6Ud-Exponential-Hull-Moving-Average-EHMA/
declare upper;
input length =13;
input price = close;

script ehma{
    input price=close; input length=13;
    #HMA = WMA(2*WMA(n/2) − WMA(n)),sqrt(n))
    #EHMA = EMA(2*EMA(n/2) − EMA(n)),sqrt(n))
    plot ehma =
     expaverage((2 * expaverage(price, length / 2))-expaverage(price, length / 2),
                round(sqrt(length)));
};

plot MVA =ehma(price,length);

MVA.DefineColor( "up", Color.UPTICK );
MVA.DefineColor( "dn", Color.DOWNTICK );
MVA.DefineColor( "def", Color.PLUM );

MVA.AssignValueColor(
    if MVA > MVA[1] then MVA.Color( "up" )
    else if MVA < MVA[1] then MVA.Color( "dn" )
    else MVA.Color( "def" ) );

https://tos.mx/Z7psKFb

p.s. Dont see anything special about it. yet Another MA.
 
Last edited by a moderator:
Hmmm I tried to write an EHMA just from the formula. Seems it is different. Need to look at it closer, then will have more info.
 
2019-10-15-TOS-CHARTS.png


Slight difference. Your method orange/green. My method red/green. Made it after reading th same article
 
Could be rounding up the values. Could be I did it incorrectely. 🤪

Code:
# Exponential Hull Moving Avg by Horserider


input price = close;
input length = 100;
input displace = 0;

 
def halflength = Ceil(length / 2);
def sqrtlength = Ceil(Sqrt(length));
def val = 2 * ExpAverage(price, halflength) - ExpAverage(price, length);

plot HMA = ExpAverage(val, sqrtlength)[-displace];

HMA.SetLineWeight(2);
HMA.DefineColor("UP", Color.GREEN);
HMA.DefineColor("DOWN", Color.RED);

HMA.AssignValueColor(if HMA > HMA[1] then HMA.Color("Up") else HMA.Color("Down"));
 
These two versions both give later signals than the regular Hull MA.
Sometimes its not about late, but about less false signals. but overall I dont really see point to use it over regular HMA, considering its already built-in into TOS and supported by default
 
Sometimes its not about late, but about less false signals. but overall I dont really see point to use it over regular HMA, considering its already built-in into TOS and supported by default
In the limited research I did, the late signals would have kept me out of the trade. I agree though that there is no point not to just use the TOS HMA.
 

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