So this is what I want to do:
Send a notification to my celphone BUT i only want it to send it maximum once every x time... lets say 1 notification each 12 hours if the condition is true.
Thank you!!!
Well, something like this, (not tested)
int next=0; void sendmsg(){ if(Hour()==next){ int i=next; bool sent=SendNotification(sometext); if(i==0) next=12; if(i==12)next=0; } }
- If the condition is false, you want to reset the timer:
bool condition = …; static datetime lastSend=0; if(!condition) lastSend = 0; datetime now = TimeCurrent(); if (now - lastSend >= 12*3600){ lastSend = now; bool sent=SendNotification(sometext); …}
- Alternatively, act on a change of signal, so you have only one message.
MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum #1
- If the condition is false, you want to reset the timer:
- Alternatively, act on a change of signal, so you have only one message.
MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum #1
Brilliant, tyvm
Brilliant, tyvm
Please use English in the forum.
tyvm is not an English word.
Please use English in the forum.
tyvm is not an English word.
Thank you for the definitions.
However that is not my point.
This is an English language forum so please use proper English.
If you are too lazy to type "Thank you very much" then type "thanks".
Remember that a very large proportion of foum members are not native English speakers and terms such as tyvm are meaningless to them.
- If the condition is false, you want to reset the timer:
- Alternatively, act on a change of signal, so you have only one message.
MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum #1
Is the static variable declared globaly or in the ontick()?
Global Variables - Variables - Language Basics - MQL4 Reference
The scope
of the static variables is the same as the scope of the global
variables: the lifetime of the mql4-program.
Static
Variables - Variables - Language Basics - MQL4 Reference

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So this is what I want to do:
Send a notification to my celphone BUT i only want it to send it maximum once every x time... lets say 1 notification each 12 hours if the condition is true.
Thank you!!!