[SOLVED] Get stats in a .CSV / Write to file block
-
Hello everyone,
I have included a "write to file" block to get specific statistics on my backtests.
However my issue is to link it with the results from the backtest itself.
It would be easy if there was a way to write in the CSV file the "pass number" of the backtest.
I guess another way would be to get the results from the backtest in the CSV file on deinit but I do not know how to.Thank you for your help.
Jérémy -
@jerkha Not sure if that is possible with fxDreema. But I'm also interested on any solution for this.
-
I found a way that I have to dig into : https://www.mql5.com/en/docs/constant_indices

I now have to create a custom block to be able to call these constants. Don't know how to (yet) so if anybody has mql5 capacities to help it would be awesome.
-
I just can't believe how easy it was actually...
Here is the shared project : https://fxdreema.com/shared/vauFi9zNd

You just have to call the "TesterStatistics(STAT_whatever needed)" and store in a variable then put it in your write to file.
This is a big game changer for me and I hope it would help others !
I put the topic on solved.
BONUS : If like me you think that 10 columns in write file isn't enough, use a custom block to put all your constants & variables in a string separated with a comma (like this)

Then in Excel use the "convert" option :Highlight the column that contains your list.
Go to Data > Text to Columns.
Choose Delimited. Click Next.
Choose Comma. Click Next.
Choose General or Text, whichever you prefer.
Leave Destination as is, or choose another column. Click Finish. -
@jerkha Great! Thank you very much for sharing.
-
Would one be able to use this during a single backtest to store data of indicators NOT used in a strategy?
So, while running a backtest of a certain strategy, I'd like to collect values of e.g. BollingerBand to analyze in Excel whether losing periods were during certain BB values... And use the evidence to add a BB indicator (filter) to the strategy or not...
-
@unicornmadness I don't see how you could get BB bands value without it included in the EA. Including it doesn't mean it has to interfere with your entry or exit signals.
However you can get BB bands values (or calculations) when a trade is closed and store it in a CSV file. Use a boolean variable to check if trade was profitable and store it in the file as well.