Indicators: Trendline Price Alert

 

Trendline Price Alert:

This indicator will trigger an audio/visual alert when the symbol mid-price crosses one of two trendlines placed on the chart.

Author: Ron

 

how does the indicator define how the trendlines are made?

 
junglelion:

how does the indicator define how the trendlines are made?


Hi, the trendlines are initially placed on the chart at 20% from top and 20% from bottom of the chart range. This is initial placement only; the user must then reposition them to the angle / level at which they wish to be alerted.
 

moose

very very good work but if you can make the indi automatically draw diagonal lines as shown in your picture would be perfect

 
forexichi:

moose

very very good work but if you can make the indi automatically draw diagonal lines as shown in your picture would be perfect


Hi, I'll see what I can come up with. It's quite a challenge because to a trader, a particular trend may be "obvious" (as in the picture above), whereas to a piece of software, it is not. Also one trader may be interested in a certain price level where another trader may not. So you see it is quite subjective. This is why with this indicator, the onus is on the trader to place the alert lines at the particular levels/angles in which they are interested. Anyway, I'll try out some algorithms and post back if I come up with anything viable!

Regards,

Moose.

 

Hi, this is exactly what I am looking for, although I would like to know if these trendlines are also to be used as horizontal trend line alerts ? So, in other words, you just use the existing horizontal line function in MT4 and move the lines to the respective levels, and while hit, the alert sound and window will come up with reference to the respective currency pair chart ? Thanks.

Bernard

 

Hi Moose,

Again the indicator is perfect, with the exception of one issue, that if possible I would like to ask you to adjust in the code. I have personally no clue ... I select the two lines when they pop up in the window, and make them through Trend Line properties one inch thicker. And under parameters I DESELECT "Ray" because I prefer to have them only horizontal and drawn over the total chart . However, then when the market moves forward the line will not follow it seems to the right, probably because the Ray selection was deselected. However, I prefer a horizontal line over the total chart. Can you let me know what adjustments have to be made in the coding to do that ?

Thanks

Bernard

 
BernardWG:

Hi Moose,

Again the indicator is perfect, with the exception of one issue, that if possible I would like to ask you to adjust in the code. I have personally no clue ... I select the two lines when they pop up in the window, and make them through Trend Line properties one inch thicker. And under parameters I DESELECT "Ray" because I prefer to have them only horizontal and drawn over the total chart . However, then when the market moves forward the line will not follow it seems to the right, probably because the Ray selection was deselected. However, I prefer a horizontal line over the total chart. Can you let me know what adjustments have to be made in the coding to do that ?

Thanks

Bernard

Hello Bernard, please see the private message I sent you. You actually answered your own question; you need to create an object of type OBJ_HLINE instead of OBJ_TREND.

Change this line of code: ObjectCreate(name, OBJ_TREND, 0, T1, P1, T2, P2);

To this: ObjectCreate(name, OBJ_HLINE, 0, T1, P1);

Regards,

Moose.


 

Update Version 1.2

Thanks to all who have posted or contacted me with constructive ideas and suggestions regarding this indicator. Some ideas were a bit beyond the basic functionality of this indicator. Nevertheless, I have uploaded a revised version of this indicator (ver. 1.2) which includes some of the requested features.
The idea behind this indicator was to keep things simple - like me, as I like simple things! Concerning the initial placement of the upper and lower trendlines; there are many different algorithms to choose from and frankly I could not pick any particular one over any other. So the initial placement will remain as now, one near the top of the current window and one near the bottom. After which, it is up to the user to move them to a more appropriate position. I have done some searching on other forums. If you google "MT4 trend line indicators" you will find some quite elaborate trend line indicators on forexfactory.com. Take a look if you're interested. :)

Features new to version 1.2

Added mode flag to get only a single hi/lo alert per time bar (rather than repeated alerts)
Added email flag to send email as well as audio alert (you must first configure the email settings on the MT4 terminal)
Added flag to select line type (trendline or horizontal line)
Added setting for line width
Added TidyOnExit flag to remove line objects when indicator is destroyed. (Set this false if you want to preserve the trendlines)

Thanks to the guys who helped with the testing (you know who you are).
Finally, if you haven't already seen it, check out the youtube video https://www.youtube.com/watch?v=Z58NKX3Saqs

Regards,
MOOSE
 
MOOSE:
junglelion:

how does the indicator define how the trendlines are made?


Hi, the trendlines are initially placed on the chart at 20% from top and 20% from bottom of the chart range. This is initial placement only; the user must then reposition them to the angle / level at which they wish to be alerted.

hello,

very nice indicator is it possible that if i placed the two horizontal lines it stays in place when i change timeframe, now the lines are moving to another level

 

hello,

very nice indicator is it possible that if i placed the two horizontal lines it stays in place when i change timeframe, now the lines are moving to another level
Reason: