OPEN-SOURCE SCRIPT

TMT Market Structure

709
1. Automatic Trendlines
Added both Short-Term Trendlines and Long-Term Trendlines.
These are controlled in the new Trendlines settings group, where you can adjust the "Pivot Length" for both. The shorter the length (default 5), the closer it tracks recent price action. A longer length (default 15) filters for larger macroeconomic swings.
The trendlines extend dynamically to the right and automatically clean up historical lines to keep the chart clutter-free.
2. Sideways Market Zones (Boxes)
The indicator now detects periods of consolidation when price struggles to create new structure breaks (failing to make a higher high or lower low beyond the ATR filter constraint).
When this triggers, it draws a yellow Range Box stretching from the highest point to the lowest point of the local structure and extends it forward in time until price breaks out.
3. Breakout Signals
Once the price definitively closes outside of the Sideways Range Box (incorporating your ATR noise filter so it ignores fake wick-outs), the indicator closes the box.
It prints "BRK UP" (Breakout Up) or "BRK DN" (Breakout Down) on the chart.
Corresponding breakout alerts (Range breakout UP & Range breakout DOWN) have been added to the script so you can get notified precisely when a consolidation period ends.

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.