FXG_sHist2csv

Author: FXGeneral,� 2010
Price Data Components
Series array that contains open prices of each barSeries array that contains close prices for each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains tick volumes of each bar
Miscellaneous
It reads information from a fileUses files from the file systemIt writes information to fileIt plays sound alerts
0 Views
0 Downloads
0 Favorites
FXG_sHist2csv
//+------------------------------------------------------------------+
//|                                                FXG_sHist2csv.mq4 |
//|                                                 FXGeneral,© 2010 |
//|                                        http://www.fxgeneral.com/ |
//+------------------------------------------------------------------+
#property copyright "FXGeneral,© 2010"
#property link      "http://www.fxgeneral.com/"

#property show_inputs
extern string ext="txt";
extern int last_bar=1;
extern int bars=610;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
Print("Èñòîðèÿ ñîõðàíÿòåñÿ. Ïîæàëóéñòà ïîäîæäèòå");
string smbs[];
double o,hi,l,c,v; 
int hFile = FileOpenHistory("symbols.raw", FILE_BIN|FILE_READ); if(hFile<0) return(-1);  // Îòêðûâàåì symbols.raw
int nSmb=FileSize(hFile)/1936; // Îïðåäåëÿåì êîëè÷åñòâî ñèìâîëîâ, çàðåãèñòðèðîâàííûõ â ôàéëå
ArrayResize(smbs, nSmb);
for(int i=0; i<nSmb; i++) 
{ 
smbs[i] = FileReadString(hFile, 12); FileSeek(hFile, 1924, SEEK_CUR); 

int h=FileOpen(""+smbs[i]+""+Period()+"."+ext+"",FILE_WRITE|FILE_CSV,",");
      for(int j=bars;j>=last_bar;j--)
      {
         o=iOpen(""+smbs[i]+"",Period(),j);
         c=iClose(""+smbs[i]+"",Period(),j);
         hi=iHigh(""+smbs[i]+"",Period(),j);
         l=iLow(""+smbs[i]+"",Period(),j);
         v=iVolume(""+smbs[i]+"",Period(),j);
         
         FileWrite(h,TimeToStr(Time[j],TIME_DATE),TimeToStr(Time[j],TIME_MINUTES),o,hi,l,c,v);
      }
  FileClose(h);

} 
Print("Èñòîðèÿ ñîõðàíåíà");
PlaySound("alert.wav");


   
//----
   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 ---