Download MetaTrader 5
To add comments, please log in or register
Do you have a trading signal? Publish it in your blog as well!
JB
7
JB 2015.02.13 01:06 

I have this custom indicator that creates an alert / push notification when CCI crosses either -100 or 100. 

The problem is it keeps going off every time it bounces around the 100 mark...very annoying.

I wanted to try and add a delay something like this to the attached indicator:

bool AlertDelay() {
   static datetime last_time;
   if (TimeCurrent()-last_time<30) {    // delay for 30 seconds
      return(false);
   } else {
      last_time=TimeCurrent();
      return(true);
   }
}

And then simply check AlertDelay()'s return before using Alert() like so:

if (AlertDelay()) Alert("Whatever...");

 

Will that work?  How do I add it to this indicator?

Files:
/
To add comments, please log in or register