Download MetaTrader 5
To add comments, please log in or register
Are you accustomed to using the standard library? MQL5 has one!
fxtrader_
247
fxtrader_ 2016.01.24 19:04 

Hi all,

I would like to ask if it possible to code this situation:
I have alert indicator for Stochastic Oscillator Cross, The alert it is limit to alert me only If the indicator crossed in the H4 Timeframe. I note that if I'm viewing the chart in the (M5) Timeframe it alert me with every new bar in the (M5) Time frame.

My Question:
Is it possible to setup the alert , to alert only if their is a new bar in (H4) timeframe even if I'm viewing the chart in lower timeframe?

honest_knave
947
honest_knave 2016.01.24 20:22  
static datetime LastH4Bar=0;
datetime ThisH4Bar=iTime(NULL,PERIOD_H4,0);
if(LastH4Bar!=ThisH4Bar)
  {
   // code to run on new H4 bar
   LastH4Bar=ThisH4Bar;
  }
fxtrader_
247
fxtrader_ 2016.01.24 20:33  

Hi honest knave,

Thank you very much.

/
To add comments, please log in or register