Testing the model on new data
In the previous section, we optimized the parameters of our Expert Advisor on the training dataset and determined the optimal set of parameters. Now we need to test the performance of our model on new data. We are creating a model to potentially earn money in the financial market, arent we? So far, we have only trained the model and optimized the EA parameters using historical data for the period from 2015 to 2020 inclusive. We have identified the optimal set of parameters that allow us to make a profit on historical data. While we cannot travel back in time and make money on historical data, we can run our Expert Advisor on a trading account and hope for a comparable return in the future. To confirm or refute the possibility of future profitability, let's test our Expert Advisor with the trained model and optimized parameters on historical data outside the training set using data for 2021. Thus, we will test the profitability of the model on new data.
As in the case of parameter optimization, we go to the MetaTrader 5 strategy tester and in the Settings tab, specify the testing period 2021, select the type of modeling based on real ticks and disable parameter optimization. Also, do not forget to specify the correct financial instrument and timeframe.
After that, we will go to the EA parameters tab and specify the values of the parameters that we defined in the previous section. Start the testing process with the Start button.
![Forward testing of the model Forward testing of the model](/en/neurobook/img/forward_testing1.png)
Forward testing of the model
![Forward testing of the model Forward testing of the model](/en/neurobook/img/forward_testing2.png)
Forward testing of the model
During the testing period, the Expert Advisor made a profit over a long time interval. In general, the year was closed with a positive result. It should be noted that for testing the model, we use a rather simplified Expert Advisor algorithm without the use of money management and position tracking features. But even in this version, the EA shows profit. This is indicative of the overall profitability of the trading signals generated by the model. Potentially, adding money management and position tracking features will increase the profitability of Expert Advisor performance.
![Results of forward testing of the model Results of forward testing of the model](/en/neurobook/img/forward_testing3.png)
Results of forward testing of the model
The balance change chart shows sideways movement in the first half of the year, but from May, there is a clear trend of capital growth.
![Results of forward testing of the model Results of forward testing of the model](/en/neurobook/img/forward_testing4.png)
Results of forward testing of the model
Analysis of the Expert Advisor performance on new data showed that on some variables it even surpasses the values obtained on the training set. For instance, the profit factor on the new data was 1.48, whereas, during the parameter optimization on the training set, this indicator was at 1.22. The margin level in this case is not indicative, as all trades were made with a minimal volume, which greatly inflated this indicator.
![Results of forward testing of the model Results of forward testing of the model](/en/neurobook/img/forward_testing5.png)
Results of forward testing of the model
In total, for the whole of 2021, the EA opened 36 positions, 21 of which were closed with a profit. This accounted for 58.33% of the total number of positions. The obtained value is very close to the 60% expected return from the model's signals. Let me remind you that the threshold level for conducting trading operations is a 60% probability of the price moving in the predicted direction (parameter TradeLevel=0.6).
The maximum number of consecutive losing trades is three, while the maximum number of profitable trades is six.
![Results of forward testing of the model Results of forward testing of the model](/en/neurobook/img/forward_testing6.png)
Results of forward testing of the model
We did not integrate time-based transaction filtering into our Expert Advisor, nor did we provide time benchmarks for the training model. As a result, we see that the Expert Advisor opens positions more or less evenly throughout all trading sessions.
![Results of forward testing of the model Results of forward testing of the model](/en/neurobook/img/forward_testing7.png)
Results of forward testing of the model
However, throughout the week, we see a significant advantage in opening positions on Wednesday (about 30%). Friday and Monday follow next. The fewest positions are opened on Tuesday and Thursday.
![Results of forward testing of the model Results of forward testing of the model](/en/neurobook/img/forward_testing8.png)
Results of forward testing of the model
The Expert Advisor achieves the highest profitability on Wednesday and Monday. At the same time, the profit-to-loss ratio is better on Monday. On Friday, the profit and loss are balanced around the break-even point. However, on Tuesday and Thursday, the losses exceed the profits obtained. Such analysis potentially allows us to increase the profitability of the Expert Advisor by excluding inherently unprofitable trades. For instance, if we add a filter for opening positions based on the days of the week, we can increase the overall profitability of the Expert Advisor by making trades only on Monday and Wednesday.
![Results of forward testing of the model Results of forward testing of the model](/en/neurobook/img/forward_testing9.png)
Results of forward testing of the model
In general, the result of the Expert Advisor profitability on new data allows for the following conclusions:
- During technical analysis, it's possible to identify certain patterns that can generate quite stable signals for executing trades with profitability of at least 60%.
- The use of neural network models makes it possible to identify such patterns.
- Building an Expert Advisor based on neural networks allows for stable profitability over an extended period of time.