MA of GetExternalSymbol
Author: techtrader007
Creation Date: 12/29/2010 12:04 PM
profile picture

techtrader007

#1
Annother question I would like to use an external symbol where I can use the
moving average of this symbol

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

Eugene

#2
See the WealthScript Programming Guide > DataSeries > Accessing Secondary Symbols.

The 2nd line is not working because you're passing a Bars object (external) to the indicator (SMA) that accepts a DataSeries as a parameter. Hint: Try "external.Close" instead of "external".
profile picture

cravens

#3
I am running a strategy on an option symbol from QuoteMedia. The only symbol in my dataset is "@XLU 121222C00035000". I am able to do operations on the option with no problem. I added to the strategy the capability to check for being above a 200 day moving average of the underlying asset XLU. I used GetExternalSymbol(underlying, true) and I am able to get the latest close price but I can't compute the 200 day SMA. I always get 0 for the SMA value. I believe I used similar techniques to what is found elsewhere on this site.

Here is my code snippet:
CODE:
Please log in to see this code.

Any insight would be appreciated.

Thanks in advance

Rob
profile picture

Cone

#4
You must not be loading at least 200 bars. Since you're using a 200-bar indicator, you shouldn't be looking at values before 200 bars...

CODE:
Please log in to see this code.
And make sure that you load a minimum of 200 bars.
profile picture

cravens

#5
ok. I just tried that by there is only 100 bars of the option data available so no trades occurred.
That would work if 200 bars of the option history existed.
I have this set to start evaluating my strategy after only 10 bars of the option data exists.

Is there a way to find the 200 SMA of the underlying (XLU) when only 10 bars of the option exists?

Rob
profile picture

Eugene

#6
QUOTE:
Is there a way to find the 200 SMA of the underlying (XLU) when only 10 bars of the option exists?

Yes: use a crystal ball.
profile picture

Eugene

#7
I stumbled onto this thread by chance and noticed that a crystal ball is no longer required when you actually have > 200 bars of historical data but are simply limiting the amount of loaded data on the chart. The picture at the bottom says it all:

Grab Community Components library and use > GetAllDataForSymbol method.
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).