OPEN-SOURCE SCRIPT
Trend / Range / Down Days Counter v6

Trend Duration Tracker v6
A trend-state indicator that automatically detects whether the market is currently in an:
UPTREND
DOWNTREND
RANGE
and displays how long the current condition has been active directly on the chart.
Features
• Automatic Market State Detection
The indicator continuously analyzes price action and trend direction using:
EMA slope
Price position relative to EMA
ATR-based noise filtering
to classify the market environment in real time.
• Trend Duration Display
Shows how long the current trend or range has lasted.
Example:
UPTREND
Duration: 12 Days
This helps traders understand whether a move is still developing or potentially becoming exhausted.
• Visual Background Coloring
The chart background changes automatically depending on market condition:
Green → Uptrend
Red → Downtrend
Aqua → Range
Making trend recognition instant and intuitive.
• Trend Change Markers
The indicator highlights transitions between market phases with labels such as:
UP START
DOWN START
RANGE
allowing traders to quickly identify possible regime shifts.
What It’s Useful For
✔ Trend Analysis
Track how long trends remain active and identify extended market conditions.
✔ Market Environment Recognition
Quickly determine whether the market is trending or ranging before entering trades.
✔ Multi-Market Compatibility
Works well across:
Cryptocurrency
Forex
Stocks
Indices
Commodities
and multiple timeframes.
Core Logic
The indicator combines:
EMA direction
EMA slope analysis
ATR volatility filtering
Price location relative to trend
to create a cleaner and more reliable trend-state model.
Best For
Trend-following traders
Swing traders
Crypto traders
Traders who want cleaner market structure analysis
In One Sentence
👉 “A visual market-state tracker that shows what trend the market is in — and how long it has lasted.”
Trend Duration Tracker v6
現在の相場が
上昇トレンド・下降トレンド・レンジ のどの状態にあるのかを自動判定し、
その継続期間を「日数」で表示するトレンド分析インジケーターです。
■ 特徴
● トレンド状態を自動判定
UPTREND
DOWNTREND
RANGE
をリアルタイムで表示。
EMAの傾きと価格位置を組み合わせ、
相場の方向性をシンプルかつ視覚的に把握できます。
● 継続日数を表示
現在の状態が
何日続いているか
どれくらい継続しているか
をチャート上へ表示。
例:
UPTREND
Duration: 12 Days
● 背景色で視認性アップ
緑 → 上昇トレンド
赤 → 下降トレンド
水色 → レンジ
チャートを開いた瞬間に相場環境を判断できます。
● トレンド転換ポイントも表示
状態が変わったタイミングで
UP START
DOWN START
RANGE
を自動表示。
■ 何に使えるか
✔ トレンドの継続分析
「今の上昇は伸びすぎか?」
「レンジが長すぎないか?」
を日数ベースで確認できます。
✔ 環境認識
エントリー前に
トレンド相場なのか
レンジ相場なのか
を一目で判断可能。
✔ 仮想通貨・FX・株に対応
BTC
ETH
アルトコイン
FX
株価指数
など、あらゆる市場で利用可能。
■ 判定ロジック
EMAの方向
EMAの傾き
現在価格との位置関係
ATRベースのノイズ除去
を組み合わせて相場状態を分類。
■ 向いている人
トレンドフォローをする人
レンジ回避したい人
環境認識を重視する人
仮想通貨トレーダー
■ 一言でいうと
👉 「今の相場が“どの状態で、どれだけ続いているか”を見える化するインジケーター」
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Free indicators tailored for each market are now available.
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.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Free indicators tailored for each market are now available.
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.