Discussion of article "Adaptive Trading Systems and Their Use in the MetaTrader 5 Client Terminal"

 

New article Adaptive Trading Systems and Their Use in the MetaTrader 5 Client Terminal is published:

This article suggests a variant of an adaptive system that consists of many strategies, each of which performs its own "virtual" trade operations. Real trading is performed in accordance with the signals of a most profitable strategy at the moment. Thanks to using of the object-oriented approach, classes for working with data and trade classes of the Standard library, the architecture of the system appeared to be simple and scalable; now you can easily create and analyze the adaptive systems that include hundreds of trade strategies.

Figure 2. Equity curves at the account with the adaptive strategy that uses signals of 10 trade systems

Author:  MetaQuotes

 

Impressionant article.

Thanks. I love this new mql5 forum, and it seems becoming a kind of science.

Your article is great, and is something i was looking for years, thanks for helping me indirectly.


I also should warn that there is an(logically insignificant) error in the include file CSampleStrategy,

//+------------------------------------------------------------------+
//| The StrategyPerformance function of effectiveness of strategy    |
//+------------------------------------------------------------------+ 
double CSampleStrategy::StrategyPerformance()
  {
//returns the effectiveness of strategy
/in this case it's the difference between the amount 

 the last raw have only one slash on the comment and this generate about 13 errors when compiling the mq5 expert.


This is a very great article, that combined with many other articles knowledge in the last months of mql5 can make a very interesting

experimentations on high-grade experts advisors.


I was wondering about the possibility to improve this article-strategy, in example by adding files possibility

to the code, to store and recall extra results.. The fantasy would not stop.

Thanks again.

 

PS: it also produce to me an "internal error #55"

that don't let the ex5 being created. Some helps.. ?


 
forexistence:

I also should warn that there is an(logically insignificant) error in the include file CSampleStrategy,

 the last raw have only one slash on the comment and this generate about 13 errors when compiling the mq5 expert.


Thank you. The corrected version is reattached to the article.
 

Thanks for the corrected version.

I think a thing: even if this article is very interesting, the idea is very great, the code is very clean and with many advantages,

and even if this is an example EA, the whole EA as published is Strategy Tester unfriendly.

I mean the fact that with the downloaded version is not possible to set input parameters from the terminal.

 

Since include files cannot have input parameters variables, how the way to "inputize" the many variables of the many include files

of this EA? 

 

Is it a bother to translate the documentation to English? I always appreciate some good docs. Great article, thanks for your awesome contribution. 

 
Lugner:

Is it a bother to translate the documentation to English? I always appreciate some good docs. Great article, thanks for your awesome contribution. 

We will translate the attached documentation as soon as possible.
 

To work with input parameters (variables), it's easy with just declaring them before class declaration, and

following the the class (includes) calling path.

 
Lugner:

Is it a bother to translate the documentation to English? I always appreciate some good docs. Great article, thanks for your awesome contribution. 

Thank you. The documentation is translated.
 

This is probably the most thought provoking article I have read on programmatic/robotic trading for a very, very, long time. A big thank you!

Acting on this new enthusiasm, I have adapted Eugene's work a little. [Apologies - at least I too will share ideas ;-) ]

I adapted an existing EA (not Object Oriented yet, unfortunately) for:

1. Multiple time scales:  M1, M3, M5, M10, M20, M30, H1
2. Multiple Fast MA's:  3,5,7,9,11
3. Multiple Slow MA's:  17,27,37,47 etc 97,107, 117 etc

Attached to an M1 tick, on a foreach(period)-foreach(fast)-foreach(slow) loop. Each tick works out if it needs to check for a 'virtual' trade, and 'executes' if need be, keeping a logical/virtual P/L balance.

Results are very suprising, and very positive ...

Optimisation is now in the areas of removing short time periods (e.g. M1, M3) [as higher time periods eventually 'win'], and also in determining how often to clear down the 'running P/L' counter to allow for detection of 'rapidly improving' parameter sets.

I have also to interface my favourite trading EA into this work (to add ADX/RSI/MACD/RVI checks etc), so that it always uses optimal, winning fast/slow MA pairs, and also has good market, money, position and trade management logic.

Thanks again,

T. 

 

Quantum,

  obviously if i want add more buy and sell conditions (or pairs/combos of buy and sell conditions), apart from the still gifted 

  

if(buy_condition_1 && buy_condition_2) new_state=SIGNAL_OPEN_LONG;
if(sell_condition_1 && sell_condition_2) new_state=SIGNAL_OPEN_SHORT;

 in example in CStrategyMA.mqh,

  to trigger other opportunities for

new_state=SIGNAL_CLOSE_SHORT;
// and 
new_state=SIGNAL_CLOSE_LONG;

  it have not logical sense to add those combos  in the file  CStrategyMA.mqh, but for every new conditions or pairs/combos 

  of conditions, it should be dedicated another include/class file,

 

that's right?

 

I rapidly mean, in example, if i want add those conditions:

// Buy condition 3: MA new 
   bool buy_condition_3=(m_values[0+5]>m_values[1+7]) && (m_values[1+5]>m_values[2+7]);
// Buy condition 4: previous OPEN price is higher than MA
   bool buy_condition_4=(p_open>m_values[1]);

// Sell condition 3: MA new 
   bool sell_condition_3=(m_values[0+5]<m_values[1+7]) && (m_values[1+5]<m_values[2+7]);
// Buy condition 4: previous OPEN price is lower than MA
   bool sell_condition_4=(p_open<m_values[1]);

and 

  if(buy_condition_3  &&  buy_condition_4) new_state=SIGNAL_OPEN_LONG;
   if(sell_condition_3 && sell_condition_4) new_state=SIGNAL_OPEN_SHORT;

   if((GetSignalState()==SIGNAL_OPEN_SHORT) && (buy_condition_3 || buy_condition_4)) new_state=SIGNAL_CLOSE_SHORT;
   if((GetSignalState()==SIGNAL_OPEN_LONG) && (sell_condition_3 || sell_condition_4)) new_state=SIGNAL_CLOSE_LONG;

 it can be added in sub-classes within CStrategyMA.mqh, without affecting the core system of the 

adaptive system, in other words with continuing correctly this include file CStrategyMA.mqh interact with CAdaptiveStrategy.mqh

and CSampleStrategy.mqh, also taking consideration of the new conditions (3 and 4 of the example) in the logical core

of the EA idea?

Or for the condition 3 and 4, i should rewrite and add, for example, a file CStrategyMA3and4.mqh ???

It is possible to add those conditions within the same  CStrategyMA.mqh and working all correctly?

Maybe i've the reply by myself and i'm bit stupid, but also want ask your opinion(s)..

 

Thanks 

 

 

 

 

 

Reason: