Download MetaTrader 5

Indicators: Trendline Price Alert

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
182378
MetaQuotes Software Corp. 2011.06.17 10:00 

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

Preet Kanwaljit Singh
43
Preet Kanwaljit Singh 2011.06.22 11:48  

how does the indicator define how the trendlines are made?

Ron
11
Ron 2011.06.23 10:30  
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.
MQL4 Comments
16319
MQL4 Comments 2011.06.25 07:55  

moose

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

Ron
11
Ron 2011.06.26 21:35  
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.

BernardWG
146
BernardWG 2011.07.18 10:50  

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

BernardWG
146
BernardWG 2011.07.18 12:43  

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

Ron
11
Ron 2011.07.19 00:40  
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.


Ron
11
Ron 2011.08.01 08:08  

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
Johannes Jilles van Duijn
773
Johannes Jilles van Duijn 2011.12.05 20:17  
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

Johannes Jilles van Duijn
773
Johannes Jilles van Duijn 2011.12.15 10:43  

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
12
To add comments, please log in or register