OPEN-SOURCE SCRIPT

Fib and Slope Trend Detector [EWT] + MTF Dashboard

133
🚀 Overview

The Momentum Structure Trend Detector is a sophisticated trend-following tool that combines Price Velocity (Slope) with Market Structure (Fibonacci) to identify high-probability trend reversals and continuations.

Unlike traditional indicators that rely heavily on lagging moving averages, this script analyzes the speed of price action in real-time. It operates on the core principle of market structure: Impulse moves are fast and steep, while corrections are slow and shallow.

🧠 The Logic: Physics Meets Market Structure

This indicator determines the trend direction by calculating the Slope (Velocity) of price swings.

  1. ZigZag Calculation: It first identifies market swings (Highs and Lows) using a standard pivot detection algorithm.
  2. Slope Calculation: It calculates the velocity of every completed leg using the formula: $Slope = \frac{|Price Change|}{|Time Duration|}$.
  3. Trend Definition:
    Uptrend: If the previous Up-move was fast (Impulse) and the subsequent Down-move is slower (Correction), the market is primed for an uptrend.
    Downtrend: If the previous Down-move was fast (Impulse) and the subsequent Up-move is slower (Correction), the market is primed for a downtrend.


🔥 Key Features

1. Aggressive Real-Time Detection (No Lag)
Most structure indicators wait for a "Higher High" to confirm a trend, which often leads to late entries. This script uses an Aggressive Live Slope calculation:

It compares the current developing slope of the live price action against the slope of the previous completed leg.

Result: As soon as the current move becomes "steeper" (faster) than the previous correction, the trend flips immediately. This allows you to catch the "meat" of the move before a new pivot is even confirmed.

2. Fibonacci Validity Filter
Momentum alone isn't enough; we need structural integrity.

The script calculates the 78.6% Retracement level of the impulse leg.

If a correction moves deeper than this Fibonacci limit (on a closing basis), the trend structure is considered "broken" or "invalid," and the indicator switches to a Neutral state. This filters out choppy/ranging markets.

3. Multi-Timeframe (MTF) Dashboard
A customizable dashboard on the chart allows for fractal analysis. You can view the trend state (UP/DOWN/NEUTRAL) across 9 different timeframes (1m to 1M) simultaneously.

Green Row: Uptrend

Red Row: Downtrend

Gray: Neutral/Indeterminate

4. Smart Visuals
Background Color: Changes dynamically (Teal for Bullish, Red for Bearish, Gray for Neutral) to give you an instant read of the market state.

Slope Labels: Displays the calculated numeric slope on the chart, helping you visualize the momentum difference between impulse and corrective waves.

Invalidation Levels: Automatically plots the invalidation line (Stop Loss level) based on the market structure.

🛠️ Settings & Inputs
Strategy Settings

Pivot Deviation Length: Sensitivity of the ZigZag calculation (Default: 5). Lower numbers = more sensitive to small swings.

Max Retracement %: The Fibonacci limit for a valid correction (Default: 78.6%).

Min Bars for Live Calc: To prevent noise, the script waits for this many bars after a pivot before calculating the "Live Slope" (Default: 3).

Dashboard Settings

Show Dashboard: Toggle the table on/off.

Timeframe Toggles: Enable/Disable specific timeframes (1m, 5m, 15m, 30m, 1H, 4H, 1D, 1W, 1M) to suit your trading style.

🎯 How to Use
Wait for Background Change: When the background turns Teal, it indicates that a corrective pullback has ended and a new impulse with high velocity has begun.

Check Invalidation: Look at the plotted Stop Loss Level. If price closes below this line, the trade idea is invalid.

Confirm with Dashboard: Use the table to ensure the higher timeframes (e.g., 1H, 4H) align with your current chart's direction for higher probability setups.

Disclaimer: This tool is designed for trend analysis and educational purposes. Past performance (momentum) is not indicative of future results. Always manage your risk.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.