Although this has solved the problem, I'm still not clear why this is necessary.
Can someone give me some more detailed explanation why you need the 'sync' when dealing with data series and multi-time frame? Also, what is the best way to do this sync without adding a useless calculation (in this case an SMA not very 'heavy' but still I hate to waste CPU cycles...).
Thanks,
Dori
[FONT=Courier New][SIZE=3][FONT=Courier New][SIZE=3][/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000][SIZE=1]/* Only need to sync DataSeries objects once. We couldn't do this sync in the Initialize() method because we[/SIZE] [SIZE=1]cannot access the BarsArray property there. */[/SIZE] [/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New][/FONT][/FONT][SIZE=1][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]if[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New] (secondarySeries == [/FONT][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]null[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][/SIZE][FONT=Courier New][FONT=Courier New][SIZE=1])[/SIZE] [SIZE=1]{[/SIZE] [/FONT][/FONT][FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000][SIZE=1]/* Syncs another DataSeries object to the secondary bar object.[/SIZE] [SIZE=1]We use an arbitrary indicator overloaded with an IDataSeries input to achieve the sync.[/SIZE] [SIZE=1]The indicator can be any indicator. The DataSeries will be synced to whatever the[/SIZE] [SIZE=1]BarsArray[] is provided.*/[/SIZE] [/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New][SIZE=1]secondarySeries = [/SIZE][/FONT][/FONT][SIZE=1][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]new[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New] DataSeries(SMA(BarsArray[[/FONT][/FONT][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080]1[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New]], [/FONT][/FONT][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080][FONT=Courier New][COLOR=#800080]50[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][/SIZE][FONT=Courier New][SIZE=3][FONT=Courier New][SIZE=3][SIZE=1]));[/SIZE] [SIZE=1]}[/SIZE] [/SIZE][/FONT][/SIZE][/FONT]
Comment