Thank you very much! Excellent EA.
Walter
You are good man. really helpful.
Has anyone converted this EA to mql5 or knows someone willing to do it? Thanks!
is MT5 version avilable
CrazyTrend #:
is MT5 version avilable
is MT5 version avilable
#property strict #property script_show_inputs #property version "1.10" //==================== INPUT ======================================== input int BarsMin = 100; // Minimal bars input int MaxBarsInFile = 20000; // Max bars per file input bool LoadM1 = true; input bool LoadM5 = false; input bool LoadM15 = false; input bool LoadM30 = false; input bool LoadH1 = true; input bool LoadH4 = false; input bool LoadD1 = true; input bool LoadW1 = false; input bool LoadMN = false; //==================== GLOBAL ======================================= string BasePath; int DigitsCount; //+------------------------------------------------------------------+ //| Script start | //+------------------------------------------------------------------+ void OnStart() { DigitsCount = (int)SymbolInfoInteger(_Symbol, SYMBOL_DIGITS); BasePath = "Export_History\\" + _Symbol + "\\"; CreateFolder("Export_History"); CreateFolder("Export_History\\" + _Symbol); if(LoadM1) ExportTF(PERIOD_M1, "M1"); if(LoadM5) ExportTF(PERIOD_M5, "M5"); if(LoadM15) ExportTF(PERIOD_M15, "M15"); if(LoadM30) ExportTF(PERIOD_M30, "M30"); if(LoadH1) ExportTF(PERIOD_H1, "H1"); if(LoadH4) ExportTF(PERIOD_H4, "H4"); if(LoadD1) ExportTF(PERIOD_D1, "D1"); if(LoadW1) ExportTF(PERIOD_W1, "W1"); if(LoadMN) ExportTF(PERIOD_MN1, "MN"); Print("=== HISTORY EXPORT FINISHED ==="); } //+------------------------------------------------------------------+ //| Export Function | //+------------------------------------------------------------------+ void ExportTF(ENUM_TIMEFRAMES tf, string tfName) { MqlRates rates[]; int copied = CopyRates(_Symbol, tf, 0, BarsMin + MaxBarsInFile, rates); if(copied <= BarsMin) { Print("Not enough bars for ", tfName); return; } int bars = MathMin(copied, MaxBarsInFile); string fileName = BasePath + _Symbol + "_" + tfName + ".csv"; int file = FileOpen(fileName, FILE_WRITE|FILE_CSV|FILE_ANSI, ','); if(file == INVALID_HANDLE) { Print("File open failed: ", fileName, " err=", GetLastError()); return; } // Header FileWrite(file, "Date","Time","Open","High","Low","Close","Volume"); for(int i = copied - bars; i < copied; i++) { FileWrite( file, TimeToString(rates[i].time, TIME_DATE), TimeToString(rates[i].time, TIME_MINUTES), DoubleToString(rates[i].open, DigitsCount), DoubleToString(rates[i].high, DigitsCount), DoubleToString(rates[i].low, DigitsCount), DoubleToString(rates[i].close, DigitsCount), rates[i].tick_volume ); } FileClose(file); Print(tfName, " exported: ", bars, " bars"); } //+------------------------------------------------------------------+ //| Create Folder | //+------------------------------------------------------------------+ bool CreateFolder(string path) { if(!FolderCreate(path)) { int err = GetLastError(); if(err != 5004) // folder already exists Print("Folder create error: ", path, " err=", err); } return true; } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Currency Loader:
Author: Kenzo