OPEN-SOURCE SCRIPT
TMT Market Structure

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.
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.
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.
Tradingmientrung
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.
Tradingmientrung
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.