Posted By: subsoft
Need Help with script to convert .t6 to csv - 08/21/20 06:18
Hi I have followed documentation but i am stuck so I need some guidance
I have modified existing csv to t6 script here is the code
What I would like to achieve:
- Go through all .t6 files in History and convert then to csv with respective names.
- or something like Download.c script where I can go through Assets list and download files as CSV instead of .t6. Not sure if its possible by override setting to generate CSV file format. This would be very helpful as this gives me lot of flexibility to use converted csv data in other programs and tools to analyse. I have tried to go through Download.c script but couldn't pinpoint where this data conversion takes place, does this happen through some other scripts?
Thanks for your help in advance.
Zorro is great tool, I am still learning it... but loving it
I have modified existing csv to t6 script here is the code
Code
// Hardcode value to .t6 file path in History folder string InName = "History\\XAUUSD_2020.t6"; string OutName = InName; // OANDA data format /* f1 = O f3 = L f2 = H f4 = C f6 = V */ //string Format = "+%Y.%m.%d,%H:%M:%S,f1,f3,f2,f4,f6"; string Format = "+%Y.%m.%d,%H:%M:%S,f1,f2,f3,f4,f6"; function main() { int Records = dataLoad(1,InName, 7); if(!Records) { printf("\nCan't open %s",InName); return; } printf("\n%i bars",Records); #ifdef FIX_ZONE int i; for(i=0; i<Records; i++) dataSet(1,i,0,dataVar(1,i,0)+FIX_ZONE/24.); #endif #ifndef SPLIT_YEARS if(Records) dataSave(1,OutName); #else int i, Start = 0, Year, LastYear = 0; for(i=0; i<Records; i++) { Year = atoi(strdate("%Y",dataVar(1,i,0))); if(!LastYear) LastYear = Year; if(i == Records-1) { // end of file LastYear = Year; Year = 0; } if(Year != LastYear) { string NewName = strf("%s_.csv",strxc(OutName,'.',0),LastYear); printf("\n%s",NewName); // Save file as CSV dataSaveCSV(1,Format,NewName,Start,i-Start); Start = i; LastYear = Year; } } #endif }
What I would like to achieve:
- Go through all .t6 files in History and convert then to csv with respective names.
- or something like Download.c script where I can go through Assets list and download files as CSV instead of .t6. Not sure if its possible by override setting to generate CSV file format. This would be very helpful as this gives me lot of flexibility to use converted csv data in other programs and tools to analyse. I have tried to go through Download.c script but couldn't pinpoint where this data conversion takes place, does this happen through some other scripts?
Thanks for your help in advance.
Zorro is great tool, I am still learning it... but loving it