This is so simple I'm embarassed to post it.
Anyway, see the attached. All it does is gives an alert when the number of open orders changes.
It works perfectly when attached to a chart.
But, when you start up the platform with it still attached from prior to shutting down, it always gives an alert. Here's what's happening:
The first time through, the command total = OrdersTotal() is not executed, so total = 0, number = 0, oldnumber = 0, there's no alert, and the "firsttime" boolean gets set to false.
The second time through it executes normally, so the open orders get counted, "number" gets incremented, but "oldnumber" does not get updated until after the alert.
Not a big deal, but I'd like it to work right, and moreso, would like to know why execution is different if you attach an indicator vs. booting up with it already attached.
Anyway, see the attached. All it does is gives an alert when the number of open orders changes.
It works perfectly when attached to a chart.
But, when you start up the platform with it still attached from prior to shutting down, it always gives an alert. Here's what's happening:
The first time through, the command total = OrdersTotal() is not executed, so total = 0, number = 0, oldnumber = 0, there's no alert, and the "firsttime" boolean gets set to false.
The second time through it executes normally, so the open orders get counted, "number" gets incremented, but "oldnumber" does not get updated until after the alert.
Not a big deal, but I'd like it to work right, and moreso, would like to know why execution is different if you attach an indicator vs. booting up with it already attached.
Attached File(s)
Status Change.mq4
2 KB
|
476 downloads
|
Uploaded Mar 7, 2008 2:10pm