Contraction Box & Doji Lines

Contraction & Doji Lines indicator is designed to identify and visualize potential support and resistance levels on a price chart. It does this by detecting doji candlestick patterns and drawing horizontal lines from the middle of the doji bodies to the right. Additionally, it also highlights price contraction zones with colored boxes.

The indicator first identifies doji candlestick patterns that it suggests indecision in the market, a horizontal line and these horizontal lines can act as potential support or resistance levels. Traders can observe price reactions around these lines. If the price approaches a line and bounces off it, it may indicate a significant level in the market.

In addition to doji lines, this indicator also highlights price contraction zones. When a contraction zone is detected, a colored box is drawn to highlight this zone. The box extends from the fifth bar ago (left side) to the current bar (right side), with the highest high and lowest low of the identified zone. The color and width of this box can be customized using the "Box Line Border Color," "Box Background Color," and "Box Width" parameters.

A possible strategy could be can use the doji lines as potential support and resistance levels to make trading decisions. For example, if the price breaks above a doji line and holds, it may indicate a bullish signal.

The colored boxes highlight areas of price contraction, which often precede significant price movements. Traders can use these zones to anticipate potential breakouts or breakdowns.
For example, you might enter a long (buy) position if it anticipate a breakout from a contraction zone with a target price set above the breakout level. Conversely, you might enter a short (sell) position if they anticipate a breakdown from a contraction zone with a target price set below the breakdown level.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


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.

Want to use this script on a chart?