OPEN-SOURCE SCRIPT
Updated Fractal Directional Bias: HH/HL vs LL/LH

This indicator is to help user to identify Directional Bias based on William Fractal.
It allows user to input the Fractal Depth.
For example of Fractal Depth = 3
Swing High: Current Candle High is higher than both the previous and the next Candle High
Swing Low: Current Candle Low is lower than both the previous and the next Candle Low
With Swing High and Swing Low identified, the indicator further categorised it into HH, HL, LH, LL. The indicator plot the background:
Green: When the first HH or HL detected
Red: When the first LL or LH detected
Note: The change of colour seems like have 2 candles delayed (for fractal depth 3) because it need 3 candles to detect the swing high and swing low.
It allows user to input the Fractal Depth.
For example of Fractal Depth = 3
Swing High: Current Candle High is higher than both the previous and the next Candle High
Swing Low: Current Candle Low is lower than both the previous and the next Candle Low
With Swing High and Swing Low identified, the indicator further categorised it into HH, HL, LH, LL. The indicator plot the background:
Green: When the first HH or HL detected
Red: When the first LL or LH detected
Note: The change of colour seems like have 2 candles delayed (for fractal depth 3) because it need 3 candles to detect the swing high and swing low.
Release Notes
Bug fixed- background colour not triggered correctly when the bullish and bearish state changed
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.