GetExternalSymbol from Extension
Author: sf631
Creation Date: 8/16/2011 4:59 PM
profile picture

sf631

#1
I am trying to create some indicators in my custom indicator library DLL that make use of methods in the WealthScript class (specifically GetExternalData). Is this not possible for some reason? If it's possible, can you describe how to call from within VS? Any specific references needed besides WealthLab?

If not possible, are there other straightforward ways to access other symbols within a compiled indicator?
profile picture

Eugene

#2
QUOTE:
Is this not possible for some reason?

Unless a class inherits WealthScript (which is not the case with DataSeries or IndexDefinitions).
QUOTE:
If not possible, are there other straightforward ways to access other symbols within a compiled indicator?

There are no straightforward ways.
profile picture

sf631

#3
OK, how about convoluted ways?

What I'm looking to build is an indicator that approximates intrinsic value for any charted Bars object, based on price changes in one or more underlying symbols (for instance, use the XLF as a way to approximate underlying value of GS).

Could I pass in multiple Bars or DataSeries objects to an indicator, or is it restricted to just one? If that's allowable, I can specify the several symbols needed and have the indicator do the computation




profile picture

Eugene

#4
What you can't do (at least w/o convolutions) is specifying an arbitrary Bars object when creating a formal indicator suitable for drag-n-drop indicator creation. In other words, only the primary Bars object being charted is available to "formal" Indicators. (If you plot an external symbol then it also becomes available to your indicator's GUI dialog but that's a cumbersome workaround).

But if you're not concerned about being able to specify an external symbol while applying your formal indicator via drag and drop, then it all becomes pretty easy - no convolutions at all. Just pass as much Bars objects as the indicator's parameters as your formula requires it to have.

See the Beta code in Community.Indicators for an example (open source project in the Wealth-Lab Wiki). Try to apply the Beta using drag and drop, notice how the primary Bars object appears in the "Bars" and "Index" fields. However, in code-based strategies you can pass any two arbitrary Bars objects to the indicator. So will be in your indicator, too.
profile picture

sf631

#5
Thanks Eugene, quite helpful and I can live without the Drag & Drop capability. I've got source code for Community Indicators so I'll look at Beta as an example. This does, however, mean that I can't build a custom Index that makes use of the indicator, correct? I had wanted to compute overbought/oversold measures across baskets of symbols, but that would not be possible if I understand you.

One related question for the same indicator: any Community.Indicators or other code samples you'd recommend I look at for examples of how to access a dictionary or other table where I can specify that Symbol X is driven yy% by Sym_Y and zz% by Sym_Z? I'd then have my WealthScript reference the dictionary to determine which Bars objects were needed for each of the parameters.
profile picture

Eugene

#6
QUOTE:
I had wanted to compute overbought/oversold measures across baskets of symbols,

Index Manager is at your service: the Aggregate indicator and the new IndexDefinition "Stocks above/below an Indicator value".
profile picture

sf631

#7
OK, but if my definition of overbought/oversold is based on a custom indicator that requires external symbol data where I'll need to pass the bars objects into the indicator from within wealthscript, can I use that indicator as part of an index?

For example, I want to have symbols A B and C in an index where each is compared to recent movement vs. X, Y, and Z, and have the +3%, +1%, and +5% result in an index value of +9%/3 = +3%, can that be done? How would I specify that X matches with A, Y matches with B, and Z matches with C?
profile picture

sf631

#8
PS - I love where you're going with the IndexManager...
profile picture

Eugene

#9
Only unsupported hacks might give you external symbol access in IndexDefinitions (like via System.Reflection or direct file access). It's not in the API.
profile picture

Eugene

#10
QUOTE:
PS - I love where you're going with the IndexManager...

We're just getting started :)
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).