Back

Trying to understand RollingWindows

I am new to QuantConnect so maybe I am doing something wrong. I am trying out the code for the SMA rolling windows from the documention. I would like to take two values from the rolling window and either add them or divide them or whatever, but when I do I get...."Trying to perform a summation, subtraction, multiplication or division between 'IndicatorDataPoint' and 'IndicatorDataPoint' objects throws a TypeError exception. To prevent the exception, ensure that both values share the same type."

Can you tell what is the problem is? Thanks

Update Backtest








there were quite similar questions asked few days ago.

 

https://www.quantconnect.com/forum/discussion/3591/how-to-access-previous-periods-indicatorshttps://www.quantconnect.com/forum/discussion/3303/how-to-use-rollingwindow--on-multiple-equities-and-indicators
1

I looked at those. But I still have some questions. I wanted to do some comparsions on current value vs previous values e.g

currentSma = self.smaWin[0]  

previousSma = self.smaWin[1] (index doesnt really matter this point)

I tried conversions to floats or int or whatnot, but still the IndicatorDataPoint error was coming up when trying to do some math on the values. 

Also, is a considation from a lower time frame necessary? Or just shown for reference?

0

Ethan Hammes, QC's historical function gives us multi-layer dataframes which I think is a little difficult to work with. If you want to play with simple pandas dataframes, you need to re-create dataframes first. I don't know what your final goal is, but I just attached a sample algo showing how to re-create dataframes and indicators you want (in here, SMA). You will get all the SMA data in the form of pandas Series, so that you can do whatever you want to play with.(e.g. computation, comparison, listing, etc.). Hope this helps. Thanks. 

1


HanByul P thanks for helping me and others out.

Ethan Hammes below is the example you are taking about. VALUE WAS THE KEYWORD!

good keyword is also .Close   :)

check line 77 in the backtest.

 

Dear QuantConnect-Team

Jared Broad 

Jing Wu 

in the rolling window python example is no example how to eccess the rolling window?

..............................................

............

add only one line please to the example for others and people that will come in the future.........

also some forum software like vbulletin with beginner threads would be great or a blog post? beginners guide?

maybe also at the documentation tab a link? straight to start point?

@Ethan   Why didnt you check out the boot camp?

where is the boot camp link on the website/blog?  tutorial section? is only for professionals so why tutorial? its very hard to find the tutorial section! its hidden inside text....so you enter this hidden dungeon when you hover above? like diablo?

https://www.quantconnect.com/bootcamp/

 

Where is the guide to help people to dive into Quantconnect?

Ethan check this maybe as next.....

https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/MultipleSymbolConsolidationAlgorithm.py

have fun

:) :)

1


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