PROTECTED SOURCE SCRIPT
Mis à jour

AtlasTrend - Flat Squueze Signals

25
Summary

AtlasTrend — Clean Entries + Flat Signals is a compact, multi-filter indicator that detects (1) potential horizontal / “flat” market regimes and (2) discrete Long / Short entry signals outside those flat regimes. It is designed to be visually minimal (only rising-edge signals and a small fixed table) and to avoid repeated signals on consecutive bars. The indicator intentionally exposes only a few critical tuning parameters to the user to reduce overfitting and configuration mistakes.

Key outputs

Table (top-right) — shows current pair, current state (FLAT or TREND), current rising-edge signal (LONG, SHORT, or NONE), and the flatScore (0–1).
  • Long Signal — green upward triangle plotted only once on the bar where conditions switch from false→true (rising-edge).
  • Short Signal — red downward triangle plotted only on rising-edge.
  • Potential Flat Start — small orange dot above bar on rising-edge of a detected flat-start condition.
  • Potential Flat End — small blue dot above bar on rising-edge of a detected flat-end condition.
  • Background shading — light shading while indicator is in a detected inFlat state (optional and subtle).


What it measures (methodology, high level)

The indicator builds a single composite score called flatScore (0–1) that expresses how “flat / squeezed / indecisive” the market is at the moment. flatScore is an average of several independent components:

  • TRIX stability — an ultra-smoothed momentum change (user’s original TRIX-based logic). Low TRIX change increases flatScore.
  • Volatility / ATR ratio — normalized ATR(close) — low volatility increases flatScore.
  • Momentum neutrality — RSI and CCI being near neutral ranges increases flatScore.
  • Trend weakness — price close’s dispersion from a short SMA; small dispersion means weak trend → higher flatScore.
  • Kernel tightness — rolling standard deviation based tightness metric — small rolling stdev → higher flatScore.


These components are combined using fixed internal weights (deliberately not exposed) into flatScore.

Flat detection (potential flat start) requires flatScore >= flatThreshold for consecBarsToStart consecutive bars (rising-edge triggers). Flat ends when flatScore drops below ~90% of the threshold.

Entry signals (Long / Short) are generated only if:

Market is not in inFlat state, and

A compact trend/momentum filter passes (fast EMA vs slow EMA, price vs EMA, RSI threshold, and a minimum volatility filter), and

The condition appears as a rising edge (so a signal is emitted only once per entry occurrence).

This design intentionally avoids repeated signals on nearly every bar and reduces repaint risk by using rising-edge logic.

Inputs exposed to user

flatThreshold (float) — the composite score threshold above which the indicator considers the market “flat.” Default sensible value supplied.

  • Lower → more flats detected (sensitive).
  • Higher → fewer flats (conservative).


consecBarsToStart (int) — how many consecutive bars must meet threshold to produce a potential flat start. Increasing reduces false positives.

tradeAggressiveness (float) — scales the internal EMA lengths used for entry logic (0.5 conservative → 1.5 aggressive). Higher values produce shorter EMAs and more frequent signals.

All other internal weights and thresholds are fixed to keep the UX simple and reduce overfitting.

How to use (practical steps)

Recommended timeframe: daily (1D) for BTC; works on other timeframes but behavior changes. For intraday testing, treat thresholds/expectations accordingly.

Load indicator on the chart (BTCUSDT, 1D recommended) and leave defaults initially.

Observe the top-right table:

  • State = FLAT → avoid placing breakout entries; treat as consolidation.
  • Signal = LONG/SHORT → new entry opportunity (rising-edge).


flatScore gives a continuous measure of flatness.

Confirm signals with your own rules (volume, orderflow, structural support/resistance) — indicator is a decision tool, not an automatic executor.

Stop / risk management: use ATR-based stops (e.g., 1.5–3× ATR), position-sizing rules and max-drawdown limits. Never rely on a single indicator.

Backtest visually / manually: scroll historical data, inspect long/short signals and flat start/ends; mark false positives and tune tradeAggressiveness modestly if needed.

Example parameter guidance

Conservative (fewer trades, fewer false signals):
flatThreshold = 0.78, consecBarsToStart = 4, tradeAggressiveness = 0.8

Default / Balanced:
flatThreshold = 0.72, consecBarsToStart = 3, tradeAggressiveness = 1.0

Aggressive (more signals):
flatThreshold = 0.65, consecBarsToStart = 2, tradeAggressiveness = 1.3

Always retest after changing.

Alerts & automation

The indicator exposes alerts for Long, Short, Potential Flat Start, and Potential Flat End (rising-edge only).

When creating alerts in TradingView, choose “Once Per Bar Close” if you want confirmation by bar close, or “Once Per Bar” for earlier notification (bar close reduces repaint risk).

Use the alert message templates provided by the script for easy automation.

Repainting and signal stability

Signals are emitted only on rising-edges (condition from false → true) so a given entry is plotted once.

For automation, prefer bar-close confirmation (alert “Once Per Bar Close”) to avoid acting on conditions that might reverse intra-bar.

The flatScore itself is calculated with closed-bar indicators (EMA, ATR, RSI, etc.) and rolling stats — stable and deterministic.

The indicator intentionally keeps internal weights fixed to simplify reproducibility and avoid parameter bloat.

Limitations & honest warnings

No indicator can predict market moves with 100% accuracy. This tool reduces noise and false entries but does not guarantee profits.

Market regimes change — periodic retuning or revalidation on fresh data is necessary.

Do not use this indicator as the sole basis for high-frequency automated trading without robust money management and slippage modeling.

Suggested workflow for BTC 3-year analysis

  • Add indicator to BTCUSDT daily chart
  • Run through historical data and log:
  • Total Long signals, Total Short signals
  • Average run length after entry (bars)
  • False signal examples (manually tag 5–10)


Adjust tradeAggressiveness to reduce false signals if necessary (reduce to be more conservative).

If flat detections are too frequent, increase flatThreshold or consecBarsToStart.
Notes de version
Bug Fix

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.