How to Control SendNotification()

 

Dear Experts,

Can you help me with a code to Control SendNotification() to send Notification only 2 time.


Many Thanks in Advance

 

You can use the example in this article

https://www.mql5.com/en/articles/159

Then you can use the for loop or write two SendNotification() functions

The "New Bar" Event Handler
The "New Bar" Event Handler
  • www.mql5.com
Authors of indicators and experts have always been interested in writing the compact code in terms of execution time. You can approach to this problem from different angles. From this broad topic in this article we will cover the problem, that is seemingly already have been solved: check for a new bar. This is quite a popular way to limit the...
 
Dilchan: Can you help me with a code to Control SendNotification() to send Notification only 2 time.
  1. Why do you want only 2 times? Don't you want a message every signal?

  2. Don't look at a signal. Act on a change of signal.
              MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum #1

  3. Or wait for a new bar and then act.
    For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
    I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
              New candle - MQL4 programming forum
 
William Roeder:
  1. Why do you want only 2 times? Don't you want a message every signal?

  2. Don't look at a signal. Act on a change of signal.
              MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum #1

  3. Or wait for a new bar and then act.

Dear William,

I want notification only for 2 times so that it won't be disturbing factor. and I want 2 time to make sure I get notified in case if I missed first one. waiting for new bar  is not practical for my conditional need.

I am wondering if there would be any coding solution in this requirement!!!

Reason: