Hi,
Could somebody point out how to create chain of indicators based on another indicator with more than one level of hierarchy?
1. I want to create indicator that shows deviation between correlated stocks
2. For this I create 4 movings averages, Slow and Fast MA for the stock #1 and Slow and Fast MA for the stock #2
DoubleExponentialMovingAverage iFma1 = DEMA(iSymbol1, iPeriodFast, Resolution.Hour);
DoubleExponentialMovingAverage iSma1 = DEMA(iSymbol1, iPeriodSlow, Resolution.Hour);
DoubleExponentialMovingAverage iFma2 = DEMA(iSymbol2, iPeriodFast, Resolution.Hour);
DoubleExponentialMovingAverage iSma2 = DEMA(iSymbol2, iPeriodSlow, Resolution.Hour);
3. Then I create Composite Indicator for each stock by subtracting FMA from SMA, now I have de-trended oscillators for each stock
CompositeIndicator<IndicatorDataPoint> iOsc1 = iSma1.Minus(iFma1);
CompositeIndicator<IndicatorDataPoint> iOsc2 = iSma2.Minus(iFma2);
4. Now I want deviation to be calculated based on the difference between these oscillators
var deviation = new StandardDeviation(15);
iDev = deviation.Of(iOsc2.Minus(iOsc1));
This is where I get an error Cannot implicitly convert from StandardDeviation to CompositeIndicator<IndicatorDataPoint>
Any thoughts?
Alexandre Catarino
The return type of extension method Of is the same type of the object.
In this particular case, since deviation is an instance of StandardDeviation, so iDev should be.
CompositeIndicator<IndicatorDataPoint> iDev; // Wrong StandardDeviation iDev; // Right
Artemiusgreat
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!