I had used this before. It had worked last time I used it:
extern string File = "20090605.txt";
int init()
{
handle = FileOpen( File, FILE_CSV|FILE_WRITE,"," ); // These are column titles for the output files
FileWrite (handle, "Date","Currency","H1-O","H1-H","H1-L","H1-C","M30-O","M30-H","M30-L","M30-C",
"M1-O","M15-H","M15-L","M15-C","M5-O","M5-H","M5-L","M5-C",
"M1-O","M1-H","M1-L","M1-C","Tick");
}
else
{ FileClose(handle); }
//----
return(0);
And this is how it was used in the body of the program:
// Debugmain is a Boolean
if (debugmain) FileWrite (handle, " Current Datetime ===> " + iTime(Currency[i] + SymbolSuffix, Timeframes[j], 0) +
" Last Datetime ===> " + LastSellCheckTime[i,j] + " i = " + i + " j = " + j + " Currency Pair = " + Currency[i] +
" Timeframe = " + Timeframes[j]);
On second thought, it looks like I was in the middle of a change and the field list here is different than that in the Init() section.
Good luck.
Hi,
i There is my actual code.
#property indicator_separate_window #property indicator_buffers 1 double histo[]; extern string FileName = "cot.csv"; extern string index = "INDEX small"; //=============== FUNCTION init int init() { SetIndexStyle(0, DRAW_LINE, STYLE_SOLID,1,Red); SetIndexBuffer(0, histo); SetIndexLabel(0, index); IndicatorShortName("NAME: "+FileName); makeHisto(); return(0); } void makeHisto() { int handle; handle=FileOpen(FileName,FILE_CSV|FILE_READ,','); if(handle<1) { Print("File not found: ", GetLastError()); return(false); } int i= 0; while(!FileIsEnding(handle)) { string cur=FileReadString(handle); // Currency string dt=FileReadString(handle); // Currency string val=FileReadString(handle); // Currency int value = StrToDouble(val); histo[i]=value; i++; } }
#property indicator_separate_window #property indicator_buffers 1 double histo[]; extern string FileName = "jedna.csv"; extern string index = "INDEX small"; //=============== FUNCTION init int init() { SetIndexStyle(0, DRAW_LINE, STYLE_SOLID,1,Red); SetIndexBuffer(0, histo); SetIndexLabel(0, index); IndicatorShortName("NAME: "+FileName); makeHisto(); return(0); } //=============== FUNCTION deinit int deinit() { return(0); } //=============== FUNCTION start int start() { makeHisto(); //---- //---- return(0); } //=============== Make Histogram void makeHisto() { int handle; handle=FileOpen(FileName,FILE_CSV|FILE_READ,','); if(handle<1) { Print("File was not found: ", GetLastError()); return(false); } int i= 0; while(!FileIsEnding(handle)) { string cur=FileReadString(handle); // Currency string dt=FileReadString(handle); // Currency string val=FileReadString(handle); // Currency int value = StrToDouble(val); histo[i]=value; i++; } } sorry wrong one. There is start() func.
sorry wrong one. There is start() func.
- Don't post comments inside the SRC block
- And the answer to the RaptorUK's second question is?
1.ok
2. in the midle of the code (my last post)
int start() { makeHisto(); //---- //---- return(0); }
1.ok
2. in the midle of the code (my last post)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I have a problem with exporting from cvs to mt4. Iam a begginer in programming so i cant solve it :(.
I just got data in CSV and i need do a indicator from them. But problem is that i dont know how to assign date to values. So it will be harmonized with chart.
Thanks for help :)
Example:
http://leteckaposta.cz/396024107 -> CSV firs value is date in format month/day/year, second is value of indicator