Help needed: How can I get values from this indicator? (SOLVED)

To add comments, please log in or register
[Deleted]  

Hi!

I saw this indicator(ZIGZAG on fractals, without redrawing the values - https://www.mql5.com/en/code/10022) and I would like to get the last 2 values for an EA.

The solution that I found only return one value for both cases (2147483647) using iCustom.

int n, i;
double zag, zig;
i=0;
while(n<2)
   {
      if(zig>0) zag=zig;
      zig=iCustom(NULL, 0, "ZigzagFr_v1", Fractal, 0, i);
      if(zig>0) n+=1;
      i++;
   }
Print("zag: ", zag," zig: ",zig);
Any help?
onewithzachy
1863
onewithzachy  
blap:

Hi!

I saw this indicator(ZIGZAG on fractals, without redrawing the values - https://www.mql5.com/en/code/10022) and I would like to get the last 2 values for an EA.

The solution that I found only return one value for both cases (2147483647) using iCustom.

Any help?

Hi blap,

2147483647 is EMPTY_VALUE. So if not EMPTY_VALUE do the stuff.

:D

[Deleted]  
onewithzachy:

Hi blap,

2147483647 is EMPTY_VALUE. So if not EMPTY_VALUE do the stuff.

:D


Hi!

Thanks for fast reply!

But the problem is that I only receive EMPTY_VALUE from iCustom().

I tested the same code with adaptations in the "zigzag" indicator that comes with MT4 and works ok, but in the "ZIGZAG on fractals" I only get EMPTY_VALUE...

I do not know what is wrong...

onewithzachy
1863
onewithzachy  

Hi blap,

Try this first perhaps

extern int Fractal=10;
int start()
  {
  
  int bar = 0, zag_bar;
  double zag, zig;

  while(true)
    {
     zig=iCustom(NULL, 0, "ZigzagFr_v1", Fractal, 0, bar);
     if (zag != 0 && zig != EMPTY_VALUE) break;
     if(zig != EMPTY_VALUE && zag == 0) {zag = zig; zag_bar = bar;}
     bar++;
    }
    
  Print("Found zag: ", zag," on bar # ", zag_bar,". and zig: ",zig," on bar # ", bar);
 
  return (0);
  }

:D

Simon Gniadkowski
17299
Simon Gniadkowski  
blap:

I do not know what is wrong...

Did you run it on a Demo account or in the Strategy Tester ?
[Deleted]  
onewithzachy:

Hi blap,

Try this first perhaps

:D


It is alive and works beautiful!

Thank you!

:D

[Deleted]  
RaptorUK:
Did you run it on a Demo account or in the Strategy Tester ?

In the Strategy Tester.
To add comments, please log in or register