Back

Candlestick patterns on previous bars

Hi,

Does anyone have any examples that show the usage of candle stick patterns like doji, hammer etc that are used on say, a rolling window of bars, ie bars[10]?
There are good examples such as : 

https://www.quantconnect.com/forum/discussion/1239/candlestick-examples

 but those seem only to check for current bars.

Thanks

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.


For people who stumble upon this in future, I managed to solve this by adding 
 

self.Hammer = self.CandlestickPatterns.Hammer(self.eurusd)

into my initialize.

and then 

self.HammerWindow.Add(self.Hammer.Current.Value)

into a rollingwindow i had created earlier. so basically i can do a self.HammerWindow[5] to check if the 6th bar from last was a hammer.
dont forget to create the rolling window itself in initialize.

0

Hi Ben,

Thanks for providing the solution. For completeness, I've attached a backtest which demonstrates how this can be done in a full algorithm.

Best,
Derek Melchin

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