Play videoPlease edit your post.
For large amounts of code, attach it.
datetime b= D'13:59:00'; datetime a= D'13:59:30';
These are 1:59 PM of the date you compiled the code. Don't expect more than two alerts ever.#define HR2400 (PERIOD_D1 * 60) // 86400 = 24 * 3600 int TimeOfDay(datetime when=0){ if(when == 0) when = TimeCurrent(); return( when % HR2400 ); } datetime DateOfDay(datetime when=0){ if(when == 0) when = TimeCurrent(); return( when - TimeOfDay(when) ); } datetime Tomorrow( datetime when=0){ if(when == 0) when = TimeCurrent(); return(DateOfDay(when) + HR2400); } //datetime Yesterday(datetime when=0){ if(when == 0) when = TimeCurrent(); // int iD1 = iBarShift(NULL, PERIOD_D1, DateOfDay(when) - 1); // return( iTime(NULL, PERIOD_D1, iD1) ); } OnIinit(){ #define HR1359 49800 // (13*60+59)*60 a = Tomorrow() + HR1359; // 13:59:00 b = a + 30; // 13:59:30
if( a == TimeCurrent())
This matches only if a tick occurred on the exact second. One second later - no alert. Multiple ticks that second, multiple alerts.- redwind: can some one help on that, how to make it give only one alert each time.
if( a != 0 && a <= TimeCurrent()){ Alert(bcd); a = 0; // Suppress additional alerts
if(a <= TimeCurrent()){ Alert(bcd); #define HR2400 86400 // 24 * 60 * 60 a += HR2400; // Next alert is tomorrow
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
Hi all,
This is the simple program i write, but it will give more than one alert in one time.
can some one help on that, how to make it give only one alert each time.
Thank you
datetime TimeCurrent();
datetime b= D'13:59:00';
datetime a= D'13:59:30';
int abc =1;
int bcd =2;
int start() // Special function start()
{
if( b == TimeCurrent()&&j<1)
{
Alert(abc);
}
if( a == TimeCurrent())
{
Alert(bcd);
}
return; // Exit start()
}