Synchronizing data for a second time changes time scale
Author: bgood
Creation Date: 6/23/2017 12:47 PM
profile picture

bgood

#1
When debugging I ran into a problem where I use Synchronize() on data that had already had Synchronize() applied to it. When applying Synchronize the second time, the scale appears to change to day. This appears to be a defect. What am I missing and how can I workaround this? Here is an example piece of code. Run this on any 5 minute data to observe the Blue line.

CODE:
Please log in to see this code.

profile picture

Eugene

#2
Looks like you're onto something, maybe an issue. Robert, what do you think?

Yes it hurts when you do it but at least you have the choice to not do it. ;) For this reason, Workaround #1 is to define that series explicitly:
CODE:
Please log in to see this code.


Workaround #2. Use undocumented and unsupported method BarScaleConverter.Synchronize:
CODE:
Please log in to see this code.
profile picture

bgood

#3
Of course workaround 1 is not an exactly easy. The demo code is obvious so we can talk about the problem. My real code deals with data that has not been synchronized, but occasionally it is called with a DataSeries that has already been synchronized. I would need to create 2 different methods and track if the series has been Synchronized before.

I think that the second workaround was typed in error. I belief it should read:

CODE:
Please log in to see this code.


When I plot Sync1 and Sync2, I see the same problem.
profile picture

Eugene

#4
Sorry for the typo. My impression was that you sync to Close, not to Sync1 again. Indeed, workaround #2 doesn't work.