I'm trying to use sequential operators using the .Of() method. I haven't been successful using this operator with my own simple custom indicator. Can anybody tell me what mistake I am making?
I'm a little fuzzy on which of the indicators(or is both) that have to be registered, I tried to follow the "DisplacedMovingAverageRibbon.cs" example in the Lean source.
Thanks for any help.
Jared Broad
RegisterIndicator("SPY", returnIndicator, Resolution.Minute, x => x.Value);
This line:sma = _sma.Of ( myCustomIndicator );
takes the output of your custom indicator, and pipes it into the SMA indicator's input. In order for the myCustomIndicator to generate output's it needs to be registered for data updates. You can do this manually if you wish to avoid using the register function.myCustomIndicator.Update( T price );
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.
JordanIlott
JordanIlott
Michael H
// Suppose we want the EMA of the RSI. The RSI is our inner indicator, and the EMA our outter // We'll define them as follows var rsi = new RelativeStrengthIndex(14); var emaOfRsi = new ExponentialMovingAverage(5).Of(rsi); // Now we have our indicators. The emaOfRsi is actually going to be responsible for sending // data to the rsi and then piping that output and sending it to our ema, so we only // want to register the emaOfRsi, since sending data to him will send data to the rsi and ema // as well RegisterIndicator("SPY", emaOfRsi, Resolution.Daily, x => x.Value); // later on we could plot either the rsi or the emaOfRsi
Jared Broad
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.
JordanIlott
JordanIlott
Jared Broad
var sma = SMA("SPY", 3); var rsi = RSI("SPY", 14); var rsiSMA = sma.Of(rsi);
rsiSMA.Value<-OutputEvent<-(IsReady)-sma.Update()<-OutputEvent<-(IsReady)- RSIThe 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.
JordanIlott
Jared Broad
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.
JordanIlott
Michael H
// this configures 'sma' to receive auto updates from SPY data var sma = SMA("SPY", 3); // this configures 'rsi' to receive auto updates from SPY data var rsi = RSI("SPY", 14); // this would also configure 'sma' to receive auto updates from 'rsi' // which we probably don't want to do (multiple data source is almost never a good idea) var rsiSMA = sma.Of(rsi);
Instead we'll define our data source, the root, as 'rsi'// this configures 'rsi' to receive auto updates from SPY data var rsi = RSI("SPY", 14); // this creates a new SMA and configures it to receive auto updates from 'rsi' var rsiSMA = new SimpleMovingAverage(3).Of(rsi); // the new SimpleMovingAverage is returned into rsiSMA // so it's the same as this rsiSMA = new SimpleMovingAverage(3); // since this is purely a configuration step (wires up event handlers) we don't // actually need its return value, but the value that is returned is the value on // the left side of the .Of call, this is considered the 'second' indicator since it // receives data from the 'first' (in this case 'rsi'). sma.Of(rsi);
I'm also working on updates being made to the CompositeIndicator to work similarly to this as well, he will, however, need to listen to two indicators before he updates. Hopefully tonight or tomorrow I'll have something in master.JordanIlott
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!