new to this - How can I stop a new tick event (OnTick) from executing (or get out of it). Tried using if (!TERMINAL_TRADE_ALLOWED) return; but as stated that does not stop the event.
I need to do this as in the event i want to place a trade or report back the error if it fails.
Without allowing trading (while working on my code) if the the EA is attached to the chart the error saying it cannot trade is shown every tick. So I have to remove the EA from the chart
to stop the messages which is rather annoying
If the purpose of this is just to limit some Alert(), then count it.
static int Alarm_1; if (error == true) { if (Alarm_1 <= 3) { Alert ("You have annoying error ",error); Alarm_1 ++; } } else { Alarm_1 = 0; }
- www.mql5.com
Hi, as you are a newbie my suggestion is use Print to debug OnTick code before start to use Alert, because you can check your code without Alert annoying messages. After you reach stability in your code, you can start use Alerts.
Thanks for the 2 suggestions. I will use debug to start and once happy with that then use Alert if I still have problems. Still do not understand why if trade is not allowed events are still activated though, if you know please tell me just to satisfy my curiosity
thanks to those who responded
Thanks for the 2 suggestions. I will use debug to start and once happy with that then use Alert if I still have problems. Still do not understand why if trade is not allowed events are still activated though, if you know please tell me just to satisfy my curiosity
thanks to those who responded
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
new to this - How can I stop a new tick event (OnTick) from executing (or get out of it). Tried using if (!TERMINAL_TRADE_ALLOWED) return; but as stated that does not stop the event.
I need to do this as in the event i want to place a trade or report back the error if it fails.
Without allowing trading (while working on my code) if the the EA is attached to the chart the error saying it cannot trade is shown every tick. So I have to remove the EA from the chart
to stop the messages which is rather annoying