Discussion of article "Creating Multi-Expert Advisors on the basis of Trading Models" - page 3

 
Serj_Che:

I think the article should be renamed - why make it simple when you can make it complicated.

Good point.

Interesting:

At least I understood (or I think I understood) the essence of what the author wanted to convey to the readers.

that's what I'm talking about. Everyone has understood the essence of what is written. Who of those who read it will take the attached codes as a ready implementation of some development stage? Practically nobody except the author. The article turned out to be an introductory one, from which you can take only the idea, not the code. And you didn't need to make so many letters for that.

If you call yourself a loader, then get into the body. If you decide to teach others or share your own experience, then you should write thinking over every word and the structure of the information you are presenting. If the thoughts are walking, and want to embrace the vastness and write about everything in the world, then there is nothing to take up writing articles fundamental plan. And the words that this is version 1.0 beta are not suitable. As it spoils the reputation of a competent coder.

I wish the forum management to be more attentive to the published materials and to carry out stricter control of author's works (not only articles but also codes). And just to fill up the number of publications you should not take everything in a row. So that it doesn't turn out like Codebase in MQL4. Really valuable works without analogues are lost behind hundreds of 1.0 beta versions.

 

Руководству форума желаю...

1. Don't tell me how to write or what to write.

2. Do not tell MetaQuotes Software Corporation what marketing policy to pursue and how to evaluate and select authors for its product.

Consider these points not as a wish, but as a warning. If you continue to spread negativity in the forum thread dedicated to my article and also tell MetaQuotes what to do and how to do it, it will be considered by me as an attempt to denigrate the work I have done and to question the professionalism of the MetaQuotes team. In this case, I will file a corresponding complaint to the moderators of this section, and I have serious reasons to believe that the conflict between me and you will be resolved in my favour.

Let's not bring the matter to the official clarification of relations and just go to the amicable agreement: you will stop writing in the thread dedicated to my article information that in no way relates to the topic under consideration here and stop denigrating the work done by me. It will be better if you stop posting anything here at all. I understand your point of view, you have expressed it on the previous pages. I disagree with it and you disagree with my opinion. I think we are both intelligent people and let's stop this useless polemic.

 
udmurt2:

I wish the management of the forum to be more attentive to the published materials and to carry out stricter control of author's works (not only articles but also codes). And just to fill up the number of publications you should not take everything in a row. So that it doesn't turn out like Codebase in MQL4. Really valuable works without analogues are lost behind hundreds of 1.0 beta versions.

+1

I think that the " Articles " section should be useful for consumers!!! Nadelektsya, does not scare and confuse them !

And now - "Chukcha is a writer, Chukcha is not a reader" .....

 

>>> Just imagine,your single Expert Advisor trades several dozens of trading strategies, on all available instruments and on all possible timeframes at once! In addition, this Expert Advisor is perfectly tested in the tester, and one or several money management systems are available for all the strategies included in it.

This is exactly how my Expert Advisor trading at the Championship is organised. Everything, as it seems to me, is simpler. The main thing is to design everything correctly and not to mix it in one pile.

//+------------------------------------------------------------------+
//|Vigor-Levels.mq5 |
//| Copyright 2010, MetaQuotes Software Corp. | |
//|http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"

#include <Vigor\Strategy.mqh>

#include <Vigor\TradeSignal.mqh>
#include <Vigor\ADXMAStrategy.mqh>
#include <Vigor\ADXStrategy.mqh>
#include <Vigor\MAVSimpleStrategy.mqh>
#include <Vigor\Order.mqh>
#include <Vigor\Dispatcher.mqh>
#include <Vigor\AdaptiveStrategy.mqh>
CDispatcher dispatcher;

//+------------------------------------------------------------------+
//| Expert initialisation function|
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   int myTick = 60;
   EventSetTimer(myTick);
   dispatcher.tickSeconds = myTick;

  //-- dispatcher object works with orders, strategy objects 
// deal only with signals and do not work with the market

  //-- simple strategies trading separately. heirs of CStrategy class
 //--strategies
   CMAVStrategy *s4 = new CMAVStrategy();
   s4.Symbol = "EURGBP";
   s4.onBars = true;
   s4.TimeFrame = PERIOD_M5;
   s4.HourStart = 7;
   s4.HourEnd = 18;
   s4.Risk = 0.1;
   s4.takeProfit = 2000;
   s4.stopLoss = 450;
   s4.trailingStop = 77;
   s4.lots = 0.1;
   s4.maxLots = 5;
  //--custom;
   s4.period1 = 2;
   s4.max = 0.0025;
   s4.sensity = 0.39;
   s4.unsensity = 0.53;
   s4.init();
   dispatcher.strategies.Add(s4);



  //--strategies
   CADXStrategy *s2 = new CADXStrategy();
   s2.Symbol = "GBPUSD";
   s2.onBars = true;
   s2.TimeFrame = PERIOD_M5;
   //s2.mHourStart = 0;
   //s2.mHourEnd = 24;
   s2.Risk = 0.13;
   s2.takeProfit = 2000;
   s2.stopLoss = 360;
   s2.trailingStop = 150;
   s2.lots = 0.1;
   s2.maxLots = 5;
  //--custom
   s2.period = 17;
   s2.level = 0.0042;
   s2.init();
   dispatcher.strategies.Add(s2);

  //--etc.


  //-- adaptive strategy containing within itself a virtual 
