Add an alarm to any indicator

Moderator: moderators

User avatar
noushina
rank: 50+ posts
rank: 50+ posts
Posts: 147
Joined: Fri Sep 25, 2009 10:50 pm
Reputation: 0
Location: Fukushima Japan
Gender: None specified

Add an alarm to any indicator

Postby noushina » Fri Mar 12, 2010 3:18 pm

reprint from TSD, but I could not find it on the cited page below. Hope it helps someone.
N
-------------------------------------------

http://www.forex-tsd.com/indicators-met ... al-69.html


I see a lot of people here asking to add alarm when an indicator is light up. Especially when a arrow/bullet is turn on.

Actually, it is very simple task. All you have to do is follow the following instructions.

1) Every indicator has an indicator array that keep the values of the indicator. Values can be 0 or not 0. To find out the indicator name look for the command: SetIndexBuffer
In the indicator editor it should look like this

SetIndexBuffer(0,ExtMapBuffer);
SetIndexBuffer(1,ExtMapBuffer2);

This lines tell us that we have 2 indicator buffers

2) Look when the indicator buffer change its value.
In the example above we will look to line that contains the following patter:
ExtMapBuffer[number] = where number can be a figure or a name. For example: if(res!=0.0) ExtMapBuffer[shift]=res;
if after the equal sign there is 0 do nothing.

3) Change it to make an alarm.
After finding the value setting line we will add an alarm to it.
a) add { before the setting. In the example above :
if(res!=0.0) {ExtMapBuffer[shift]=res;
b) add the Alert command after the ;. In the example above:
if(res!=0.0) { ExtMapBuffer[shift]=res;
Alert("Indicator set");
}
Do not forget to close the }


4) repeat for every buffer value setting


Compile and you have an indicator with alert

Hope it will help you

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
newschool
rank: 150+ posts
rank: 150+ posts
Posts: 489
Joined: Fri Aug 21, 2009 2:26 am
Reputation: 1
Gender: Male

Postby newschool » Fri Mar 12, 2010 3:53 pm

I approve this message.

Image


Return to “MetaTrader”