Experts: Classic 2 Moving Averages crossover EA - page 3

 
blessdee:

I want to add two moving indicators crossing over before entry signal but it is not accepting the handle i created to this code:

***

// How can i call two moving Average before  CSignalMACD *signal=new CSignalMACD;

Please insert the code correctly: when editing a message, press the button  Codeand paste your code into the pop-up window. (The first time I corrected your message)
 
Vladimir Karputov:
Please insert the code correctly: when editing a message, press the button  and paste your code into the pop-up window. (The first time I corrected your message)
int OnInit(void)

 
  {
//--- Initializing expert
   if(!ExtExpert.Init(Symbol(),Period(),Expert_EveryTick,Expert_MagicNumber))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing expert");
      ExtExpert.Deinit();
      return(-1);
     }
   
   // Specific parameter controlling which positions are allowed
   ExtExpert.SetAvailablePositions(Inp_Allowed_Positions);  

//--- Creation of signal object
   CSignalMACD *signal=new CSignalMACD;
   if(signal==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating signal");
      ExtExpert.Deinit();
      return(-2);
     }
//--- Add signal to expert (will be deleted automatically))
   if(!ExtExpert.InitSignal(signal))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing signal");
      ExtExpert.Deinit();
      return(-3);
     }
//--- Set signal parameters
   signal.PeriodFast(Inp_Signal_MACD_PeriodFast);
   signal.PeriodSlow(Inp_Signal_MACD_PeriodSlow);
   signal.PeriodSignal(Inp_Signal_MACD_PeriodSignal);
   signal.TakeLevel(Inp_Signal_MACD_TakeProfit);
   signal.StopLevel(Inp_Signal_MACD_StopLoss);
//--- Check signal parameters
   if(!signal.ValidationSettings())
     {
      //--- failed
      printf(__FUNCTION__+": error signal parameters");
      ExtExpert.Deinit();
      return(-4);
     }
 
blessdee :

Your question is not related to this topic. You need to read the articles on how to create a custom indicator signal module using the MQL5 Wizard.

 

Hey Andrey, thanks for the code. 

I've a problem, when I compile in my mt5 editor, I've a error : "Cannot convert from const pointer to nonconst pointer" she is at the line 1561, column 12.

Can you help me ? 

Thanks !

 
RaimiGad :

Hey Andrey, thanks for the code. 

I've a problem, when I compile in my mt5 editor, I've a error : "Cannot convert from const pointer to nonconst pointer" she is at the line 1561, column 12.

Can you help me ? 

Thanks !

I just checked in build 3020 - no errors


 
Vladimir Karputov thank you for this robot. I have been testing it and suits my trading strategy. However, I have noticed that the default lot size is 0.1 - when I change it to 0.01 or 0.001 to suit my accounts, the robot does not take trades. Have gone into the code and cannot not find how to make the lot size 0.001. Can you please point me in the right direction as to how I can change the minimum lot size to 0.001 - I have been learning but am not yet very fluent in Mql5, so if you can direct me to the right lines I will greatly appreciate it - again thank you for sharing. 
Vladimir Karputov
Vladimir Karputov
  • 2021.09.27
  • www.mql5.com
Trader's profile
 
Ishe Pangidzayi # :
Vladimir Karputov thank you for this robot. I have been testing it and suits my trading strategy . However, I have noticed that the default lot size is 0.1 - when I change it to 0.01 or 0.001 to suit my accounts, the robot does not take trades. Have gone into the code and cannot not find how to make the lot size 0.001. Can you please point me in the right direction as to how I can change the minimum lot size to 0.001 - I have been learning but am not yet very fluent in Mql5, so if you can direct me to the right lines I will greatly appreciate it - again thank you for sharing. 

You confused something - I'm not the author. Look carefully:

 
Vladimir Karputov #:

You confused something - I'm not the author. Look carefully:

Thanks 
 
Andrey Barinov thank you for this robot. I have been testing it and suits my trading strategy . However, I have noticed that the default lot size is 0.1 - when I change it to 0.01 or 0.001 to suit my accounts - even in the MQL5 Editor, the robot does not take trades. Have gone into the code and cannot not find how to make the lot size 0.001. Can you please point me in the right direction as to how I can change the minimum lot size to 0.001 - I have been learning but am not yet very fluent in Mql5, so if you can direct me to the right lines to change the lot size I will greatly appreciate it - again thank you for sharing. 
Comparative Analysis of 10 Trend Strategies
Comparative Analysis of 10 Trend Strategies
  • www.mql5.com
The article provides a brief overview of ten trend following strategies, as well as their testing results and comparative analysis. Based on the obtained results, we draw a general conclusion about the appropriateness, advantages and disadvantages of trend following trading.
 
Great
Reason: