Here is two code examples. The only difference is a GetExternalSymbol(true) call.
CODE:
Please log in to see this code.
CODE:
Please log in to see this code.
Running these code in streaming window under 1-minute SPY symbol, I get the results below.
[CODE #1]
.VIX
.VIX
[CODE #2]
.VIX
SPY
If I set false to GetExternalSymbol in [CODE #1], I get the same result as [CODE #2].
Looks like an issue in the context switching.
Size:
Color:
Another variant.
CODE:
Please log in to see this code.
And the result is the same as [CODE #1].
[CODE #3]
.VIX
.VIX
It looks to me if the followings are happening inside WLP synchronization logic:
- GetExternalSymbol(true) sets an internal synchronization state to true.
- The next SetContext(false) ignores the false parameter and enables synchronization.
- SetScaleDaily switches back to primary symbol unless the context is synchronized.
Size:
Color:
Thanks for the analysis. We will have to look into this more closely.
That said, I disagree with your observation that SetContext() ignores the synch parameter. As long as you do not use fixed bars, just check Bars.Count before and after SetContext(). When false, the number of bars will be different before and after, but when true the count is the same.
Size:
Color:
Yes, you are correct regarding SetContext() ignoring the synch parameter.
It looks like to me if SetScaleDaily() is doing something wrong.
SetScaleDaily() seems enabling the synch all the time regardless of the synch parameter to SetContext().
Also SetScaleDaily() seems switching back to the primary symbol if nether GetExternalSymbol() nor SetContext() has synch enabled.
Size:
Color:
Here`s what a little bird told me.
kazuna is right, SetScaleDaily is enabling the synch all the time - though not by itself but by virtue of calling RestoreScale before anything else is done in the code.
Size:
Color:
Now I got to figure out how to mimic longer daily external symbol into shorter intraday primary symbol.
Size:
Color:
Making no promises (untested), but you could try replacing SetScaleDaily with this method from Community Components for this purpose:
GetAllDataForSymbol
Size:
Color:
Thanks Eugene! GetAllDataForSymbol works great!
I wonder why it is not included in WLP by default.
By the way I have a question about GetAllDataForSymbol.
What is different than using SetContext(false)/SetScale*() combo?
What does GetAllDataForSymbol do with the bars that are not updated to the datasets (e.g. intraday bars when on-deman update is disabled)?
Size:
Color:
Another way to get a Daily series into an intraday chart is by accessing the symbol by specifying its daily DataSet with synch false. After that, synch it to the intraday chart. For example:
CODE:
Please log in to see this code.
Size:
Color:
Thanks Cone. GetExternalSymbol with daily DataSet works great as well.
Which one would you recommend? GetAllDataForSymbol or GetExternalSymbol?
I am particularly concerned with GetExternalSymbol due to the exception issue while updating the chart in the streaming window.
Is the exception also applicable to GetAllDataForSymbol?
Or is the exception only applicable to the external symbol in intraday DataSet?
This is related to the question to Eugene in my #8 post.
Size:
Color:
GetAllDataForSymbol is a wrapper for Wealth-Lab`s core method for loading an external symbol`s data (internal and therefore unsupported).
Size:
Color:
So GetExternalSymbol and GetAllDataForSymbol use the same internal method for loading an external symbol.
Therefore, an issue with GetExternalSymbol is applicable to GetAllDataForSymbol as well.
Correct?
Size:
Color:
No, they don`t share the same internal method. It`s my speculation but GetAllDataForSymbol is based on a different method used primarily for charting.
Size:
Color:
GetAllDataForSymbol also has the same exception issue as GetExternalSymbol.
According to Cone, this is by design and in order to prevent a crash while updating the chart.
CODE:
Please log in to see this code.
CODE:
Please log in to see this code.
Size:
Color: