Hey everyone,
Has anyone had any experience trying to code in Pivot Point High Low in python? I'm really struggling with tryna get a working PPHiLo, has anyone had any experience with this? Any tips etc...
Just for info here is a link explaining PPHiLo:
Rahul Chowdhury
Hi Tomer,
Although Lean does not have a built-in pivot point high/low indicator, you can implement it yourself. Let's say we want to create a 5 period pivot point high indicator. We can accomplish this using a rolling window of size 11, which will let us analyze the previous 11 bars.
self.window = RollingWindow[TradeBar](11)
Then we can use our window to calculate if the middle bar is a pivot point.
middleBar = self.window[5] middleHigh = middleBar.High for i in range(5): if self.window[i].High > middleHigh: return False for i in range(6, 11): if self.window[i].High > middleHigh: return False return True
Best
Rahul
Shner
Very nice, I changed it slightly so it will always find the index in the middle of the window, as long as the len(self.window) is an odd number.
Louis Szeto
Hi All
Please be noted that LEAN now supports PivotPointHighLow candlestick indicator. Please refer to this page for details.
Best
Louis
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.
Shner
Hey Louis Szeto, I see there are two documentation URL's, one for lean V1 and for version 2, is there any difference between them ?
more specifically for indicators that are present only in Lean V2 (like the SuperTrend and Pivot Point H/L)
Shner,
Vladimir
Louis Szeto
Thank you for the good news.
In the attached backtest, I'm trying to compare two PivotPointHighLow candlestick indicators.
self.pphld is based on daily data, and self.pphl is based on a resampled 390-minute bar.
For some reason, the commented out part of the code throws an error.
Tomer Fridland
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!