Hello everybody.
Well, I have searched for a while an answer to this question, I mean, how to import data from an existing csv file, but I found nothing so far.
I know how I can create a csv file and how to read from this very csv file using a script (so a one shot bit of code), but only in the chart window and it works nicely.
I know how to trace dots in a separate window with an indicator and it works fine as well.
It seems very tricky to combine all the previous features in one file : either indicator, or EA, or script, whatever suits better.
I have found this thread or this second thread which seem to work for those people but it uses int init() and int start() which appear to work only in previous versions of MT4.
Thank you
Well, I have searched for a while an answer to this question, I mean, how to import data from an existing csv file, but I found nothing so far.
I know how I can create a csv file and how to read from this very csv file using a script (so a one shot bit of code), but only in the chart window and it works nicely.
I know how to trace dots in a separate window with an indicator and it works fine as well.
It seems very tricky to combine all the previous features in one file : either indicator, or EA, or script, whatever suits better.
I have found this thread or this second thread which seem to work for those people but it uses int init() and int start() which appear to work only in previous versions of MT4.
Inserted Code
int OnInit() { int row=0,col=0; int maxcol=0, maxrow=0; IndicatorDigits(0); SetIndexBuffer(0,Maximum0); SetIndexLabel(0,"Maximum"); SetIndexStyle(0,DRAW_LINE,STYLE_DOT,0); //--- Initialize all the buffers Data_up.Initialize(1,"Arrows OK",Buffer_up); Data_do.Initialize(2,"Arrows NOK",Buffer_do); Data_flat.Initialize(3,"Arrows ?",Buffer_flat); file_handle=FileOpen(InpDirectoryName+"//"+InpFileName,FILE_READ|FILE_WRITE|FILE_CSV); if(file_handle!=INVALID_HANDLE) { // ----- If I put this bit of code, the indicator is not even executed. Otherwise, it is executed but no datum is imported from excel ----- while(True) { s[col][row] = FileReadString(file_handle); col++; if(FileIsLineEnding(file_handle)) { if(maxcol==0) maxcol = col; col = 0; row++; } if(FileIsEnding(file_handle)) break; } // ---------------------------------------------------------------------------------------------------------------------------------------- FileClose(file_handle); } return(INIT_SUCCEEDED); }
Thank you