I used the above and it worked. Thanks again for the help!
But there's a small concern. When the alert sends a positive signal, can we skip analyzing the particular symbol on the chart for several candles? Otherwise it sends the same alert again and again at the beginning of each candle. Please help.
rhodium1trading:
can we skip analyzing the particular symbol on the chart for several candles?
the program doesn't understand "several".
code your logic (skip candle etc) in
if(IsNewCandle()) { //---Here comes the function which needs to run only at the beginning of each candle---// }
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.. I want a function to run only once at the beginning of each candle. One told me that the following code will do it in MQL4.
if(IsNewCandle())
{
//---Here comes the function which needs to run only at the beginning of each candle---//
}
bool IsNewCandle()
{
static datetime saved_candle_time;
if(Time[0]==saved_candle_time)
return false;
else
saved_candle_time=Time[0];
return true;
}
Can someone please help me to code the same in MQL5? Thanks!