Problems reading DT-ZigZag-Lauer with iCustom

 

Hi,

i try to write an EA and get the values from DT-ZigZag-Lauer indicator with following code:

int depth = 5;

int GrossPeriod = 240;

double Lauer_BUY = iCustom(NULL,0,'DT-ZigZag-Lauer',depth,GrossPeriod,0,1);

double Lauer_SELL = iCustom(NULL,0,'DT-ZigZag-Lauer',depth,GrossPeriod,1,1);

if (Lauer_BUY > 0) {

LauerSignal = 'BUY';

ObjectCreate('LBUY_'+Bars, OBJ_ARROW, 0, Time[1], Lauer_BUY + 35 * Point);

ObjectSet('LBUY_'+Bars, OBJPROP_ARROWCODE, SYMBOL_ARROWUP);

ObjectSet('LBUY_'+Bars, OBJPROP_COLOR, Blue);

}

else if (Lauer_SELL > 0) {

GPLauerSignal = 'SELL';

ObjectCreate('LSELL_'+Bars, OBJ_ARROW, 0, Time[1], Lauer_SELL - 35 * Point);

ObjectSet('LSELL_'+Bars, OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet('LSELL_'+Bars, OBJPROP_COLOR, Red);

}

But my arrows differ from the arrows (dots) of the EA (See Screenshot Lauer.png).

What's wrong in my code.

thanks in advance.

Files:
lauer.png  7 kb
 

DT-ZigZag-Lauer is a ZigZag indicator which means that it will change signals (repaint, recalculate, ...) at some situations. Your EA is checking just a first clossed bar and that way it is "recording" the changes of the state of the DT indicator too. It is the most probable cause why you have different arrows for DT_ZigZag-Lauer indicator (especially with the default 4 hour time frame setting for it and if your EA is not on 4 hour time frame chart) : the indicator simply repainted in the mean time and your EA did not

fx_maddin:
Hi,

i try to write an EA and get the values from DT-ZigZag-Lauer indicator with following code:

int depth = 5;

int GrossPeriod = 240;

double Lauer_BUY = iCustom(NULL,0,'DT-ZigZag-Lauer',depth,GrossPeriod,0,1);

double Lauer_SELL = iCustom(NULL,0,'DT-ZigZag-Lauer',depth,GrossPeriod,1,1);

if (Lauer_BUY > 0) {

LauerSignal = 'BUY';

ObjectCreate('LBUY_'+Bars, OBJ_ARROW, 0, Time[1], Lauer_BUY + 35 * Point);

ObjectSet('LBUY_'+Bars, OBJPROP_ARROWCODE, SYMBOL_ARROWUP);

ObjectSet('LBUY_'+Bars, OBJPROP_COLOR, Blue);

}

else if (Lauer_SELL > 0) {

GPLauerSignal = 'SELL';

ObjectCreate('LSELL_'+Bars, OBJ_ARROW, 0, Time[1], Lauer_SELL - 35 * Point);

ObjectSet('LSELL_'+Bars, OBJPROP_ARROWCODE, SYMBOL_ARROWDOWN);

ObjectSet('LSELL_'+Bars, OBJPROP_COLOR, Red);

}

But my arrows differ from the arrows (dots) of the EA (See Screenshot Lauer.png).

What's wrong in my code.

thanks in advance.