OPEN-SOURCE SCRIPT

Time + SMA89/200 Filter

341
This indicator provides a clean market environment filter designed to help traders avoid low-quality trading conditions. It combines a time-based session filter with a market structure filter using SMA89 and SMA200 to reduce exposure to sideways or low-liquidity periods.

The script focuses purely on identifying when trading should be avoided, rather than generating buy or sell signals. It can be used together with any strategy or alert system to improve overall signal quality.

The first component is a time filter based on UTC+8, which blocks specific trading sessions known to produce lower-quality price movement or increased noise. The blocked sessions are:

* 04:00 – 07:00 (Asian early hours / low liquidity)
* 16:00 – 20:45 (pre-U.S. session volatility transition)

During these periods, alerts or strategy signals can be suppressed to avoid unreliable market behavior.

The second component analyzes the relationship between SMA89 and SMA200. When these two moving averages are very close to each other and both are relatively flat, the market is typically in a compressed or sideways state. Such conditions often lead to false breakouts, frequent EMA crossovers, and inconsistent trend continuation.

The indicator detects this compression by measuring:

* The distance between SMA89 and SMA200
* The slope (flatness) of both moving averages over a defined number of bars

When both moving averages are too close and too flat, the script marks the chart as a no-trade environment.

By combining session filtering and structural trend filtering, this tool helps traders:

* Avoid low-liquidity market periods
* Avoid sideways compression zones
* Reduce false signals from moving average crosses
* Improve the quality of alerts generated by other strategies

This script does not produce trading signals on its own. Instead, it acts as a market condition filter that can be integrated with other indicators or automated alerts to improve decision-making and trade selection.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.