I want to use the community indicator Beta to calculate the beta of a pair stock ratio to SPX. Below is the code. Error msg is " the best overloaded method mathc for 'community.indicators.beata.series(Wealthlab.bars, wealthlab.bars, int)' has some invalid arguments." Beta indicator only accepts Bars Object for its first argument. Is there any way to work around it? Thanks a lot.
CODE:
Please log in to see this code.
Size:
Color:
Beta accepts 2
Bars objects as parameters, not DataSeries.
CODE:
Please log in to see this code.
Size:
Color:
When calculating Beta, we only need close prices of broad market and single stock(or pair ratio in my case). Why do the first two parameters have to be Bars Objects?
Is there any other way to calculate Beta of Pair Ratio to SPX when Ratio is a DataSeries or make the Ratio as Bar Objects?
Thanks.
Size:
Color:
QUOTE:
Why do the first two parameters have to be Bars Objects?
Long story short, workaround for a limitation i.e. inability to call GetExternalSymbol outside of a WealthScript Strategy.
Fortunately, the workaround for a formal Indicator is obvious, but for (say) IndexDefinition - nowhere near as easy. So just use the code suggested above, please be assured that we know the Beta formula! :)
Size:
Color:
Eugene,
Thanks for your reply.
Do you have a quick solution to calcualte beta of Top/Bottom(unfortunately, not a Bar object) to SPX Close withouting coding the function?
Size:
Color:
No, coding the function is necessary. You may take the Beta.cs class from Community Indicators source code and:
1) Either replace the 1st Bars parameter with a DataSeries (and consequently apply whatever changes further down the code + IndicatorHelper it may take)
2) Or modify the source code to have this custom Beta coded as on-the-fly indicator, i.e. one that exists in your Strategy only.
Size:
Color: