Discussion of article "MQL5 Wizard: How to Create a Risk and Money Management Module"

 

New article MQL5 Wizard: How to Create a Risk and Money Management Module is published:

The generator of trading strategies of the MQL5 Wizard greatly simplifies testing of trading ideas. The article describes how to develop a custom risk and money management module and enable it in the MQL5 Wizard. As an example we've considered a money management algorithm, in which the size of the trade volume is determined by the results of the previous deal. The structure and format of description of the created class for the MQL5 Wizard are also discussed in the article.

Figure 1. The structure of the CExpert base class

Author: MetaQuotes

 
 HistorySelect(0,TimeCurrent());

Such a construction with a large number of orders in the history will slow down a lot. Recently Roche published an article on how to copy orders for the last 24 hours into the cache. I put it into my Expert Advisor and MM stopped slowing down the tests.

 
dimeon:

Such a construction with a large number of orders in the history will slow down a lot. Recently Roche published an article on how to copy orders for the last 24 hours into the cache. I put it into my Expert Advisor and MM stopped slowing down the tests.

Thank you for your attention.

The code is given for example.

Since the Expert Advisor is not tied to a specific timeframe, there is no possibility to determine the necessary depth of the trade history query.

For example, when testing (or working) on daily candlesticks, the history for the last 24 hours will hardly help you.

So, choose the depth of history based on the specific situation (as you have done).

 
For those who are slightly adventurous, here is a martingale. To trade with fixed lots simply set the increase factor to 0.
 
You should write an example of how to initialise at least the base class CExpertMoney, otherwise you can't figure out how to use it!