EA to trade multiple time frames of same pair

 

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! 

 

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
 
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! 

 
DeanDeV: Would this simply work (for example):
yes
Reason: