Push Notification - On timer

 

Hello Guys

Could you please advise how can i set to send a notification every 4 hours, or as soon as a new candle comes to the chart?

 
mostafa: Could you please advise how can i set to send a notification every 4 hours, or as soon as a new candle comes to the chart?

Identify the new_bar using something as follows.

https://www.mql5.com/en/code/10370

https://www.mql5.com/en/forum/129080

https://www.mql5.com/en/forum/134607

Then use

https://docs.mql4.com/common/SendNotification

 

Hi Ubzen

i have the below part

     int priceposition;
     if(iClose(NULL,PERIOD_H4,0)>TL2)priceposition=7;
     if(iClose(NULL,PERIOD_H4,0)>TL && iClose(NULL,PERIOD_H4,0)<TL2)priceposition=6;
     if(iClose(NULL,PERIOD_H4,0)<TL && iClose(NULL,PERIOD_H4,0)>Secondinline)priceposition=5;     
     if(iClose(NULL,PERIOD_H4,0)<Secondinline && iClose(NULL,PERIOD_H4,0)>Firstinline)priceposition=4;
     if(iClose(NULL,PERIOD_H4,0)<Firstinline && iClose(NULL,PERIOD_H4,0)>LL)priceposition=3;
     if(iClose(NULL,PERIOD_H4,0)<LL && iClose(NULL,PERIOD_H4,0)>LL2)priceposition=2;
     if(iClose(NULL,PERIOD_H4,0)<LL2)priceposition=1;

now i want to send a notification, but i want to send it every X hours, im not sure how can i send notification after X hours ... i can set to send it only once but i dono how can i set it like reminder every X hours.

 SendNotification(Symbol()+ priceposition);
 

u set the timer in the OnInit

int OnInit()
  {
//--- create timer
   EventSetTimer(60 * 60); //1 hour
      
//---
   return(INIT_SUCCEEDED);
  }

& in OnTimer ur Code

void OnTimer()
  {
//---
   
 SendNotification(Symbol()+ priceposition);
  }
 
Thanks :)
Reason: