WriteDataSeries

Author: Ibrahim Noor
WriteDataSeries
Indicators Used
MACD Histogram
Miscellaneous
Uses files from the file systemIt writes information to file
0 Views
0 Downloads
0 Favorites
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);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---