How to capture event from Indicatior with EA

 

Please excuse me for what maybe a very simple question, but i am just a beginner and came to GURUS of the MT4 for help.


I have an indicator that send out an alert ( message box ), How would i capture this alert from EA?

I know how to place an order through EA, I just dint know how to capture that trigger ( Indicator alert )


I have access to indicator code, so maybe there is something i have to do in the indicator to instead of sending an alert ( message box ) set some global variable that will be caught by the EA at the later time ?

Can a global variable be global not only for EA but for the whole MT4 ?


I think i have to use icustom function from EA to call indicator, but what variables from indicator are passed into iCustom ?

Thank you for any help that you can give me.

 

does the indicator plot the signals into the chart? arrows?

If this is the case then it is meant to be used through your EA calling the iCustom function. No need to change the indicator.

 

iCustom() returns the value of any of the 8 (possible) indicator buffer values for a specified bar on the chart.

iCustom() takes as input ALL of the variables that can be set externally in the indicator -- see the Inputs Tab -- when you add an indicator to a chart.

There is no built-in method to detect an alert message box.

 

olegkha:

what variables from indicator are passed into iCustom ?

Open the "data window" while the indicator is attached to a chart and move the mouse around on the chart. The data window will list all buffers of the indicator and their values, so you can determine which buffer is of interest to you. Counting of buffer numbers starts from 0 (0 is the first buffer in the list, the next one would be 1 and so on).


The second last parameter in your iCustom() call must be this buffer number. It can range from 0 to 7.

The last parameter is the bar number (0 is current, 1 previous bar, and so on) just like in the built in indicators. To detect an arrow in an arrow buffer you compare the value against EMPTY_VALUE, if it is not EMPTY_VALUE then there is an arrow.

 

Thanks !!!!!!!

This is what i need.


One more question, where would that Arrow buffer be ?

 
olegkha:

One more question, where would that Arrow buffer be ?

It would be one or more of the buffers you see in the data window. What type a buffer is (arrow, line, histogram) is set by the indicator itself but it does not matter for this problem, to the outside world each buffer simply appears as an array containing one number per bar.

The arrow buffer you are looking for would typically contain no value (EMPTY_VALUE) for most of the bars and only where an arrow appears it contains the price where MT4 will plot the arrow into the chart. Move the mouse over the chart to where such an arrow is and observe which buffer has a value there and is empty for all other bars. This will be the buffer containing your signal. It will most likely be two buffers: one containing all buy signals and another one containing all sell signals.

Reason: