Page 1 of 1

Add an alarm to any indicator

Posted: Fri Mar 12, 2010 3:18 pm
by noushina
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

Posted: Fri Mar 12, 2010 3:53 pm
by newschool
I approve this message.

Image