Reputation: 18952
I'm using the TesterStatistics()
function (called from the OnDeinit()
function) to export various strategy-testing statistical values:
void OnDeinit(const int /*reason*/)
{
int h = FileOpen("results.txt", FILE_WRITE|FILE_UNICODE|FILE_TXT|FILE_COMMON);
if (h != INVALID_HANDLE)
{
FileWrite(h, TesterStatistics(STAT_PROFIT));
FileWrite(h, TesterStatistics(STAT_SHORT_TRADES));
FileWrite(h, TesterStatistics(STAT_LONG_TRADES));
FileWrite(h, TesterStatistics(STAT_BALANCE_DD));
FileWrite(h, TesterStatistics(STAT_BALANCE_DDREL_PERCENT));
FileClose(h);
}
}
This works but seems limited to simple back-testing.
How can I export both the back-testing and forward-testing results?
Results of the forward test are displayed on the separate tab "Forward". The start date of the forward period is marked by a vertical line on the chart:
Can I access these information programmatically?
Upvotes: 2
Views: 342
Reputation: 1
You are right in the point, MetaTrader 5 Terminal does not recognise ( and frankly speaking, no one else could either ) a difference between a doing a real-trading and doing the very same things, but just as a forward-testing.
We use this in another context either, when our backtesting is not actually using the StrategyTester built in tools ( we found some strange accounting issues ( when non-major Deposit Currency was not correctly involved into S/T records in the flow of time ).
We wrote our own ReportResults()
and call it from the OnDeinit()
handler.
This works like a charm.
Upvotes: 2