♥ 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
|
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!
Marked as spam
|
|||||||||||
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. Marked as spam
|
|||||||||||
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
|
|||||||||||
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
|
|||||||||||
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
|
Please log in to post questions.
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.
If you could help me with the Study Alert, that would be great!
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.