NexusFi: Find Your Edge


Home Menu

 





Alerts based on Hull Moving Avg direction


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one eddieo with 3 posts (0 thanks)
    2. looks_two rmejia with 2 posts (5 thanks)
    3. looks_3 drewtrade with 1 posts (0 thanks)
    4. looks_4 arye with 1 posts (0 thanks)
    1. trending_up 10,037 views
    2. thumb_up 5 thanks given
    3. group 5 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
eddieo
New York, NY
 
Posts: 4 since Feb 2015
Thanks Given: 1
Thanks Received: 0

Hi,
I'm interested in triggering an alert in T.O.S. when the Hull Moving Average direction switches from Up to Down or vice versa.

The standard tools within Alerts allow you to trigger based on values being met or crossed, but not on the direction of the average.

Is anyone aware of how to set this up using Thinkscript or any other means?

Thanks,

EddieO


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The Backwardation Signal: How the CL Futures Curve Tells …
Commodities
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
Prediction Markets Expiry Day: Trump Eyes War Exit, $230 …
Prediction Markets & Event Contracts
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
eddieo
New York, NY
 
Posts: 4 since Feb 2015
Thanks Given: 1
Thanks Received: 0

If anyone has ideas, would be much appreciated!


Reply With Quote
  #3 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441



eddieo View Post
If anyone has ideas, would be much appreciated!

 
Code
    
    #Hull Moving Average

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

plot HMA = MovingAverage(AverageType.HULL, price, length)[-displace];

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


    #Alert
Alert(HMA > HMA[1] and HMA[1] < HMA[2], "Up", Alert.BAR, Sound.Bell);
Alert(HMA < HMA[1] and HMA[1] > HMA[2], "Down", Alert.BAR, Sound.Bell);


Reply With Quote
  #4 (permalink)
eddieo
New York, NY
 
Posts: 4 since Feb 2015
Thanks Given: 1
Thanks Received: 0

Thank you rmejia! This is fantastic.


Reply With Quote
  #5 (permalink)
drewtrade
Sioux Falls
 
Posts: 1 since Jan 2016
Thanks Given: 0
Thanks Received: 0

Hello, thanks for this, its exactly what I'm looking for as well (if I could just get it working haha). So I've created the study and added the thinkscript, however, it doesnt seem to be working....I purely copied and pasted the code....what should the "trigger if" condition be? I'm thinking that's where my problem may lie, but still not sure. Any help getting this working would be much appreciated. Thanks!


Reply With Quote
  #6 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

The trigger is a change in direction for the hull line. When it changes from up to down (color change) a sound and notification should trigger in thinkorswim.


Reply With Quote
  #7 (permalink)
Patrickology
Tilburg
 
Posts: 2 since Oct 2017
Thanks Given: 0
Thanks Received: 0

Hi, this indicator is just what I needed!

Sorry for digging up an older post but I would like to ask for an addition.

Is it possible to add code so that there is a visual on change of direction?

Like an arrow or dot underneath or above the change of direction.

Thanks in advance!

Regards,

Patrick


Reply With Quote
  #8 (permalink)
 aehartle 
Adrian
 
Experience: Master
Platform: TOS and Ninjatrader
Trading: SPY
Posts: 15 since Aug 2015
Thanks Given: 0
Thanks Received: 8

How can I set up a scan to scan stocks that have just crossed over on a daily time period?


Reply With Quote
  #9 (permalink)
arye
fort smith
 
Posts: 1 since Feb 2019
Thanks Given: 0
Thanks Received: 0


rmejia View Post
The trigger is a change in direction for the hull line. When it changes from up to down (color change) a sound and notification should trigger in thinkorswim.


Thank you for this code. I have the same problem though on the trigger. I clicked on study alert and then copied the code in scripteditor but right beneath that is a section that says "trigger if:" and a drop down box for at, below, above, etc for a specific price. There is no way that I can see to eliminate this requirement so every time I set the alert it essentially becomes a price alert. What am I missing? thank you so much for your help.


Reply With Quote




Last Updated on August 21, 2019


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts