Add percent limit to Alert High Low indicator


Category:
0
0

Hey Hahn,

I have been using your high low alert indicator to find entry points in ETFs. Great Job and I find it very useful.

To reduce the noise of multiple alerts, I wanted to know if we can add an additional layer of filter in this tool to only send alerts if the LOW is atleast 1% lower than the todays highs ?

Let me know your thoughts. Thanks alot in advance.

Kind regards,

VIN MD

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 10, 2022 3:58 am
90 views
0
Private answer

I updated the title of your question to include the full context of your request. This enables other viewers searching for a similar solution to locate this post using the search function. I also moved this out of the "Alerts and Notifications" topic and into the "Chart Studies" topic because the code you referenced is actually a chart study which includes built-in alerts.

Whenever you reference a resource you must be sure to include a link to that resource. In this case, there are two different videos you might be talking about. Since you did not include a link or the exact title of the video or name of the study.... Viewers will not be able to follow along and understand this request. (this forum is all about serving our entire audience)

The original version of this study was published here:

https://www.hahn-tech.com/thinkorswim-alert-high-low/

Version two, was published here:

https://www.hahn-tech.com/thinkorswim-alert-high-low-version-two/

I see that you want to modify the alert portion of the code. Which means we only need to modify the last two lines of code from the original. And fortunately, both of these studies use the same exact lines of code for the alerts. Here is how they currently exist:

Alert(DailyHigh > DailyHigh[1] and hideChartBubbles, "New High", Alert.BAR, Sound.RING);
Alert(DailyLow < DailyLow[1] and hideChartBubbles, "New Low", Alert.BAR, Sound.RING);

To solve your request we only need to modify the last one. You requested that you do not want an alert to be triggered unless the low for that potential alert is more than 1% below the current trading session highs.

First lets see what the formula looks like to compute the current percent difference between the daily high and daily low:

100 * (DailyLow / DailyHigh - 1)

The values from that formula will be negative, reflecting the fact that the low is a lower value than the high. So we just need to insert this as a new condition for the alert on new low, and add a comparison to check if that value is less than or equal to minus 1.0, as follows:

Alert(100 * (DailyLow / DailyHigh - 1) <= -1.0 and DailyLow < DailyLow[1] and hideChartBubbles, "New Low", Alert.BAR, Sound.RING);

This only impacts the alerts and has no affect on the chart bubbles that display on the chart. This is as far as I can go in providing this solution as I have already exceeded the 15 min limit I allocate to each free solution I provide in this forum.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 10, 2022 8:26 am