Back

Help needed in adding RollingWindow for SMA indicator.

I am working with a clone of the MultipleSymbolConsolidatonAlgorithm.py algorithm.
I am attempting to add a RollingWindow for the SMA indicator, and then add the RollingWindow data
to the self.Data dictionary.  To allow access of previous period SMA data.
I added the following lines to the code:

    Line 90 -> self.Data[bar.Symbol.Value].smaWin.Add(IndicatorDataPoint)
    Line 132-> self.smaWin = RollingWindow[IndicatorDataPoint](windowSize)

I received the following error.

    Runtime Error: Python.Runtime.PythonException: ArgumentException : Object of type
    'System.RuntimeType' cannot be converted to type 'QuantConnect.Indicators.IndicatorDataPoint'.

Please provide some guidance. I am not sure if I am doing this correctly.

I had to comment out the added lines in order to attach the backtest.

Thank you.

Your help is much appreciated.

Update Backtest








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