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ベースのノイズ除去
を組み合わせて相場状態を分類。
■ 向いている人
トレンドフォローをする人
レンジ回避したい人
環境認識を重視する人
仮想通貨トレーダー
■ 一言でいうと
👉 「今の相場が“どの状態で、どれだけ続いているか”を見える化するインジケーター」
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Free indicators tailored for each market are now available.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
Free indicators tailored for each market are now available.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。