Download MetaTrader 5
To add comments, please log in or register
They are making profit already using Freelance service. You can join them!
antony
549
antony 2014.04.02 11:25 

Hi

I have been experimenting with some code to obtain some variables from a filename.

Here is an example: 60_EURUSDFXF_12345678.sell

So with an EA I would like to extract the info to be used:

int time ="", period="";
string sym = "", ext = "";

fn = period + "_" + sym + "_" + time + ext;

fn = FileOpen(fn,FILE_CSV|FILE_READ,";");

Print(period); //return Period() value from filename
Print(sym); // return Symbol() value from filename
Print(time); // return iTime() value from filename
Print(ext); // return extension name from filename

This is what I have got to at the moment but all values return 0, do I need to use SubString("") ?

If so how can I do this please?

Thanks

Antony

qjol
3243
qjol 2014.04.02 11:54  
Print(period); //return Period() value from filename      no it doesn't
Print(sym); // return Symbol() value from filename        no it doesn't
Print(time); // return iTime() value from filename        no it doesn't
Print(ext); // return extension name from filename        no it doesn't
   

you have to use one of the FileRead's functions... first

qjol
3243
qjol 2014.04.02 12:18  

Oh, just noticed that you referring to fileName and not the content

use StringSplit and convert the result using right StringTo... for instance StringToTime Etc.

/
To add comments, please log in or register