WriteDataSeries





//+------------------------------------------------------------------+
//|                                              WriteDataSeries.mq4 |
//|                                                     Ibrahim Noor |
//|                           http://winning-solution.com/?id=baim78 |
//+------------------------------------------------------------------+
#property copyright "Ibrahim Noor"
#property link      "http://winning-solution.com/?id=baim78"

extern int    Fast=12;
extern int    Slow=26;
extern int    Signal=9;

int handle;
string report_name;

/*
Put it on metatrader 4\experts\ folder
This EA just to write data series of prices for further analysis.
Run in with Strategy Tester, select this EA, select Model Open prices only (for faster)
select symbol and set use date, start.
File data series will be in metatrader 4\tester\files\ with csv extension
You can open and edit it with Excel or other Analysis programs for further analysis.

In this original, it use MACD Main for result, you can change your own favorite signal.
*/

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   report_name= StringConcatenate(Symbol(),Period(),".csv");
   handle=FileOpen(report_name,FILE_CSV|FILE_WRITE,';');
   if(handle<1) {
      Print("Failed to Open File: ",report_name);
      return;
   } else {
      Print("Succes to Open File: ",report_name);
   }
   FileWrite(handle,"Date Time","Result","Open","Close");
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   FileClose(handle);
   Print("File Closed: ",report_name);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   double MACD_Main;
   MACD_Main = NormalizeDouble(iMACD(Symbol(),0,Fast,Slow,Signal,0,0,1),5);
   FileWrite(handle,TimeToStr(Time[1]),MACD_Main,Open[1],Close[1]);
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar
Series array that contains open prices of each bar
Series array that contains open time of each bar


Indicator Curves created:


Indicators Used:

MACD Histogram


Custom Indicators Used:

Order Management characteristics:

Other Features:

Uses files from the file system
It writes information to file