Download MetaTrader 5
To add comments, please log in or register
Are you a good trader? Become a signals provider and make even more money!
Mimi
499
Mimi 2016.07.27 04:43 

Hi I have following code

int init()
{
 
  //---- indicators
   SetIndexBuffer(0,M1);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,clrBlue);
   
return(0);
}
//--------------------------------------------------------inside the start function--------------//
int counter = 0;
while(FileIsEnding(Handle)==false)  // While the file pointer..
     {                                 // ..is not at the end of the file

      //--------------------------------------------------------- 5 --
      Str_DtTm =FileReadString(Handle);// Date and time of the event (date)
      D1     =FileReadString(Handle); 
      D2     =FileReadString(Handle); 
      D3     =FileReadString(Handle); 
      
      counter++;
      
      if(FileIsEnding(Handle)==true)   // File pointer is at the end
         break;                        // Exit reading and drawing
      //--------------------------------------------------------- 6 --
      Dat_DtTm =StrToTime(Str_DtTm);   // Transformation of data type
           
      DD1 = floor(StrToDouble(D1)); 
      DD2 = floor(StrToDouble(D2)); 
      DD3 = floor(StrToDouble(D3)); 

      L1 = *Calculation*;
      M1[counter] = L1;

}
 

Above code is plotting the data with indicator buffer but its starting from wrong place. I know i didn't added SetIndexDrawBegin. But How can i initiate that before reading the csv file? 

With Csv file Dat_DtTm is the variable where the start of the index draw begins.  Its stores the start date of csv file. I need indicator buffer get plotted from that time. 

I tried using ibarshit with Dat_DtTm & SetindexdrawBegin inside start function & but if got failed. Any idea?

Thank you in advance. 

whroeder1
13630
whroeder1 2016.07.27 13:00  
Ignore SetIndexDrawBegin, just start drawing at the correct bar, not before.
Mimi
499
Mimi 2016.07.28 08:48  
WHRoeder:
Ignore SetIndexDrawBegin, just start drawing at the correct bar, not before.

How can I do that?

int tt = iBarShift(Symbol(),0,Dat_DtTm);
M1[counter] = L1;

Where I can put this tt for drawing at the correct bar? Need little syntax help here.

whroeder1
13630
whroeder1 2016.07.28 16:01  
   int tt = iBarShift(Symbol(),0,Dat_DtTm);
// M1[counter] = L1;
   M1[tt] = L1;
Was that so hard? When in doubt, think.
Mimi
499
Mimi 2016.08.01 10:34  
WHRoeder:
Was that so hard? When in doubt, think.

Thank you...:) 
/
To add comments, please log in or register