Download MetaTrader 5

SendNotificcation one per Period

To add comments, please log in or register
Marky
27
Marky  

Hi guys,

 I have indicator sending notifications.

 I want to limit sending notifications to one or "n" per Period set on chart. 

Do you have any idea how to limit it?

Thanks for help in advance. 

Simon Gniadkowski
Moderator
18017
Simon Gniadkowski  
marky_74:

Hi guys,

 I have indicator sending notifications.

 I want to limit sending notifications to one or "n" per Period set on chart. 

Do you have any idea how to limit it?

Yes,  use the Search in the top right corner of this page . . .  try once per bar

 mql4 Search 

dombo
5
dombo  
marky_74:

Hi guys,

 I have indicator sending notifications.

 I want to limit sending notifications to one or "n" per Period set on chart. 

Do you have any idea how to limit it?

Thanks for help in advance. 

Hello I have the same issue. After the signal notifications are shooting me. Did you get a solution how to use only the first signal or limit them??
whroeder1
15015
whroeder1  
dombo: Did you get a solution how to use only the first signal or limit them??
angevoyageur: I recommend to all not answer such thing that "use google or use this and you will have found this", it's absolutely not useful. Ignore it.
Ignoring post per https://www.mql5.com/en/forum/155059/page2#1010252
Keith Watford
Moderator
9982
Keith Watford  
dombo:
Hello I have the same issue. After the signal notifications are shooting me. Did you get a solution how to use only the first signal or limit them??

I guess that you did try a search and that is how you found this old post.

It is relatively simple to do depending on how you want notifications limited by using a globally declared variable initially set to 0.

If you only want 1 notification per signal direction

If a buy signal, send notification and set the variable to 1 

If a sell signal, send notification and set the variable to -1 

When the code wants to send notification, check the value of the variable. If it is 1 don't send notifications for a buy signal.  If it is -1 don't send notifications for a sell signal.

 

If you only want 1 notification per bar, make the variable datetime

When sending the notification save the value of Time[0] in the variable

Only send notifications if Time[0]!=the variable. 

To add comments, please log in or register