Back

History for ATR

Hello, I'm very much a struggling beginner.  

I've spent hours in Documentation and in Community looking for python solution to doing a history update of ATR for multiple stocks in a universe.  Also thanks to Alex who kindly helped me at an earlier stage (unfortunately before I added ATR indicator to my attempt).

I'm struggling with the final part.  I seem to have a panda row with OHLC data but it is the wrong type for passing to ATR Update; and I've run out of ideas.

Is anyone able to point me in the right direction please?

error message which is triggered from code line 127 where I want to pass to warmupindicatorbar from within onsecuritieschanged:

Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception

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.


After reading the Historical Data Requests documentation page (for the nth time).  I think I sorted my own issue out.  difference between self.history request using [symbol] which delivers a panda thingy and str(symbol) which delivers a bar that can be fed into Update()  I don't actually know what all that means but seems to be working.

So now I think I have the beginning of a multi symbol universe that updates with history for simple price/data point indicators and bar indicators such as ATR.

0


Hi Gkiwi.

Thanks for sharing! As you mentioned, the method History() returns a pandas DataFrame object when the given input is a Python list object. However, you can retrieve a TradeBar by using a string symbol as an input, as you have done. Pandas DataFrame object can't be used to update an indicator such as ATR, and this is the reason why you need a TradeBar instead.

For future reference, check out the documentation on LEAN, it covers various methods in detail, such as History(). Good luck!

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.


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