CSV TO HST?

 

Hello

i have been read csv data,but i hope to create .hst file with csv date,there is script:

int CSVHandle,i,j; 

string fStr0,fStr1,fStr2,fStr3,fStr4,fStr5,fStr6,fStr7; 

string fDate,fTime,fOpen,fHigh,fLow,fClose,fVol; 

CSVHandle = FileOpen("TEST1.CSV", FILE_CSV|FILE_READ,';'); 

FileSeek(CSVHandle, 0, SEEK_SET); 

/* while (!FileIsEnding(CSVHandle)) { } */ 



//one record testing 

fStr0 = FileReadString(CSVHandle); 



/* 1.Get_Date */ 

j = StringFind(fStr0,",",0); 

fDate = StringSubstr(fStr0,0,j); 

//Alert("Date="+fDate); 

fStr1 = StringSubstr(fStr0,j+1,StringLen(fStr0));

/* Alert("fStr1="+fStr1); * / 



/* 2.Get_Time */ 

j = StringFind(fStr1,",",0);

fTime = StringSubstr(fStr1,0,j);

//Alert("Time="+fTime); 

fStr2 = StringSubstr(fStr1,j+1,StringLen(fStr1)); 

/* Alert("fStr2="+fStr2); */



/* 3.Get_Open */ 

j = StringFind(fStr2,",",0); 

fOpen = StringSubstr(fStr2,0,j); 

//Alert("Open="+fOpen); 

fStr3 = StringSubstr(fStr2,j+1,StringLen(fStr2)); 

/* Alert("fStr3="+fStr3); */ 



/* 4.Get_High */ 

j = StringFind(fStr3,",",0); 

fHigh = StringSubstr(fStr3,0,j); 

//Alert("High="+fHigh); 

fStr4 = StringSubstr(fStr3,j+1,StringLen(fStr3)); 

/* Alert("fStr4="+fStr4); */ 



/* 5.Get_Low */ 

j = StringFind(fStr4,",",0); 

fLow = StringSubstr(fStr4,0,j); 

//Alert("Low="+fLow); 

fStr5 = StringSubstr(fStr4,j+1,StringLen(fStr4)); 

/* Alert("fStr5="+fStr5); */ 



/* 6.Get_Close */ 

j = StringFind(fStr5,",",0); 

fClose = StringSubstr(fStr5,0,j); 

//Alert("Close="+fClose); 

fStr6 = StringSubstr(fStr5,j+1,StringLen(fStr5)); 

/* Alert("fStr6="+fStr6); */ 



/* 7.Get_Vol */ 

j = StringFind(fStr6,",",0); 

fVol = StringSubstr(fStr6,0,j); 

//Alert("Vol="+fVol); 

fStr7 = StringSubstr(fStr6,j+1,StringLen(fStr6)); 

/* Alert("fStr7="+fStr7); 



*/ /*Write HST File*/ 

how to create hst file and write data to hst file?

thank you so much! 

 
jxwit:

Hello

i have been read csv data,but i hope to create .hst file with csv date,there is script:

<CODE REMOVED>

how to create hst file and write data to hst file?

thank you so much! 

Please edit your post . . .    please use the   SRC   button to post code: How to use the   SRC   button.

 

Why not use CSV2FXT  it not only creates the  fxt  file but also all the timeframe  hst  files? 

 
jxwit:

RaptorUK:Thank you so much, I will view the CSV2FXT script!

Search for it and you will find it easily,  I haven't used the one in the codebase but the one you will find on a different site,  can't mention it by name as advertising is not allowed,  but it's easy to find using Google.
Reason: