Is New Bar Functionality Question

To add comments, please log in or register
annarosen4
222
annarosen4  

Hi,


Is there a way to use "if(isNewBar" or some other similar function for a different timeframe than the one your EA is currently running on? For instance: I would like to try allowing my EA to open trades once per minute or once per 5 minutes, but the EA is applied to M15 or M30. 


Thanks!

Anna




 

Marco vd Heijden
Moderator
8176
Marco vd Heijden  
You can use the opening time of any bar so the chart timeframe doesn't really matter.
soubra2003
31846
soubra2003  
Or..
You can try
if (iVolume() <= 0) condition;
whroeder1
17940
whroeder1  
  1. annarosen4: Is there a way to use "if(isNewBar" or some other similar function for a different timeframe

    Of course, Instead of using Time[], use iTime().

  2. Mohammad Soubra: if (iVolume() <= 0) condition;
    For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forum.) Always use time.
    I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
              New candle - MQL4 and MetaTrader 4 - MQL4 programming forum

soubra2003
31846
soubra2003  
whroeder1:
  1. Of course, Instead of using Time[], use iTime().

  2. For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forum.) Always use time.
    I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
              New candle - MQL4 and MetaTrader 4 - MQL4 programming forum

Yes agreed with you
But it was a quick answer 
I am using iTime
To add comments, please log in or register