OPEN-SOURCE SCRIPT

ADX for BTC [PineIndicators]

481
The ADX Strategy for BTC is a trend-following system that uses the Average Directional Index (ADX) to determine market strength and momentum shifts. Designed for Bitcoin trading, this strategy applies a customizable ADX threshold to confirm trend signals and optionally filters entries using a Simple Moving Average (SMA). The system features automated entry and exit conditions, dynamic trade visualization, and built-in trade tracking for historical performance analysis.

⚙️ Core Strategy Components

1️⃣ Average Directional Index (ADX) Calculation
The ADX indicator measures trend strength without indicating direction. It is derived from the Positive Directional Movement (+DI) and Negative Directional Movement (-DI):

  • +DI (Positive Directional Index): Measures upward price movement.
  • -DI (Negative Directional Index): Measures downward price movement.
  • ADX Value: Higher values indicate stronger trends, regardless of direction.

This strategy uses a default ADX length of 14 to smooth out short-term fluctuations while detecting sustainable trends.

2️⃣ SMA Filter (Optional Trend Confirmation)
The strategy includes a 200-period SMA filter to validate trend direction before entering trades. If enabled:
✅ Long Entry is only allowed when price is above a long-term SMA multiplier (5x the standard SMA length).
✅ If disabled, the strategy only considers the ADX crossover threshold for trade entries.

This filter helps reduce entries in sideways or weak-trend conditions, improving signal reliability.

📌 Trade Logic & Conditions

🔹 Long Entry Conditions
A buy signal is triggered when:
✅ ADX crosses above the threshold (default = 14), indicating a strengthening trend.
✅ (If SMA filter is enabled) Price is above the long-term SMA multiplier.

🔻 Exit Conditions
A position is closed when:
✅ ADX crosses below the stop threshold (default = 45), signaling trend weakening.

By adjusting the entry and exit ADX levels, traders can fine-tune sensitivity to trend changes.

📏 Trade Visualization & Tracking

Trade Markers
  • "Buy" label (▲) appears when a long position is opened.
  • "Close" label (▼) appears when a position is exited.


Trade History Boxes
  • Green if a trade is profitable.
  • Red if a trade closes at a loss.


Trend Tracking Lines
  • Horizontal lines mark entry and exit prices.
  • A filled trade box visually represents trade duration and profitability.

These elements provide clear visual insights into trade execution and performance.

⚡ How to Use This Strategy

1️⃣ Apply the script to a BTC chart in TradingView.
2️⃣ Adjust ADX entry/exit levels based on trend sensitivity.
3️⃣ Enable or disable the SMA filter for trend confirmation.
4️⃣ Backtest performance to analyze historical trade execution.
5️⃣ Monitor trade markers and history boxes for real-time trend insights.

This strategy is designed for trend traders looking to capture high-momentum market conditions while filtering out weak trends.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.