How EA can get Indicators data ?

Charly Oudy  


Let me explain. I have one indicator, who draws objets and make the calculations for the trade. All the datas are ready in some global variables.

In my EA, the first thing I do is to open the indicator, like that :

handle_indicator = iCustom(_Symbol, _Period, "Examples\\RSI_Divergence");
ChartIndicatorAdd(NULL, 1, handle_indicator);

Then I was thinking of storing the indicators values in an official buffer :

// In the Indicator, I added a buffer

// then I put my data inside
dataForEA[0] = PeaksTabPrix[0].niveau;
dataForEA[1] = PeaksTabPrix[1].niveau;

Then, In the EA, I try to get those datas :

// I try to get the buffer in the EA
double buf[];
CopyBuffer(handle_indicator, 3, 0, 3, buf);             

But the data I receive are not the one I want, it seems I just get the prices...

What am I doing wrong ? And can I do something else ?