Download MetaTrader 5
To add comments, please log in or register
Millions of traders download codes from MQL5 library. Share your app with them!
DeanDeV
330
DeanDeV 2015.06.16 09:31 

Hey guys, 

 I need a bit of help please. I want my EA to check the D1 chart, then the H1 chart and then the M30 chart to send an order. How does one make the EA check those time frames while on the M30. I want to check if the current price is above/ below a MA.

Would this simply work (for example):

if(Ask>iMA(NULL,PERIOD_D1,MA,MAShift,MAMethod,MAAppliedTo,0)
 {
  if(Ask>iMA(NULL,PERIOD_H1,MA,MAShift,MAMethod,MAAppliedTo,0)
   {
    if(Ask>iMA(NULL,0,MA,MAShift,MAMethod,MAAppliedTo,0)
     {
      ORDERSEND
     }
   }
 }

 If this does work, how does one back test it on Strategy Tester.

Thanks! 

Paul B
173
Paul B 2015.06.16 12:57  

That would work and it should backtest in the strategy tester fine.

It may be neater if you structure your commands as follows (just my personal preference):

 

if(Ask>iMA(NULL,PERIOD_D1,MA,MAShift,MAMethod,MAAppliedTo,0) && Ask>iMA(NULL,PERIOD_H1,MA,MAShift,MAMethod,MAAppliedTo,0
      && if(Ask>iMA(NULL,0,MA,MAShift,MAMethod,MAAppliedTo,0)) ORDERSEND
DeanDeV
330
DeanDeV 2015.06.16 14:12  
Paul_B:

That would work and it should backtest in the strategy tester fine.

It may be neater if you structure your commands as follows (just my personal preference):

 

 Hey Paul, thanks for the reply. I have neatened it up a bit. Thanks for the advice. I see  I had not added a required filter to make the trade send properly. 

Thanks! 

whroeder1
13596
whroeder1 2015.06.16 16:34  
DeanDeV: Would this simply work (for example):
yes
/
To add comments, please log in or register