//trade of the connected list (CStrategy heirs again), 
//also CStrategy heir and for dispetcher'a there is no difference.
   CAdaptiveStrategy *sadapt4 = new CAdaptiveStrategy();
   sadapt4.onBars = false;
   sadapt4.mRisk = 0.13;
   sadapt4.lots = 0.1;
   sadapt4.performance_variant = 2;
   sadapt4.maxLots = 5;
   sadapt4.init();
        
        // ***************************************** M30
        CADXStrategy *s_gbpjpy1 = new CADXStrategy();    s_gbpjpy1.Symbol = "GBPJPY";    s_gbpjpy1.onBars = true;    s_gbpjpy1.TimeFrame = PERIOD_M30;  s_gbpjpy1.takeProfit = 2000; s_gbpjpy1.trailingStop = 70; s_gbpjpy1.lots = 0.1; s_gbpjpy1.maxLots = 5; 
        s_gbpjpy1.stopLoss = 300;  s_gbpjpy1.init();
        sadapt4.strategies.Add(s_gbpjpy1); // put everything in the adaptive strategy
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
        //  и т.д.
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
        


  dispatcher.strategies.Add(sadapt4);


 // fill it with whatever you want

  return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialisation function|
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   EventKillTimer();
   
  }
//+------------------------------------------------------------------+
//| Expert tick function|
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   dispatcher.control();
  }
//+------------------------------------------------------------------+
 

The example you gave is actually very similar to mine. There are less differences than it may seem. Everything is also implemented through classes and each class-strategy has its own independent parameters. The biggest difference is in their layout, in your case all strategies are handled by the dispatcher, in mine they are handled in a list of CObject type. In fact, my approach is not much more complicated than yours, we just talk about the same things, but in different language.

Initially I intended my approach to solve any combination of three "multis": multitimeframe, multistrategy, multitool. Now I see it as much more than that. In the second part, I'm thinking of covering the problem of the expert's decisions. The Expert Advisor will decide how to trade, what to trade and when to trade. All this allows my approach. Probably your approach too, and it is good, because several solutions of the same thing is a development.

By the way, can you look at the implementation of the dispatcher itself?

 
class CDispatcher {
   public:
      CTrade trade;
      CList strategies; 
      CList newOrders; 
      CList currentOrders;
      CList* strategiesResults;
      int repeats;
      int tickSeconds;
   private:
      ulong Magic;            
   public:
      void CDispatcher() {
          strategiesResults = new CList();
          repeats = 5;
          tickSeconds = 1;
      }
      void ~CDispatcher() {
        delete(strategiesResults);
      }
      
      void control();

      bool controlLimits();
      void controlOrders();
      bool controlOpen();
      bool controlClose();
      bool controlModify();      
      ulong ticketOpen(string smb, ENUM_ORDER_TYPE type,double lot,int SL,int TP);
      double countLotByRisk(CSymbolInfo *symbinfo, CStrategy *s, int dist, double risk, double lot, double maxlot);
       double NormalPrice(CSymbolInfo *symbinfo, double d);
      double NormalLot(CSymbolInfo *symbinfo, double lot);
      double BasePrice(CSymbolInfo *symbinfo, int dir);
      double ReversePrice(CSymbolInfo *symbinfo, int dir);
      double ReversType(ENUM_ORDER_TYPE type);
      double NormalTP(CSymbolInfo *symbinfo, int dir,double op,double pr,int TP,double stop);
      double NormalSL(CSymbolInfo *symbinfo, int dir,double op,double pr,int SL,double stop);
      void   checkDeals(CStrategy *s);
       ENUM_ORDER_TYPE getTypeByDirection(int dir);
       int getDirectionByType(ENUM_ORDER_TYPE type);
};
I won't post the implementation. Everything is clear here. Strategies are all descendants of CObject. But they are processed by the dispatcher. We need to go from simple to complex. A simple interface of objects, for an external observer, should hide all the details of implementation. I just want to say that there is nothing extraordinary in multis at all. Having OOP and polymorphism it is all simply done.
 
Vigor:
I won't post the implementation. Everything is clear here. Strategies are all descendants of CObject. But they are processed by the dispatcher. We need to go from simple to complex. A simple interface of objects, for an external observer, should hide all the details of implementation. I just want to say that there is nothing extraordinary in multis at all. With OOP and polymorphism it is all simply done.
+1. I completely agree. And in general I want to say that my approach is like two drops of water similar to yours. Strategies are all descendants of the base strategy CModel, which in turn is a descendant of CObject. Just like you, everything is initialised dynamically and put into a list. Just like you have implemented a simple object interface hiding all the implementation details. Another thing is that I had to describe the whole implementation in the article, and that's why many people thought it was complicated. But to use objects of my type you don't even need to know how it all works inside.
 

Vasily, thank you so much for the article! I read it in a whirlwind! It came very easily, I guess I am ripe for this kind of material. I, like many traders, pondered over some of the issues covered in the article. I solved some of them, some I did not. And some were only in the form of a vague idea. And it was very pleasant and unexpected to see everything in such a systematic presentation.

The scale of solved issues and, moreover, prospects is enormous. Not every "mind" is even mature enough to raise them, let alone solve them. This is the reason for comments in the style of Krylov's fable "The Fox and the Grapes", for "though the eye sees the eye, yet the tooth does not know the tooth". And the desire for self-assertion is indomitable, so they comment and hope that others will think: "Ah, the Moss! I know she is strong enough to bark at the Elephant!" :) It's not even worth paying attention to it.

Keep on creating, we look forward to the continuation!

P.S. Although you cannot work on MetaTrader 5 in real life yet, you can use the article "Copying Trading from MetaTrader 5 to MetaTrader 4". It is a very sensible, proven thing! So everything is very relevant and can be used in trading today!

 

......
For what, without fear of sin,
does the Cuckoo praise the Rooster?

 

it's better to be deservedly praised than unjustifiably labelled.