Download MetaTrader 5
To add comments, please log in or register
Sign up for MQL5.community to post your Forum topic
Pavel Soukup
559
Pavel Soukup 2015.05.13 07:08 

Hi quys,

I have EA preparing for optimize process and my EA create new file for each variant input parameters EA.

How create unique file name for every step optimization process?

example:

1th   setting input parameters => filename: "optimize_step_0001.csv"

2nd  setting input parameters => filename: "optimize_step_0002.csv"  

 etc.   ----- etc. -------            =>      --------- etc. ------------

If exist any way how count steps in optimization process?

If exist any way how write actual setting value all input parameters for actual step optimization to file?

Thank you. 

whroeder1
13641
whroeder1 2015.05.13 11:57  
Why would you want to create ten thousand files with one line in each? Append the line to one file, the step is the line number.
Pavel Soukup
559
Pavel Soukup 2015.05.13 16:02  

Each file will by more than one line. I need more value for each step optimization for all input data therefore I want one file on one step optimization.

Question is: How do I do it? I don´t know ... :-( 

Ovo Cz
2953
Ovo Cz 2015.05.13 18:01  
endy5:

Each file will by more than one line. I need more value for each step optimization for all input data therefore I want one file on one step optimization.

Question is: How do I do it? I don´t know ... :-( 

I have been using following code for generating the serial log file names for long time, perhaps it could give you inspiration:

        // creates string from a current date and compare to a string in the global. ! Not synchronous !
        double todayString =  StrToDouble(padZero(Year(),4) + padZero(Month()) + padZero(Day()) + /*str*/("0000"));
        string DEBUG_VAR=/*str*/("debugcounter");
        if(!GlobalVariableCheck(DEBUG_VAR)) GlobalVariableSet(DEBUG_VAR, todayString);
        double debugIncrement = GlobalVariableGet(DEBUG_VAR);
        
        // replace date the next day. Still not synchronous !. 
        while(todayString > debugIncrement) {
                GlobalVariableSetOnCondition(DEBUG_VAR, todayString, debugIncrement);
                debugIncrement = GlobalVariableGet(DEBUG_VAR);
        }
        // read synchronously the value of global and increment it
        for(debugIncrement = GlobalVariableGet(DEBUG_VAR);!GlobalVariableSetOnCondition(DEBUG_VAR, debugIncrement + 1, debugIncrement);) {}
        GlobalVariablesFlush();
        // define logfile name
        fileName = /*str*/("LOGS\\") + DoubleToStr(debugIncrement,0) + /*str*/("-") + fileName + /*str*/(".log");
        
        this.logHandle = FileOpen(fileName, FILE_WRITE|FILE_BIN|FILE_SHARE_READ|FILE_SHARE_WRITE);
Pavel Soukup
559
Pavel Soukup 2015.05.15 07:10  

Solution by global variables works all right. Maybe exist better solution but I am all right.

Thank you very mutch for idea!!! 

whroeder1
13641
whroeder1 2015.05.15 12:21  
I was thinking of creating a CRC32 of all the parameters. That way would allow reading the file back in.
/
To add comments, please log in or register