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).

What's wrong in my code.

thanks in advance.

 
fx_maddin:

Hi,

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

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

What's wrong in my code.

thanks in advance.

Are you passing ALL the extern variable in your iCustom call or just some of them ?

 

Yes, i pass all external variables:

Indicator contains only these 2:

//---- input parameters
extern int       depth=5;
extern int GrossPeriod=240;

...added screenshot in post

 
fx_maddin:

Yes, i pass all external variables:

Indicator contains only these 2:

...added screenshot in post

What value is held in the buffer when there is no dot ?
 
RaptorUK:
What value is held in the buffer when there is no dot ?

EMPTY_VALUE ?

https://docs.mql4.com/constants/special

EMPTY_VALUE0x7FFFFFFFDefault custom indicator empty value.
 
The indicator is repainting
 
RaptorUK:
What value is held in the buffer when there is no dot ?


If there is no dot, the value contains 0.00000000.

I think there is everytime a dot (Buy or Sell).

 
fx_maddin:


If there is no dot, the value contains 0.00000000.

I think there is everytime a dot (Buy or Sell).

OK, the Indicator code sets the buffer entry to 0.0 . .

   if (  iClose(NULL,0,i+1)<=zigzag1 )  ExtMapBuffer2[i]=zigzag1; else ExtMapBuffer2[i]=0.0;
   if (  iClose(NULL,0,i+1)>=zigzag1  )  ExtMapBuffer1[i]=zigzag1; else ExtMapBuffer1[i]=0.0;

Maybe you are having double comparison issues . . .

try changing these lines . . .

if (Lauer_BUY > 0.1) {   //  <--- change from 0 to 0.1


else if (Lauer_SELL > 0.1) {    //  <--- change from 0 to 0.1

and read this thread: Can price != price ?

 
RaptorUK:
There are 2 buffers . . . one for S one for R . . . when there is a red dot there is no blue dot and visa versa . . . so what is the value in the buffer when there is no dot ?

Ok, know what you mean :-)

If there is a red dot for SELL, then Lauer_BUY returns 0.00000000.

If there is a blue dot for BUY, then Lauer_SELL returns 0.00000000.

I loaded the indicator manuelly to the chart. The data windows shows nothing (instead of 0.00000000):

I have attached the indicator file...

Files:
 
RaptorUK:

OK, the Indicator code sets the buffer entry to 0.0 . .

Maybe you are having double comparison issues . . .

try changing these lines . . .

if (Lauer_BUY > 0.1) {   //  <--- change from 0 to 0.1


else if (Lauer_SELL > 0.1) {    //  <--- change from 0 to 0.1


still the same issue... :-(
 
deVries:
The indicator is repainting
What can I do with the information or how I need to change the code?
Reason: