static datetime NextAlert = 0; if(TimeCurrent() >= NextAlert && ... // logic to trigger alert { Alert(....); NextAlert=TimeCurrent()+3; }
or
void OnTimer() { Alert(....); } void OnTick() { if(.... // logic to trigger alert { EventSetTimer(3); OnTimer(); } else { EventKillTimer(); }
#property copyright "tester" #property link "tester@test" #property indicator_chart_window extern double SoundWhenPriceGoesAbove = 0; extern double SoundWhenPriceGoesBelow = 0; int init() if (SoundWhenPriceGoesAbove > 0) { ObjectCreate("SoundWhenPriceGoesAbove", OBJ_HLINE, 0, Time[0], SoundWhenPriceGoesAbove); ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_COLOR, Magenta); ObjectSet("SoundWhenPriceGoesAbove", OBJPROP_WIDTH, 1); } if (SoundWhenPriceGoesBelow > 0) { ObjectCreate("SoundWhenPriceGoesBelow", OBJ_HLINE, 0, Time[0], SoundWhenPriceGoesBelow); ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_STYLE, STYLE_SOLID); ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_COLOR, Magenta); ObjectSet("SoundWhenPriceGoesBelow", OBJPROP_WIDTH, 1); } return(0); } int deinit() { ObjectDelete("SoundWhenPriceGoesAbove"); ObjectDelete("SoundWhenPriceGoesBelow"); return(0); } int start() { if (ObjectGet("SoundWhenPriceGoesAbove", 1) != SoundWhenPriceGoesAbove) SoundWhenPriceGoesAbove = ObjectGet("SoundWhenPriceGoesAbove", 1); if (ObjectGet("SoundWhenPriceGoesBelow", 1) != SoundWhenPriceGoesBelow) SoundWhenPriceGoesBelow = ObjectGet("SoundWhenPriceGoesBelow", 1); if ((Bid > SoundWhenPriceGoesAbove) && (SoundWhenPriceGoesAbove > 0)) { PlaySound("alert.wav"); Sleep(1000); } if ((Bid < SoundWhenPriceGoesBelow) && (SoundWhenPriceGoesBelow > 0)) { PlaySound("alert.wav"); Sleep(1000); } return(0); }
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
Dear Friends and Traders.. I've doubt in my Price alert indicator. It alerts on every incoming tick.. but i like to get alert on every 3 seconds..
the every incoming tick alert is annoying. Please guide me..