I found a script that exports X amount of candles, history. that's what it spits out:
2019.07.22,16:56,1,1.24840,1.24856,1.24837,1.24855, |
but i want only close price without any commas, what do i have to delete for it works? all my attempts failed or result in the script not working anymore :((
//+------------------------------------------------------------------+ //| sadasd.mq4 | //| Copyright 2019, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ int handle; //number of bars to export per Symbol int maxBars = 2000; //test first on several pairs string Currencies[] = {"EURUSD.","GBPUSD"}; // then add more in the same format // string Currencies[] = {"AUDUSD","EURUSD","GBPJPY","GBPUSD","EURJPY","EURGBP","USDCHF","USDJPY","AUDJPY","CHFJPY","CADJPY","GBPCAD","EURAUD","USDCAD","EURCAD","NZDUSD","NZDJPY"}; string dSymbol; //+------------------------------------------------------------------+ //| start function | //+------------------------------------------------------------------+ int start(){ int count = ArraySize(Currencies); for (int ii=0; ii<=count; ii++){ dSymbol = Currencies[ii]; handle = FileOpen("Hist_"+dSymbol+"_"+GetPeriodName()+".csv", FILE_BIN|FILE_WRITE); if(handle < 1){ Print("Err ", GetLastError()); return(0); } WriteTABLEHeader(); for(int i = 0; i < maxBars - 1; i++){ WriteRow(i); } FileClose(handle); } Alert("Done."+TimeMonth(TimeLocal())+TimeDay(TimeLocal())+TimeYear(TimeLocal()) +"_"+TimeHour(TimeLocal())+TimeMinute(TimeLocal())); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void WriteString(string txt){ FileWriteString(handle, txt,StringLen(txt)); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void WriteTABLEHeader(){ WriteString("Date,"); WriteString("Time,"); WriteString("DayOfWeek,"); WriteString("Close,"); WriteString("Volume"); WriteString("\n"); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void WriteRow(int i){ double dSymTime, dSymClose, dSymVolume; double dSymHigh_D1,dGap; int dDayofWk,iDigits; string bandDistance; double dClose, dOpen,Poin,dblPoints; dSymTime = (iTime(dSymbol,Period(),i)); dDayofWk = (TimeDayOfWeek(dSymTime)); WriteString(TimeToStr(dSymTime, TIME_DATE )); WriteString(","); if(Period() < PERIOD_H4){ WriteString(TimeToStr(Time[i], TIME_MINUTES)+","+dDayofWk+","); } iDigits=MarketInfo(Symbol(),MODE_DIGITS); dSymClose = (iClose(dSymbol,Period(),i)); dSymVolume = (iVolume(dSymbol,Period(),i)); WriteString(DoubleToStr(dSymClose, iDigits)+","); WriteString("\n"); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ string GetPeriodName(){ switch(Period()){ case PERIOD_D1: return("Day"); case PERIOD_H4: return("4_Hour"); case PERIOD_H1: return("Hour"); case PERIOD_M1: return("Minute"); case PERIOD_M15: return("15_Minute"); case PERIOD_M30: return("30_Minute"); case PERIOD_M5: return("5_Minute"); case PERIOD_MN1: return("Month"); case PERIOD_W1: return("Week"); } return ""; }
Greetings mate, this worked for me and it showed only close prices. The KEY DIFFERENCE is the NAME OF THE CURRENCY. In my script, I changed it to "EURUSD." since that is how my broker names it on my MT4. Hope this helps.
Best Regards,
Lord Odin
Greetings mate, this worked for me and it showed only close prices. The KEY DIFFERENCE is the NAME OF THE CURRENCY. In my script, I changed it to "EURUSD." since that is how my broker names it on my MT4. Hope this helps.
Best Regards,
Lord Odin
hey Lord
wow thank you so much!! i will test it.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I found a script that exports X amount of candles, history. that's what it spits out:
but i want only close price without any commas, what do i have to delete for it works? all my attempts failed or result in the script not working anymore :((