MACD Sample EA: a modify with the goal to switch "strategies"

 

Hi.

My idea is to modify a bit the EA called MACD Sample EA, in this way:


i would like to reprogram the algorithm in the way that i can switch between many entry(and also exit and modify) strategies.

In a concrete example:

When in the code there is this piece (for short opening position)

bool CSampleExpert::ShortOpened()
  {
   bool res=false;
//--- check for short position (SELL) possibility
   if(m_macd_current>0)
      if(m_macd_current<m_signal_current && m_macd_previous>m_signal_previous)
         if(m_macd_current>(m_macd_open_level) && m_ema_current<m_ema_previous)
           {

i would like to do something like this:

if(m_macd_current<0)  // please notice the "<" instead of the ">"
      if(m_macd_current>m_signal_current && m_macd_previous<m_signal_previous) // please notice the switching of "<" and ">"
         if(m_macd_current>(m_macd_open_level) && m_ema_current<m_ema_previous 
                                               && m_ema2_current<m_ema2_previous) // please notice the ema2 indicator adding
           {


and this

if(m_macd_current<aaa)  // please notice the "aaa" variable
      if(m_macd_current>m_signal_current || m_macd_previous<m_signal_previous) // please notice the "||" instead of &&
         if(m_macd_current>(m_macd_open_level) && m_ema_current<m_ema_previous 
                                               && m_ema3_current<m_ema4_previous) // please notice the ema3 and ema4 indicator adding
           {


and so on..

In other words, i search the way to make  a series of "strategies"(invented by me) that may be simply i.e. the changes of the entry point parameters conditions(or also the changes of the exit, and modify parameters), in a way that those series/list of "strategies" are assigned to a int variable, for instance called int Strategy.

I can, in example assign the integer value for the first condition as Strategy=1; the second condition as Strategy=2, the third as Strategy=3, and so on..


In this way, i can optimize in the optimizer, the various strategies, by switching (stepping) simply the Strategy int value (0,1,2,3,4, etc..)


(in the same fashion can be created StrategyForOpen=1,2,3,4..; StrategyForClose=1,2,3,4..; StrategyForModify=1,2,3,4.., or more

detailed in example StrategyForOpenLong=1,2,3,4...; StrategyForCloseShort=1,2,3,4..; StrategyForModifyLong=1,2,3,4... etc...)


I can understand that there are many way to do this.. with functions, or with many if, (don't know how to do with a switch..)

My propose, for who are interested, is to propose your ideas to make different version of this idea/code.


I remember that in mq4 i found a way to do this, but now with mq5 i think is quite bit difficult for me actually.

Thanks

Reason: