Problems with latest version
Posted: Thu Oct 10, 2013 8:58 am
I have a problem with one of my indicators and the latest version of MarketScope. It worked fine for the old version.
The indicator overcomes problems of missing gaps, by loading tick data for each session start, so it can determine the correct open/high/low/close.
It's a little bit complex to explain, but basically it uses the getHistory() method to get tick data for the bar containing a "session open" (e.g. new day on DAX CFD). It then extracts the real open/high/low/close from the tick.
Of course, getHistory() is asynchronous, and so the indicator saves the date&time of where it is, so that the updateFrom(period) can be used when returning from the AsyncOperationFinished() method. All was working fine.
However, in the latest version, I find that indicator:update() is called again with period = 0 which seems totally erroneous.
For example, I can see from debug trace that I get something like this...
period = 0, first call
period = 100, loaded tick data for 8/10/13
period = 200, loaded tick data for 9/10/13
period = 300, loaded tick data for 10/10/13
period = 0 <<< where / who called this ?
period = 100, loaded tick data for 8/10/13
period = 200, loaded tick data for 9/10/13
period = 300, loaded tick data for 10/10/13
period = 0 <<< where / who called this ?
...
repeats forever
The AsyncOperationFinished did not ask for the update from period 0 again. It seems the indicator framework did it itself.
I have no idea why update is called again starting from period 0. It causes the current code to start again from the start, and so it ends up in an infinite loop, since as soon as it finishes the whole chart it gets update(0) again !
Any ideas?
Is it something to do with the new "owner drawn indicators"? Maybe you added another call to update() in order to do something?
Thanks.
The indicator overcomes problems of missing gaps, by loading tick data for each session start, so it can determine the correct open/high/low/close.
It's a little bit complex to explain, but basically it uses the getHistory() method to get tick data for the bar containing a "session open" (e.g. new day on DAX CFD). It then extracts the real open/high/low/close from the tick.
Of course, getHistory() is asynchronous, and so the indicator saves the date&time of where it is, so that the updateFrom(period) can be used when returning from the AsyncOperationFinished() method. All was working fine.
However, in the latest version, I find that indicator:update() is called again with period = 0 which seems totally erroneous.
For example, I can see from debug trace that I get something like this...
period = 0, first call
period = 100, loaded tick data for 8/10/13
period = 200, loaded tick data for 9/10/13
period = 300, loaded tick data for 10/10/13
period = 0 <<< where / who called this ?
period = 100, loaded tick data for 8/10/13
period = 200, loaded tick data for 9/10/13
period = 300, loaded tick data for 10/10/13
period = 0 <<< where / who called this ?
...
repeats forever
The AsyncOperationFinished did not ask for the update from period 0 again. It seems the indicator framework did it itself.
I have no idea why update is called again starting from period 0. It causes the current code to start again from the start, and so it ends up in an infinite loop, since as soon as it finishes the whole chart it gets update(0) again !
Any ideas?
Is it something to do with the new "owner drawn indicators"? Maybe you added another call to update() in order to do something?
Thanks.