Experts: 5_8 MACross - page 3

 
Shara1:

Hello Vladimir. Is it possible to make buy, sell separately in your Expert Advisor and doles by trend?

Thank you.

I have not yet platinised the edits to this code.

 
Vladimir Karputov:

I haven't platinised the edits to this code yet.

Vladimir, please give me a hint. After running in the tester, in the report for some reason the parameters are reversed: mafastperiod-42, and maslowperiod-12. In fact, the fast one should be less than the slow one. I ran it twice, and both times I got such results.

Thank you.

 
Shara1:

Vladimir, please give me a hint. After running in the tester, in the report for some reason the parameters are reversed: mafastperiod-42, and maslowperiod-12. In fact, the fast one should be less than the slow one. I ran it twice, and both times I got such results.

Thank you.

"fast", "slow" - these are just labels, verbal labelling of a parameter. But at the end of the day, all parameters are numbers. And since you turn on genetic optimisation and search among thousands of results, but you can't rule out such reversals of consciousness :). A digit can be anything, no matter how you call it - "slow" or "fast".

Sometimes I specially put a restriction like "slow" cannot be more or equal to "fast", and sometimes I don't put it and end up with interesting results.

 
Vladimir Karputov:

"fast", "slow" - these are all just labels, verbal labelling of a parameter. But in the end, all parameters are numbers. And since you switch on genetic optimisation and search among thousands of results, but such reversals of consciousness are not excluded :). A figure can be any number, no matter how you call it - "slow" or "fast".

Sometimes I put a ban like "slow" cannot be more or equal to "fast", and sometimes I don't put it and get interesting results.

How can I set such a ban in this EA?

Thank you.

 
Shara1:

And how to put such a ban in this EA?

Thank you.

In OnInit() write a comparison of two parameters. If the condition is not met - then unload the EA with an error.

 
Vladimir Karputov:

In OnInit() write the comparison of two parameters. If the condition is not met - then unload the EA with an error.

Thank you.

For me it is not feasible for now. Are you not planning to edit this code at all ?

 
Vladimir, please tell me in this EA of yours:https://www.mql5.com/en/code/19578 there is a ban like "slow" can not be more or equal to "fast". If not, please give me a link where I can see it.
ma-shift Puria method
ma-shift Puria method
  • votes: 14
  • 2017.12.13
  • Vladimir Karputov
  • www.mql5.com
В основу советника положен метод Пуриа с небольшими вольностями. Используется сигнал не пересечения быстрой MA медленной, а их движение в одну сторону, подтверждение при пересечении MACD своей нулевой линии и крутизной движения быстрой MA, выраженной в количестве пипсов на тик (параметр Shift (vertically) between MA Fast and MA Slow). Обычный...
 
Shara1:
Vladimir, please tell me in this EA of yours:https://www.mql5.com/en/code/19578 there is a ban like "slow" can not be more or equal to "fast". If not, please give me a link where I can see it.

This EA has such a protection:

//+------------------------------------------------------------------+
//| Expert initialisation function|
//+------------------------------------------------------------------+
int OnInit()
  {
   if(InpTrailingStop>0 && InpFractalTrailing)
     {
      Print("If we use \"Fractal trailing\" - we do not use \"Trailing stop\"!");
      Print("If we use \"Trailing stop\" - we do not use fractal \"Fractal trailing\"!");
      return(INIT_PARAMETERS_INCORRECT);
     }

here it checks the parameter to see if it is greater than zero and there is a flag.

 

But in the EMA Cross Contest Hedged code, there is already protection of two averaging periods of two Moving Average indicators:

   if(InpShort_ma_period>=InpLong_ma_period)
     {
      Print("\"MA short: averaging period\" can not be greater and equal to \"MA long: averaging period\"");
      return(INIT_PARAMETERS_INCORRECT);
     }
 
Vladimir Karputov:

But in the EMA Cross Contest Hedged code, there is already protection of two averaging periods of two Moving Average indicators:

That is, I need after this line - int OnInit()

Insert this -

 if(InpShort_ma_period>=InpLong_ma_period)
     {
      Print("\"MA short: averaging period\" can not be greater and equal to \"MA long: averaging period\"");
      return(INIT_PARAMETERS_INCORRECT);
     }

It will look like this-

//+------------------------------------------------------------------+
//| Expert initialisation function|
//+------------------------------------------------------------------+
int OnInit()
  {
 if(InpShort_ma_period>=InpLong_ma_period)
     {
      Print("\"MA short: averaging period\" can not be greater and equal to \"MA long: averaging period\"");
      return(INIT_PARAMETERS_INCORRECT);
     }

Thank you.