When I launch / reboot platform v4.00 build 1090
indicator doesn't work porperly because OrdersTotal() returns 0 even if the are orders open and pending.
when I open 'Indicators List' and then close it then OrdersTotal() (and indicator) starts to work / display correct values.
The indicator I am talking about is '0 - Open Positions v3a'.
The proof that it is about OrdersTotal() is that I created new indicator with adding 'Print("TEST_total: ", OrdersTotal()); in OnCalculate function and it prints 0 after reboot.
Is there a way to workaround it and not to have a need of opening 'Indicators List' each time platform is restarted?
hah! of course! it is Saturday today :) so no ticks coming and I tried with broker offering BTC and it dispalys correctly once tick arrives. thanks!
However, is it a bug or is it intended that OrdersTotal() returns 0 first when no tick arrived yet? (but OnCalculate() executes regularly) If intended (to for example block analysis of orders with potentially old orders data???) than why OrdersTotal() works ok when indicator is reinitialized or reconfigured or even just listed in indicators list (still on Saturday without ticks)? The problem exists after platform reboot only.
Regarding your workaround, I was thinking about it how to implement - OnTick() is not available for indicator. Then.. was it perhaps iVolume() you had in mind or something even better?
ok, solved. onCalculate() for indicators is like onTick() for EA.
On Saturday there is no tick often so onCalculate() wouldn't be called (except initial 6? times after reboot when OrdersTotal() is not ready), but timer should solve the problem. After 15 seconds OrdersTotal() returns non 0 value.
thanks! :) :)