View Single Post
  #5 (permalink)  
Old 05-17-2007, 07:30 PM
Flirrrt Flirrrt is offline
Junior Member
 
Join Date: Dec 2006
Posts: 13
Flirrrt is on a distinguished road
m is set to 0, i want the current "action".

My complete code is:
Code:
//+------------------------------------------------------------------+
//|                                                         test.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property  copyright ""
#property  link      ""

//---- indicator settings

#property  indicator_separate_window

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   return(0);
  }
  
//+------------------------------------------------------------------+

int start()
  {
   int m=0;
//---- done

   string tab = "";
   
   int f = FileOpen(Symbol()+Period()+".csv", FILE_CSV | FILE_WRITE,',');
   FileWrite(f,"Date","Open","High","Low","Close","Volume");
   
         Print(tab, TimeToStr(iTime(NULL,0,m), TIME_DATE) ,iOpen(NULL,0,m),  iHigh(NULL,0,m), 
            iLow(NULL,0,m) ,iClose(NULL,0,m) ,iVolume(NULL,0,m));
         string sDate = TimeToStr(iTime(NULL,0,m),TIME_DATE);
         sDate = StringSetChar(sDate,4,'/');
         sDate = StringSetChar(sDate,7,'/');
         FileWrite(f,sDate, TimeToStr(iTime(NULL,0,m),TIME_MINUTES),iOpen(NULL,0,m),  iHigh(NULL,0,m), 
            iLow(NULL,0,m), iClose(NULL,0,m), iVolume(NULL,0,m));
            
      
   
   
   FileClose(f);
   
   return(0);
  }
//+------------------------------------------------------------------+
By this i get an csv-file with the first line od Date, Open, high etc.. and a second line with the values. But this is only written once, when I attach the indicator to the chart. I want it to write to the file at every new tick being made...

Ideas?
Reply With Quote