Custom Optimization Parameters

 

Is there any way to have a variable thats defined within the EA stepped between optimization runs? For example if I were to create a variable 'n' and simply n++; for each successive optimization run.

Id like to get data on a few things given some input (average open price for buys/sells over the entire backtest, for instance) and would like to use the optimization feature to automate the process.

Problem is I cant seem to find any way to differentiate between successive optimization runs from within the EA. There seems to be no way to access this info. Any thing or this nature available in MT5 perhaps?

Does denit() get called each optimization run? I can put some code inside deinit() to write the data I need to an external file.

 
FYI, I figured out how to do this. If anyone is interested feel free to ask.
 
supertrade:

Does denit() get called each optimization run? I can put some code inside deinit() to write the data I need to an external file.


I suspect most moderately experienced coders have crossed this bridge and likely develop their own solution to it.

deinit() does get called each run within an optimization. And yes you can use denit() to write data to an external file (many of us do this to export backtest trade results for follow-up analyses)...but for the case you are looking at it would be far easier to just use GlobalVariableSet() and have each successive run increment the globalvalue by one.