EA to trade multiple time frames of same pair

Back to topics list To post a new topic, please log in or register
avatar
120
DeanDeV 2015.06.16 11: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! 

 

avatar
76
Paul_B 2015.06.16 14: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

 

avatar
120
DeanDeV 2015.06.16 16: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! 

avatar
13006
WHRoeder 2015.06.16 18:34 #
 
DeanDeV: Would this simply work (for example):
yes

Back to topics list  

To add comments, please log in or register