SetScaleDaily in DataSet
Author: Shaaker
Creation Date: 4/19/2010 9:11 PM
profile picture

Shaaker

#1
I run the following script on a small dataset with 1min scale, but it only works if the Object b is synchronized. Otherwise as Debug content shows data is still in 1min scale. Why Synch is needed here? Shouldn't GetExternalSymbol do the job? Thanks.

CODE:
Please log in to see this code.


Debug window: ( if not synchronized)
AA 4/16/2010 3:59:00 PM
EMC 4/16/2010 3:59:00 PM
HPQ 4/16/2010 3:59:00 PM
IBM 4/16/2010 3:59:00 PM

Data range: 2/4/2010 to 4/16/2010
profile picture

Eugene

#2
Move Bars b... under SetScaleDaily() and eliminate the call to Synchronize.

It happens because the Bars object is being created in original (intraday) bar scale, but by wrapping it with SetScale/RestoreScale, you're creating a scaled Daily Bars object.
profile picture

Shaaker

#3
Eugene,

I understand your first point about fixing the problem, but am not quite sure about the reasoning. I was exactly expecting that wrapping with SetScale/RestoreScale would create a daily bars object (regardless of its original scale), so now that it is in daily scale calling b.Count-1 should refer to the day before not the minute before. right?

Thanks
profile picture

Eugene

#4
Yes, creating a daily Bars object is what would have happened if you would do it after changing the scale first with SetScaleDaily(). Otherwise, it's created in the original scale. You defined the "b" object before wrapping it with SetScale/RestoreScale, that's why b.Count-1 refers to the minute scale.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).