Download MetaTrader 5

Time condition for an indicator

To add comments, please log in or register
bugati1989
11
bugati1989  
Hi everyone,
Can someone help me to write a condition for an indicator to send alerts only if the candle's open time is less than 59 seconds for M5?
Thank you in advance!
Alain Verleyen
Moderator
33359
Alain Verleyen  
bugati1989:
Hi everyone,
Can someone help me to write a condition for an indicator to send alerts only if the candle's open time is less than 59 seconds for M5?
Thank you in advance!
if(TimeCurrent()<Time[0]+59)
  {
    Alert("...");
  }
bugati1989
11
bugati1989  
Alain Verleyen:
if(TimeCurrent()<Time[0]+59)
  {
    Alert("...");
  }

Very helpful. Thank you so much Alain!
Fernando Carreiro
2911
Fernando Carreiro  
whroeder1:
  1. If you want an answer for MT5, the above code won't work as there are no predefines.
  2. If you want an answer for MT5, why did you post in the MT4 forum?
I think the OP meant by M5 exactly that (5 min chart) and not MT5, but I could be wrong!
whroeder1
15934
whroeder1  
Fernando Carreiro: I think the OP meant by M5 exactly that (5 min chart) and not MT5, but I could be wrong!
That is more likely - need more coffee :)
bugati1989
11
bugati1989  
Thank you guys, I have fixed this.
To add comments, please log in or register