Is there a way to have a Hull Moving Average that alerts on the change in color, alert via text?


0
0

Hi Mr. Hahn,

Below is a code for a Hull MA that alerts with a bell sound when the color of the HMA changes.

#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);

Is there a way to have this alert notify via text or e-mail in the TOS platform

 

Marked as spam
Posted by (Questions: 2, Answers: 3)
Asked on March 16, 2017 7:47 pm
2307 views
0

We have two ways we can apply custom studies to produce email/text notifications. One is use the Study Alert, where you apply the condition to individual ticker symbols that you want to track. The other is using a custom Scan, where you can apply the condition to a group of ticker symbols, such as an index or a watchlist. Let me know which you prefer and I will tailor my response to the one you select.

( at March 16, 2017 9:47 pm)
0

If you could help me with the Study Alert, that would be great!

( at March 16, 2017 10:49 pm)
0

Please add new questions as comments and not new answers. In order to add a description to the alert you would need to use this code to create a scan and they build a dynamic alert from that saved scan.

( at February 28, 2018 2:55 pm)
1
Private answer

Ok, I have included the code below. I should mention the alerts in your version check if at least two consecutive bars of the Hull moving average are in the same direction. Once there are two bars in the same direction, those alerts will continue to trigger repeatedly for each bar where the Hull moving average is the same color. This does not match your description of the behavior you want. You asked for a notification whenever the color changes. So I sort of blended the two behaviors. In this code, the notification triggers only once when the color changes, but waits for the second bar of that color change to form. I have attached a screenshot of the Study Alert screen so you can view the signals that are produced.

Please don’t forget to up-vote any question that best solves your question!

#
# TD Ameritrade IP Company, Inc. (c) 2008-2017
#
input price = close;
input length = 20;
input displace = 0;
def HMA = MovingAverage(AverageType.HULL, price, length)[-displace];
def hmaAscending = HMA > HMA[1] and HMA[1] > HMA[2];
def hmaDescending = HMA < HMA[1] and HMA[1] < HMA[2];
plot trigger = (hmaAscending and !hmaAscending[1]) or (hmaDescending and !hmaDescending[1]);

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on March 17, 2017 7:32 am
0
I would like to see that the email / text alert coming to me says “Short Alert” Or “Long Alert”: can that be added to it? ANSWER: In order to add a description to the notification you will need to build a scan using this code. Save and name the scan whatever label you want to see. Then build a dynamic alert from that saved scan. In order to have the alert stay on do you have to set up “Set Alert Rules” as well? so that the alert stays on ongoing? Do you make changes to “Trigger if: … or leave it as .00 I see that in order for the alert to stay on, I must set the Set Alert Rules and select “Recreate Alert for reverse crossover” then I can see the alert stays active. Otherwise, it disappears once it is triggered once. ANSWER: Yes that is correct.
( at March 1, 2018 6:09 am)
0

For some reason, I can see the Alerts on the wizard graph, but they do not trigger even though the average has changed color. I am continuing to review to see if I can make it work.

( at March 1, 2018 7:49 am)
0

Hi Pete. I have set up several alerts some just crossovers using the wizard and some with the code above. The crossovers do trigger but the alerts with the code above do not trigger. Not sure why. Would you be up to doing a screen sharing session today and see if we can figure out what is the issue?

( at March 2, 2018 9:30 am)
0

That is a service we provide, yes. But probably need to schedule something next week. The minimum is 2 hours, billed at $50 USD per hour. You can get all the details here: https://www.hahn-tech.com/about/

If you want to initiate things just fill out the contact form at the bottom of that web page.

But before you do that, check out the screenshot I just added as a new answer on this topic.

( at March 2, 2018 9:37 am)
0

Thank you for your prompt reply. Let me review the screenshot and test on my side. Regards.

( at March 2, 2018 11:12 am)
1
Private answer

When setting up a Study Alert, be sure to check your settings. If your code outputs a True/False result, you must set the “Trigger if:” to True. Failing to adjust this, will result in zero alerts. See attached screenshot for details.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on March 2, 2018 9:40 am
0
Private answer

Thank you for the update fixing the code misspelling.

In order to have the alert stay on do you have to set up “Set Alert Rules” as well?  so that the alert stays on ongoing?

Do you make changes to “Trigger if: … or leave it as .00

Marked as spam
Posted by (Questions: 1, Answers: 9)
Answered on February 28, 2018 1:50 pm
0

by the way, nick fernandez is my friend. he made sent you the original message

( at February 28, 2018 1:51 pm)
0
Private answer

I would like to see that the email / text alert coming to me says “Short Alert” Or “Long Alert”:

can that be added to it?

Marked as spam
Posted by (Questions: 1, Answers: 9)
Answered on February 28, 2018 1:56 pm
0

Please add new questions as comments to the original answer of the post. In order to add a description to the notification you will need to build a scan using this code. Save and name the scan whatever label you want to see. Then build a dynamic alert from that saved scan.

( at February 28, 2018 2:57 pm)
0
Private answer

I see that in order for the alert to stay on, I must set the Set Alert Rules and select “Recreate Alert for reverse crossover”  then I can see the alert stays active.  Otherwise, it disappears once it is triggered once.

 

Marked as spam
Posted by (Questions: 1, Answers: 9)
Answered on February 28, 2018 1:58 pm
0

Yes that is correct.

( at February 28, 2018 2:52 pm)