Back

Rolling window for indicator(example sma).

Hi,

I am trying to get the simple moving average of the High and low for past 8 day,then store them in the rolling window.

In rolling window i am storing the daily level trade bar,sma of 8 High and low.

I would like to know if am finding the sma correctly ,as it is not matching to the sma as shown over other website like Trading view,Investing.com.

2)Also i would like to know why there is no need to create a seperate method for saving the daily level trade details(as it is directly used on    def ondata()) as compared to sma.

Update Backtest








0

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.


Hi Harsh,

Could you provide some reference SMA values from the other sites? However, for now, one idea for why the SMA values are different is because there are no official High and Low values, so the differences in data may affect the indicator values.

The reason we do not need to update Simple Moving Averages created with self.SMA is because indicators created using the QCAlgorithm class are automatically taken care of in the backend. However, if a user creates a Simple Moving Average indicator with self.sma = SimpleMovingAverage(8), then the user would need to manually update the indicator in OnData.

I've also attached a backtest with some recommended changes for the RollingWindows.

Best,
Shile Wen

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed