TV Script - Trading Dashboard Documentation

Comprehensive documentation for TradingView Pine Script indicators and trading strategies

View the Project on GitHub tekram/tv-script

Extended EMA/SMA Analysis

Overview

The Extended EMA/SMA Analysis system measures how far price has extended from key moving averages, providing both ATR-based and percentage-based measurements. This helps identify overextended conditions and optimal entry/exit levels.

Measurement Types

ATR Multiples

Percentage Distance

Tracked Moving Averages

Short-Term EMAs

3 EMA

4 EMA (High)

5 EMA

10 EMA

Medium-Term EMAs

20 EMA

20 EMA (Hourly)

Long-Term SMAs

50 SMA

200 SMA

Display Format

Table Format (Top Right)

Each extended MA shows:

Extended EMA X: [ATR multiple] / [percentage]% ([MA value])

Example:

Extended EMA 20: 1.22 / 11.28% (97.06)

Floating Label Format

Shows multiple EMAs in single label:

20 EMA (hourly): X% (value) / extended
5 EMA: X% (value) / extended
10 EMA: X% (value) / extended
20 EMA: X% (value) / extended

Color Coding

Background Colors

Text Colors

Trading Applications

Entry Timing

Position Sizing

Exit Strategy

Configuration Options

Display Toggles

Input Settings

Best Practices

  1. Avoid Extended Entries: Don’t buy >1x ATR above 21dma structure
  2. Watch Multiple MAs: Check extension from multiple timeframes
  3. Combine with Structure: Use with 21 EMA structure for best results
  4. Trim into Strength: Use extension levels for profit-taking
  5. Re-entry Zones: Wait for pullback to structure before adding

Technical Details

Calculation Method

// ATR-based extension
extended_ema = (close - price_ema) / atr

// Percentage extension
percent_change_from_ema = (close - price_ema) / price_ema * 100

// Conditional display
if show_longer_ma or percent_change_from_sma < 0.1
    // Show 50 SMA

Conditional Logic