Alert Only if New bar in Specific period while I'm viewing the chart in other period.

Back to topics list To post a new topic, please log in or register
avatar
87
FxTrader_ 2016.01.24 20: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?


avatar
735
honest_knave 2016.01.24 21:22 #
 
static datetime LastH4Bar=0;
datetime ThisH4Bar=iTime(NULL,PERIOD_H4,0);
if(LastH4Bar!=ThisH4Bar)
  {
   // code to run on new H4 bar
   LastH4Bar=ThisH4Bar;
  }

 

avatar
87
FxTrader_ 2016.01.24 21:33 #
 

Hi honest knave,

Thank you very much.


Back to topics list  

To add comments, please log in or register