ZigZag Call from another indicator

 

Hi,

I want to use and draw in my indicator the ZigZag indicator.

I defined is as the following code shows:


init()
{
   IndicatorBuffers(1);
   
   SetIndexBuffer(0,TF1_Buffer);
   SetIndexStyle(0,DRAW_SECTION);
}

int start()
{
   int    counted_bars=IndicatorCounted();
//----
   int    limit=Bars-counted_bars;
      for(int i=limit;i>=0;i--)
          TF1_Buffer[i] = iCustom(NULL, TF1_Timeframe, "ZigZag",TF1_ExtDepth,TF1_ExtDeviation,TF1_ExtBackstep,0,iTF1);
}

But I get only this:

What did I wrong?

 
If the value you get back from the iCustom call is 0 don't use it . . .
 

Oh, of course, it worked!!

Lot's of thanks!!

Another question:

If I want to write a label in the chart, how can I define the actual window from the indicator:

ObjectCreate("M1", OBJ_LABEL, ???, 0, 0);

 
sunshineh:

Another question:

If I want to write a label in the chart, how can I define the actual window from the indicator:

ObjectCreate("M1", OBJ_LABEL, ???, 0, 0);

0 is the main window . . . you can find the window number that you have an indicator placed on by using this: WindowFind()
Reason: