Download MetaTrader 5
To add comments, please log in or register
Join MQL5 Cloud Network. Millions of traders are waiting for this!
mostafalotfi
185
mostafalotfi 2014.02.20 19:13 

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?

Ubzen
Moderator
5394
Ubzen 2014.02.20 19:23  
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

mostafalotfi
185
mostafalotfi 2014.02.20 19:31  

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);
qjol
3243
qjol 2014.02.20 19:40  

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);
  }
mostafalotfi
185
mostafalotfi 2014.02.20 21:21  
Thanks :)
/
To add comments, please log in or register