ClearExternalSymbols not clearing?
Author: Eugene
Creation Date: 6/22/2012 7:23 AM
profile picture

Eugene

#1
streak writes:

Hello

I am having what seems to be thye same problem of not seeing the cache cleared. Or at least it appears like that. I too had a method outside the Execute() block that worked a dataseries. After moving it inside the problem peresists, so maybe its something else?

Appreciate very much if this code could be checked to see if ClearExternalSymbols() is operating how it should, please? The clicked symbol is a continuous contract. The code selects various individual contracts from another dataset to collate into a seasonal array from which to load a dataseries/indicator. The seasonal is detrended from a SMA off the clicked symbol (to get enough history).

Also, when I put a string within the ClearExternalSymbols() parenthesis an error is thrown. What makes this overload(?) function?
CODE:
Please log in to see this code.
profile picture

Eugene

#2
If possible, please create an "as-small-as-possible" code without all this custom logic demonstrating the anomaly. tia.
QUOTE:
Also, when I put a string within the ClearExternalSymbols() parenthesis an error is thrown.

Could you elaborate on the exact error message and the string?
QUOTE:
What makes this overload(?) function?

It's documented in the QuickRef.
profile picture

streak

#3
Eugene
No overload for method 'ClearExternalSymbols' takes '1' arguments

QuickRef shows an overload:
QUOTE:
int ClearExternalSymbols(string symbol)


When
CODE:
Please log in to see this code.
is put within, at end of the
CODE:
Please log in to see this code.
block each run passes 0 (zero) cleared symbols.

My main problem/query is not the so much re ClearExternalSymbols(). I just suspected this, or my use of it, to be a culprit, which is when I change settings by clicking another symbol, or changing the range of contract years or contract months the seasonal is derived from the dataseries/indicator 'seas' does not change.

I realised that for many of the changes in the script parameters listed above the same set of individual contracts are called. However, the detrending series utilised would at least be different and so the plot should change. Only closing & reopening WealthLab seems to alter the plot.

Sorry re the excess data presented. Was just circumventing an expected request for more.

Thanks
Jon


profile picture

streak

#4
Eugene

is the following code 'shelled out' enough. Be greatly appreciated if you can see why the 'seas' indicator is not rebuilding when parameters of new symbols are clicked.

CODE:
Please log in to see this code.
profile picture

Eugene

#5
I'm at a loss as to why are you calling GetExternalSymbol/ClearExternalSymbols. It would pretty straighforward to populate the Bars object this way:
CODE:
Please log in to see this code.

Try this instead. Also, to be on the safe side create the "seas" and "dsBasisDetrend" DataSeries from scratch (using the "new" vs. Close-Close).
profile picture

streak

#6
Eugene
Tried both variations you mentioned, but still no headway.

The only reason I used GetExternalSymbol() was because I did not know there was an alternative. With the code above replacing
CODE:
Please log in to see this code.
an error is thrown;
QUOTE:
Object reference not set to an instance of an object


Had already swapped building the indicators from 'new', without success. Just tried both ways again with your code, but no change. Also changed _ds, creating from scratch using 'new' but no help.

In checking I'd put your code in correctly I noticed the first parameter for .ContainsSymbol() requires a string and after swapping _contract for symbol and back again (it didn't solve the problem) a different error was thrown;
QUOTE:
... best overlaod match for... ContainsSymbol(...) has some invalid arguments
and another error saying mach the same;
QUOTE:
... cannot convert from...Bars to string
.

Its an odd one. Must have good quality RAM.
just kidding

Thanks for your help.
profile picture

Eugene

#7
QUOTE:
an error is thrown;
[QUOTE]Object reference not set to an instance of an object
[/QUOTE]
The active data provider must be ASCII (or any other provider for that matter that doesn't use Wealth-Lab's BarDataStore)? If true, this would fully explain the error. Provider.DataStore is N/A to ASCII.
profile picture

streak

#8
Ah, it is ascii!

Is Provider.DataStore also N/A to Cached ASCII? (I'm not familiar with the name/concept/functioning of 'BarDataStore'). I guess so - otherwise one would expect the error not to be thrown?

If this means the syntax goes back to ClearExternalSymbols(), is there a means of forcing the dataseries/indicators to be recalculated and plotted when a different symbol is clicked or parameter changed?

Thanks Eugene
profile picture

Eugene

#9
Jon, but your "shelled out" example is much more complicated to read. Sorry for not being clear. What I expect is a concise example with all the custom logic stripped. In other words, getting back to your initial question: if you believe that ClearExternalSymbols is not performing as expected, preparing a simple and short test case would be appreciated.
profile picture

streak

#10
Eugene
Apologies, I'm not understanding 2 things :-
1# "... a concise example with all the custom logic stripped"
2# "... a simple and short test case"

Would you be able to give a little more detail re each, please? I look forward to putting the right stuff together.

Thanks
profile picture

Eugene

#11
It simply means that to troubleshoot a potential ClearExternalSymbols issue, I'd prefer an as-simple-as-possible, clickable demo Strategy. I don't have the time to go through custom logic.
profile picture

streak

#12
Eugene
the data layout has continuous contracts in one folder and individual contracts in separate folders with each folder only holding contracts for a single commodity. So when a continuous contract is clicked it loops each contract in the folder associated with the first parameter slider and only deals with contracts that match the required month per the second parameter slider. The required month is tested from the file name at the start of the foreach() block.

When changing settings the seasonal indicator does not update when, for example, when loading feeder cattle individual contracts (slider1 position2) and clicking Gold as the primary symbol then clicking NaturalGas. The SMA used as basis for the detrend should vary considerably enough between these to alter the seasonal output.

I do have a few other bugs in my code. For example with FeederCattle seasonals the mid-year contracts make things go haywire. However, I'm finding it hard to debug these until I can get the seasonal refreshing every time rather than have to reboot Wealth-Lab.

CODE:
Please log in to see this code.


Thanks, I hope you have some appropriate data to test on.
profile picture

streak

#13
a bug fix: The code below replaces the do{ }while() block that assigns dsDetrendBasis for each contract (just before the DataSeries 'mom' is assigned.
CODE:
Please log in to see this code.


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).