void OnDeinit(const int reason)
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time,
const double &open,
const double &high,
const double &low,
const double &close,
const long &tick_volume,
const long &volume,
const int &spread)
Comment(StringFormat("Server time: %s\nLocal time: %s\nIs connected: %s",
If you read OP's code carefully you'll realize I was right. There is ">" not ">="
Change nothing. We are talking about an additional delay due to the wrong usage of Minute() function. Minute() returns a value between 0 and 59, so the (additional) delay is between 0 and 59.
nicholishen is right on this one. If you want precision using a timer you need to use local time.
TimeCurrent() is updated (or not) on any symbol in the Market Watch. You can never know in this code if there is only current symbol or 100 symbols available to update TimeCurrent. A timer can run without any new tick, so TimeCurrent() can lag behind.
You can never know in this code if there is only current symbol or 100 symbols available to update TimeCurrent.
I absolutely agree with this but in my case I don't have to care about it (my TimeCurrent() runs really fluently)
But you should care about local time change by user. :-p It was only a joke ;-)
Just removed the Minute() .. Works like magic.
Thank You very much :-)
Why do you add the Minute()? You should use this condition:
But it isn't much reliable way to delete pending order. Why don't you use parameter "expiration" in the OrderSend function? If you need to use it this way you should check it in OnTimer instead of OnTick because of "lazy" Symbols.
Thank you for your help... But I run this program on EU during opening and close hours. So I am getting a tick easily in under 10 seconds.
However I will try to use a function which doesn't trigger on a tick.
Thank you once again