You could consider something like this
static bool OB_Alerted=false; static bool OS_Alerted=false; if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought && OB_Alerted==false) { SendMail(Email_Subject+" "+Symbol(), Up_Strength_Msg); OB_Alerted=true; OS_Alerted=false; } else if(RSIBuffer[1]>OverSold && RSIBuffer[0]<=OverSold && OS_Alerted==false) { SendMail(Email_Subject+" "+Symbol(), + Down_Strength_Msg); OS_Alerted=true; OB_Alerted=false; }
You could also store the Bar time of the alert and only alert once per bar
GumRai:
You could also store the Bar time of the alert and only alert once per bar
GumRai:
Thanks GumRai. It works like a charm! This was my first time to modify an indicator. Not a programmer, just using tips found in the forum. Great community.
You could consider something like this
You are alerting on condition | if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought) SendMail(Email_Subject+" "+Symbol(), Up_Strength_Msg); |
Alert on the first change of condition | static bool isBuy=false; bool wasBuy = isBuy; isBuy = RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought; if(!wasBuy && isBuy) SendMail(Email_Subject+" "+Symbol(), Up_Strength_Msg); |

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I modified an indicator to add email alerts. However, when the alert is triggered, it sends me repeated messages. How do I modify the code so that the alert is sent to my phone once?
Here is the code: