Section 6.1 of the Wealthscript Programming Guide shows 2 ways to access DataSeries:
METHOD 1: SMA sma = new SMA(Close, 50, "50-day SMA");
METHOD 2: DataSeries sma2 = SMA.Series(Close, 20);
The Guide says that Method 1 is preferred. However, it seems that it sometimes works and sometimes does not. For example:
This does NOT work: ADX adx = new ADX(Bars, adxPeriod);
But this DOES work: DataSeries adx = ADX.Series(Bars, adxPeriod);
When should we use Method 1 vs Method 2?
Also, when accessing all of the indicators I have used thus far, based on Closing price, I pass the Close object:
RSI rsi = new RSI(Close, RSIperiod, "RSI");
But for ADX, this does not work; ADX seems to only work when being pass the Bars object, but I thought we needed to specify, Open, Close, etc. Why is this?
Thanks!
Ron
Size:
Color:
Re: Method1
As indicated on its online help page, the ADX does not have a constructor, so you just have to use the Series method:
http://www2.wealth-lab.com/WL5WIKI/ADX.ashxWhen an indicator provides the two methods, it is mostly a question of preference whether to use the constructor or the Series method. Please check the Wiki as the guide to determine if the "new" constructor (aka Method1) is available or not.
Re: ADX and Close
Well, it simply means that the indicator which accepts the Bars parameter will use its Bars.High, Bars.Low etc. properties according to its internal logic. The ADX can not be applied to Close by design.
Size:
Color: