Draw a custom chart with my own data

 

Hello,

I can draw a chart in the indicator window with this code:

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red

double Buff[], myData[10000];

int init() {   
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red);
   SetIndexBuffer(0,Buff);
   return(0);
}

int start() {      
   for(int i=100; i>=0; i--){
      Buff[i] = iClose("EURUSD",Period(),i);
   }
   return(0);
}


I can use iHigh, iLow, iClose etc. to generate data,
but when I try to use my own data - it fails.

To be as simple as possible this example code should produce a straight line,
but the screen is empty,
what I'm doing wrong?..

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red

double Buff[], myData[10000];

int init() {   
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red);
   SetIndexBuffer(0,Buff);

   ArrayInitialize(myData, 1.3324);

   return(0);
}

int start() {      
   for(int i=100; i>=0; i--){
      Buff[i] = myData[i];
   }
   return(0);
}
 

The separate window auto scales unless you set a scale . . . you most likely do have a line drawn but you can't see it . .

Try adding the following to prove the point . . .

ArrayInitialize(myData, 1.3324);

// add the following 2 lines

myData[1] = 1.5;
myData[2] = 1.1;
 

Thank you,
you are completely right

Reason: