MTF 20 SMA Table - DXY**MTF 20 SMA Table - Multi-Timeframe Trend Analysis Dashboard**
**Overview:**
This indicator provides a comprehensive multi-timeframe analysis dashboard that displays the relationship between price and the 20-period Simple Moving Average (SMA) across four key timeframes: 15-minute, 1-hour, 4-hour, and Daily. It's designed to help traders quickly identify trend alignment and potential trading opportunities across multiple timeframes at a glance.  It's definitely not perfect but has helped me speed up my backtesting efforts as it's worked well for me eliminating flipping back and forth between timeframes excpet when I have confluence on the table, then I check the HTF.
**How It Works:**
The indicator creates a table overlay on your chart showing three critical metrics for each timeframe:
1. **Price vs SMA (Row 1):** Shows whether price is currently above (bullish) or below (bearish) the 20 SMA
   - Green = Price Above SMA
   - Red = Price Below SMA
2. **SMA Direction (Row 2):** Indicates the trend direction of the SMA itself over a lookback period
   - Green (↗ Rising) = Uptrend
   - Red (↘ Falling) = Downtrend
   - Gray (→ Flat) = Ranging/Consolidation
3. **Strength (Row 3):** Displays the distance between current price and the SMA in pips
   - Purple background = Strong move (>50 pips away)
   - Orange background = Moderate move (20-50 pips)
   - Gray background = Weak/consolidating (<20 pips)
   - Text color: Green for positive distance, Red for negative
**Key Features:**
- **Customizable Table Position:** Place the table anywhere on your chart (9 position options)
- **Adjustable SMA Lengths:** Modify the SMA period for each timeframe independently (default: 20)
- **Direction Lookback Settings:** Fine-tune how far back the indicator looks to determine SMA direction for each timeframe
- **Flat Threshold:** Set the pip threshold for determining when an SMA is "flat" vs trending (default: 5 pips)
- **DXY Optimized:** Calculations are calibrated for the US Dollar Index (1 pip = 0.01)
**Best Use Cases:**
1. **Trend Alignment:** Identify when multiple timeframes align in the same direction for higher probability trades
2. **Divergence Spotting:** Detect when lower timeframes diverge from higher timeframes (potential reversals)
3. **Entry Timing:** Use lower timeframe signals while higher timeframes confirm overall trend
4. **Strength Assessment:** Gauge how extended price is from the mean (SMA) to avoid overextended entries
**Settings Guide:**
- **SMA Settings Group:** Adjust the SMA period for each timeframe (15M, 1H, 4H, Daily)
- **SMA Direction Group:** Control lookback periods to determine trend direction
  - 15M: Default 5 candles
  - 1H: Default 10 candles
  - 4H: Default 15 candles
  - Daily: Default 20 candles
- **Flat Threshold:** Set sensitivity for "flat" detection (lower = more sensitive to ranging markets)
**Trading Strategy Examples:**
1. **Trend Following:** Look for all timeframes showing the same direction (all green or all red)
2. **Pullback Trading:** When Daily/4H are green but 15M/1H show red, wait for lower timeframes to flip green for entry
3. **Ranging Markets:** When multiple SMAs show "flat", consider range-bound strategies
**Important Notes:**
- This is a reference tool only, not a standalone trading system
- Always use proper risk management and combine with other analysis methods
- Best suited for trending instruments like indices and major forex pairs
- Calculations are optimized for DXY but can be used on other instruments (pip calculations may need adjustment)
**Credits:**
Feel free to modify and improve this code! Suggestions for enhancements are welcome in the comments.
---
**Installation Instructions:**
1. Add the indicator to your TradingView chart
2. Adjust the table position via settings to avoid overlap with price action
3. Customize SMA lengths and lookback periods to match your trading style
4. Monitor the table for timeframe alignment and trend confirmation
---
This indicator is published as open source for the community to learn from and improve upon. Happy trading! 📈
ממוצעים נעים
True Average PriceTrue Average Price 
 Overview 
The indicator plots a single line representing the cumulative average closing price of any symbol you choose. It lets you project a long-term mean onto your active chart, which is useful when your favourite symbol offers limited history but you still want context from an index or data-rich feed.
 How It Works 
The script retrieves all available historical bars from the selected symbol, sums their closes, counts the bars, and divides the totals to compute the lifetime average. That value is projected onto the chart you are viewing so you can compare current price action to the broader historical mean.
 Inputs 
 
 Use Symbol : Toggle on to select an alternate symbol; leave off to default to the current chart.
 Symbol : Pick the data source used for the average when the toggle is enabled.
 Line Color : Choose the display color of the average line.
 Line Width : Adjust the thickness of the plotted line. 
 
 Usage Tips 
 
 Apply the indicator to exchanges with shallow history while sourcing the average from a complete index (e.g.,  INDEX:BTCUSD  for crypto pairs).
 Experiment with different symbols to understand how alternative data feeds influence the baseline level. 
 
 Disclaimer 
This indicator is designed as a technical analysis tool and should be used in conjunction with other forms of analysis and proper risk management. 
Past performance does not guarantee future results, and traders should thoroughly test any strategy before implementing it with real capital.
Price Action Brooks ProPrice Action Brooks Pro (PABP) - Professional Trading Indicator
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 OVERVIEW
Price Action Brooks Pro (PABP) is a professional-grade TradingView indicator developed based on Al Brooks' Price Action trading methodology. It integrates decades of Al Brooks' trading experience and price action analysis techniques into a comprehensive technical analysis tool, helping traders accurately interpret market structure and identify trading opportunities.
• Applicable Markets: Stocks, Futures, Forex, Cryptocurrencies
• Timeframes: 1-minute to Daily (5-minute chart recommended)
• Theoretical Foundation: Al Brooks Price Action Trading Method
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 CORE FEATURES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1️⃣ INTELLIGENT GAP DETECTION SYSTEM
Automatically identifies and marks three critical types of gaps in the market.
TRADITIONAL GAP
• Detects complete price gaps between bars
• Upward gap: Current bar's low > Previous bar's high
• Downward gap: Current bar's high < Previous bar's low
• Hollow border design - doesn't obscure price action
• Color coding: Upward gaps (light green), Downward gaps (light pink)
• Adjustable border: 1-5 pixel width options
TAIL GAP
• Detects price gaps between bar wicks/shadows
• Analyzes across 3 bars for precision
• Identifies hidden market structure
BODY GAP
• Focuses only on gaps between bar bodies (open/close)
• Filters out wick noise
• Disabled by default, enable as needed
Trading Significance:
• Gaps signal strong momentum
• Gap fills provide trading opportunities
• Consecutive gaps indicate trend continuation
✓ Independent alert system for all gap types
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2️⃣ RTH BAR COUNT (Trading Session Counter)
Intelligent counting system designed for US stock intraday trading.
FEATURES
• RTH Only Display: Regular Trading Hours (09:30-15:00 EST)
• 5-Minute Chart Optimized: Displays every 3 bars (15-minute intervals)
• Daily Auto-Reset: Counting starts from 1 each trading day
SMART COLOR CODING
• 🔴 Red (Bars 18 & 48): Critical turning moments (1.5h & 4h)
• 🔵 Sky Blue (Multiples of 12): Hourly markers (12, 24, 36...)
• 🟢 Light Green (Bar 6): Half-hour marker (30 minutes)
• ⚫ Gray (Others): Regular 15-minute interval markers
Al Brooks Time Theory:
• Bar 18 (90 min): First 90 minutes determine daily trend
• Bar 48 (4 hours): Important afternoon turning point
• Hourly markers: Track institutional trading rhythm
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
3️⃣ FOUR-LINE EMA SYSTEM
Professional-grade configurable moving average system.
DEFAULT CONFIGURATION
• EMA 20: Short-term trend (Al Brooks' most important MA)
• EMA 50: Medium-short term reference
• EMA 100: Medium-long term confirmation
• EMA 200: Long-term trend and bull/bear dividing line
FLEXIBLE CUSTOMIZATION
Each EMA can be independently configured:
• On/Off toggle
• Data source selection (close/high/low/open, etc.)
• Custom period length
• Offset adjustment
• Color and transparency
COLOR SCHEME
• EMA 20: Dark brown, opaque (most important)
• EMA 50/100/200: Blue-purple gradient, 70% transparent
TRADING APPLICATIONS
• Bullish Alignment: Price > 20 > 50 > 100 > 200
• Bearish Alignment: 200 > 100 > 50 > 20 > Price
• EMA Confluence: All within <1% = major move precursor
Al Brooks Quote:
"The EMA 20 is the most important moving average. Almost all trading decisions should reference it."
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
4️⃣ PREVIOUS VALUES (Key Prior Price Levels)
Automatically marks important price levels that often act as support/resistance.
THREE INDEPENDENT CONFIGURATIONS
Each group configurable for:
• Timeframe (1D/60min/15min, etc.)
• Price source (close/high/low/open/CurrentOpen, etc.)
• Line style and color
• Display duration (Today/TimeFrame/All)
SMART OPEN PRICE LABELS ⭐
• Auto-displays "Open" label when CurrentOpen selected
• Label color matches line color
• Customizable label size
TYPICAL SETUP
• 1st Line: Previous close (Support/Resistance)
• 2nd Line: Previous high (Breakout target)
• 3rd Line: Previous low (Support level)
Al Brooks Magnet Price Theory:
• Previous open: Price frequently tests opening price
• Previous high/low: Strongest support/resistance
• Breakout confirmation: Breaking prior levels = trend continuation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5️⃣ INSIDE & OUTSIDE BAR PATTERN RECOGNITION
Automatically detects core candlestick patterns from Al Brooks' theory.
ii PATTERN (Consecutive Inside Bars)
• Current bar contained within previous bar
• Two or more consecutive
• Labels: ii, iii, iiii (auto-accumulates)
• High-probability breakout setup
• Stop loss: Outside both bars
Trading Significance:
"Inside bars are one of the most reliable breakout setups, especially three or more consecutive inside bars." - Al Brooks
OO PATTERN (Consecutive Outside Bars)
• Current bar engulfs previous bar
• Two or more consecutive
• Labels: oo, ooo (auto-accumulates)
• Indicates indecision or volatility increase
ioi PATTERN (Inside-Outside-Inside)
• Three-bar combination: Inside → Outside → Inside
• Auto-detected and labeled
• Tug-of-war pattern
• Breakout direction often very strong
SMART LABEL SYSTEM
• Auto-accumulation counting
• Dynamic label updates
• Customizable size and color
• Positioned above bars
✓ Independent alerts for all patterns
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 USE CASES
INTRADAY TRADING
✓ Bar Count (timing rhythm)
✓ Traditional Gap (strong signals)
✓ EMA 20 + 50 (quick trend)
✓ ii/ioi Patterns (breakout points)
SWING TRADING
✓ Previous Values (key levels)
✓ EMA 20 + 50 + 100 (trend analysis)
✓ Gaps (trend confirmation)
✓ iii Patterns (entry timing)
TREND FOLLOWING
✓ All four EMAs (alignment analysis)
✓ Gaps (continuation signals)
✓ Previous Values (targets)
BREAKOUT TRADING
✓ iii Pattern (high-reliability setup)
✓ Previous Values (targets)
✓ EMA 20 (trend direction)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎨 DESIGN FEATURES
PROFESSIONAL COLOR SCHEME
• Gaps: Hollow borders + light colors
• Bar Count: Smart multi-color coding
• EMAs: Gradient colors + transparency hierarchy
• Previous Values: Customizable + smart labels
CLEAR VISUAL HIERARCHY
• Important elements: Opaque (EMA 20, bar count)
• Reference elements: Semi-transparent (other EMAs, gaps)
• Hollow design: Doesn't obscure price action
USER-FRIENDLY INTERFACE
• Clear functional grouping
• Inline layout saves space
• All colors and sizes customizable
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 AL BROOKS THEORY CORE
READING PRICE ACTION
"Don't try to predict the market, read what the market is telling you."
PABP converts core concepts into visual tools:
• Trend Assessment: EMA system
• Time Rhythm: Bar Count
• Market Structure: Gap analysis
• Trade Setups: Inside/Outside Bars
• Support/Resistance: Previous Values
PROBABILITY THINKING
• ii pattern: Medium probability
• iii pattern: High probability
• iii + EMA 20 support: Very high probability
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ TECHNICAL SPECIFICATIONS
• Pine Script Version: v6
• Maximum Objects: 500 lines, 500 labels, 500 boxes
• Alert Functions: 8 independent alerts
• Supported Timeframes: All (5-min recommended for Bar Count)
• Compatibility: All TradingView plans, Mobile & Desktop
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 RECOMMENDED INITIAL SETTINGS
GAPS
• Traditional Gap: ✓
• Tail Gap: ✓
• Border Width: 2
BAR COUNT
• Use Bar Count: ✓
• Label Size: Normal
EMA
• EMA 20: ✓
• EMA 50: ✓
• EMA 100: ✓
• EMA 200: ✓
PREVIOUS VALUES
• 1st: close (Previous close)
• 2nd: high (Previous high)
• 3rd: low (Previous low)
INSIDE & OUTSIDE BAR
• All patterns: ✓
• Label Size: Large
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🌟 WHY CHOOSE PABP?
✅ Solid Theoretical Foundation
Based on Al Brooks' decades of trading experience
✅ Complete Professional Features
Systematizes complex price action analysis
✅ Highly Customizable
Every feature adjustable to personal style
✅ Excellent Performance
Optimized code ensures smooth experience
✅ Continuous Updates
Constantly improving based on feedback
✅ Suitable for All Levels
Benefits beginners to professionals
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📖 RECOMMENDED LEARNING
Al Brooks Books:
• "Trading Price Action Trends"
• "Trading Price Action Trading Ranges"
• "Trading Price Action Reversals"
Learning Path:
1. Understand basic candlestick patterns
2. Learn EMA applications
3. Master market structure analysis
4. Develop trading system
5. Continuous practice and optimization
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ RISK DISCLOSURE
IMPORTANT NOTICE:
• For educational and informational purposes only
• Does not constitute investment advice
• Past performance doesn't guarantee future results
• Trading involves risk and may result in capital loss
• Trade according to your risk tolerance
• Test thoroughly in demo account first
RESPONSIBLE TRADING:
• Always use stop losses
• Control position sizes reasonably
• Don't overtrade
• Continuous learning and improvement
• Keep trading journal
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📜 COPYRIGHT
Price Action Brooks Pro (PABP)
Author: © JimmC98
License: Mozilla Public License 2.0
Pine Script Version: v6
Acknowledgments:
Thanks to Dr. Al Brooks for his contributions to price action trading. This indicator is developed based on his theories.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Experience professional-grade price action analysis now!
"The best traders read price action, not indicators. But when indicators help you read price action better, use them." - Al Brooks
Smart Buy & SellThis is a tool that is widely used
Especially for Overbought and Oversold systems, but I have made some changes in this indicator,
How to use it...
I have set it as the default setting
- RSI Length: 6 (<10 for scalping - 5m-15m)
- Overbought: 70
- Oversold: 30
What is unique about this tool?
we can see 3 conditions:
1) RSI Overbought / Oversold with Bullish Engulfing / Bearish Engulfing
2) RSI Overbought / Oversold with Hammer and Shooting Star
3) RSI Overbought / Oversold with 2 Bullish Bars / 2 Bearish Bars
4) RSI Overbought / Oversold with All Patterns at the same time
When the RSI reaches its Oversold line, the code will wait for Bullish Engulfing pattren, when oversold and Bullish engulfing matched, This indicator will generate a buy signal when the condition is met,
and same as for Bear market, When the RSI reaches its Overbought line, the code will wait for Bearish Engulfing pattren, This indicator will generate a sell/exit signal when the condition is met,
2nd condition is that a Hammer candle will be waited for when RSI touches the Overbought line, for Bullish Move
and Shooting Star candle will be waited for when RSI touches the Overbought line, for Bullish Move, for Bearish Move
3rd Condition is also the same as Condition 1 and Condition 2,
When the RSI reaches its Oversold line, the code will wait for 2 Bullish Bars, when oversold and 2 Bullish Bars matched then this indicator will generate a buy signal, and same as for Bear market,
When the RSI reaches its Overbought line, the code will wait for 2 Bearish Bars, when overbought and 2 Bearish Bars matched then this indicator will generate a Sell signal,
4th Condition is that we can use All Conditions at the same time,
- Bullish Engulfing / Bearish Engulfing
- Hammer and Shooting Star
- 2 Bullish Bars / 2 Bearish Bars
Multi-Anchor VWAP Deviation Dashboard Overview
Multi-Anchor VWAP Deviation Dashboard (Optimized Global) is an overlay indicator that computes up to five user-defined Anchored Volume Weighted Average Prices (AVWAPs) from custom timestamps, plotting their lines and displaying real-time percentage deviations from the current close. It enables precise analysis of price positioning relative to key events (e.g., earnings, news) or periods (e.g., weekly opens), with a compact dashboard for quick scans. Optimized for performance, it uses manual iterative calculations to handle dynamic anchor changes without repainting.
 Core Mechanics 
The indicator focuses on efficient AVWAP computation and deviation tracking:
Anchor Configuration: Five independent anchors, each with a name, UTC timestamp (e.g., "01 Oct 2025 00:00" for monthly open), show toggle, and color. Timestamps define the calculation start—e.g., AVWAP1 from "20 Oct 2025" onward.
AVWAP Calculation: For each enabled anchor, it identifies the first bar at/after the timestamp as the reset point, then iteratively accumulates (price * volume) / total volume from there. Uses HLC3 source (customizable); handles input changes by resetting sums on new anchors.
Deviation Metric: For each AVWAP, computes % deviation = ((close - AVWAP) / AVWAP) * 100—positive = above (potential resistance), negative = below (support).
Visuals: Plots lines (linewidth 1–2, user colors); dashboard (2 columns, 6 rows) shows names (anchor-colored if enabled) and deviations (green >0%, red <0%, gray N/A), positioned user-selectable with text sizing. Updates on last bar for efficiency.
This setup scales deviations across volatilities, aiding multi-period bias assessment.
 Why This Adds Value & Originality 
Standard VWAPs limit to session anchors (daily/weekly); deviation tools often lack multiples. This isn't a simple mashup: Manual iterative AVWAP (no built-in ta.vwap reliance) ensures dynamic resets on timestamp tweaks—e.g., shift "Event" to FOMC date without recalc lag. The 5-anchor flexibility (arbitrary UTC times) + centralized dashboard (colored deviations at a glance) creates a "global timeline scanner" unique to event-driven trading, unlike rigid multi-VWAP scripts. It streamlines what requires 5 separate indicators, with % normalization for cross-asset comparison (e.g., SPY vs. BTC).
 How to Use 
Setup: Overlay on chart. Configure anchors (e.g., Anchor1: "Weekly Open" at next Monday 00:00 UTC; enable/show 2–3 for focus). Set source (HLC3 default), position (Top Right), text size (Small).
Interpret Dashboard:
Left Column: Anchor names (e.g., "Monthly Open" in orange).
Right Column: Deviations (e.g., "+1.25%" green = above, bullish exhaustion?).
Scan for confluence (e.g., all >+2% = overbought).
Trading:
Lines: Price near AVWAP = mean reversion; breaks = momentum.
Example: -0.8% below "Event" anchor post-earnings → potential bounce buy.
Use on 1H–D; adjust timestamps via calendar.
Tips: Enable 1–3 anchors to avoid clutter; test on historical events.
 Limitations & Disclaimer 
AVWAPs reset on anchor bars, potentially lagging mid-period; deviations are % only (add ATR for absolute). Table updates on close (no intrabar). Timestamps must be UTC/future-proof. No alerts/exits—integrate manually. Not advice; backtest deviations on your assets. Past ≠ future. Comments for ideas.
Enhanced Trend & EMA Screener
Overview
Enhanced Trend & ML Screener is a multi-ticker overlay indicator that scans up to 8 symbols (e.g., SPY, QQQ, major tech stocks) across user-defined timeframes for trend signals via EMA crossovers, Ichimoku cloud positioning, ADX directionality, ATR volatility regimes, and linear regression slope (as a simple ML proxy for momentum). It generates a real-time dashboard summarizing bullish/bearish/neutral sentiments per metric, plus a debug table for raw values. Crossover labels and alerts highlight actionable events, making it a streamlined tool for portfolio monitoring and confluence hunting without manual chart-switching.
Core Mechanics
The screener processes each ticker in parallel, fetching data via secure requests (no lookahead bias):
EMA Crossovers: Monitors price crosses over/under EMAs (10, 21, 50, 89 periods)—e.g., close > EMA10 flags bullish momentum.
Ichimoku Sentiment: Scores cloud position (above both spans = Bullish 8/10; below = Bearish 2/10; inside = Neutral 5/10).
ADX Direction: Compares +DI/-DI for Bullish (up > down), Bearish (down > up), or Neutral.
ATR Regime: Normalizes ATR% vs. close; percentile ranks over lookback classify as Rising (high + increasing = Bullish), Falling (low + decreasing = Bearish), or Stable (Neutral).
ML Slope (Linear Regression): Computes 21-bar slope % (threshold 0% default); >0% = Bullish, <0% = Bearish, near-zero = Neutral.
MTF Trend: Pulls weekly ML slope for higher-timeframe bias. Data aggregates into a main dashboard (7 columns: Symbol, ML Trend, MTF, Ichimoku, ADX, ATR, Crossover) with color-coded cells (green/red for Bull/Bear, gray Neutral). A debug table lists prices, EMAs, and slopes. Plots include EMAs and LinReg line on the chart; labels mark crossovers (e.g., "AAPL ↑ EMA10").
 Why This Adds Value & Originality 
Basic screeners track one metric; multi-indicator ones overload. This fuses EMAs (momentum), Ichimoku (structure), ADX (strength), ATR (volatility), and LinReg (ML-like slope) into a unified sentiment matrix per ticker—e.g., AAPL showing Bullish across 5/6 metrics signals strong confluence. The MTF weekly overlay adds depth without extra charts, while percentile-based ATR avoids raw-value bias across assets. It's original for its compact, color-coded aggregation (no similar public script scans 8 tickers with this blend + debug view), reducing noise via thresholded LinReg and enabling quick "at-a-glance" portfolio scans.
How to Use
Setup: Add to any chart (overlay=true). Customize tickers (e.g., replace GOOGL with NVDA), timeframe (D default), periods (EMA 89 for long-term). Set LinReg threshold (0% for sensitive).
Interpret Dashboard:
Rows: Per-ticker sentiments (e.g., "Bullish" green for ML Trend if slope >0%).
Crossover Column: "↑ 50" for price > EMA50; "--" if none.
Scan for confluence (e.g., 4+ Bullish = long bias).
Debug Table: Raw values (e.g., EMA10=150.25) for verification.
Trading:
Labels/alerts on crossovers (e.g., "TSLA ↓ EMA21" warns downside).
Use MTF for bias (Weekly Bullish = favor longs).
Example: SPY all Bullish + ↑ EMA10 = portfolio buy signal.
Best For: Daily/weekly scans on indices/stocks; 1H–D timeframes.
 Limitations & Disclaimer 
Data lags by TF resolution; crossovers confirm on close (no repaint, but delayed). Sentiments are directional filters—not entries (pair with volume/SR). LinReg "ML" is basic regression, not trained model. Alerts once/bar close. No risk tools—use stops <1% risk. Not advice; backtest on your symbols. Feedback in comments.
The Bardan Bias IndicatorThis Bardan Bias Indicator analyzes pure daily chart momentum agnostically across any asset by employing a weighted scoring system based on three universal components: EMA alignment (20, 50, 100 periods), price position relative to these EMAs, and momentum indicators (RSI and MACD). The system objectively awards points for bullish configurations like stacked EMA alignment, price trading above key EMAs, and positive momentum readings, while deducting points for bearish setups, completely independent of the specific instrument. The total score normalizes to a 0-100 scale and classifies into five clear bias categories, providing a single, universal overlay that reveals the underlying daily trend direction for any tradable asset—from cryptocurrencies to stocks to forex—while effectively filtering out minor pullbacks and market noise.
Triangular Moving Average (TRIMA)The Triangular Moving Average (TRIMA) is a technical indicator that applies a triangular weighting scheme to price data, providing enhanced smoothing compared to simpler moving averages. Originating in the early 1970s as technical analysts sought more effective noise filtering methods, the TRIMA was first popularized through the work of market technician Arthur Merrill. Its formal mathematical properties were established in the 1980s, and the indicator gained widespread adoption in the 1990s as computerized charting became standard. TRIMA effectively filters out market noise while maintaining important trends through its unique center-weighted calculation method.
## Core Concepts
* **Double-smoothing process:** TRIMA can be viewed as applying a simple moving average twice, creating more effective noise filtering
* **Triangular weighting:** Uses a symmetrical weight distribution that emphasizes central data points and reduces emphasis toward both ends
* **Constant-time implementation:** Two $O(1)$ SMA passes with circular buffers preserve exact triangular weights while keeping update cost constant per bar
* **Market application:** Particularly effective for identifying the underlying trend in noisy market conditions where standard moving averages generate too many false signals
* **Timeframe flexibility:** Works across multiple timeframes, with longer periods providing cleaner trend signals in higher timeframes
The core innovation of TRIMA is its unique triangular weighting scheme, which can be viewed either as a specialized weight distribution or as a twice-applied simple moving average with adjusted period. This creates more effective noise filtering without the excessive lag penalty typically associated with longer-period averages. The symmetrical nature of the weight distribution ensures zero phase distortion, preserving the timing of important market turning points.
## Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|-----------|---------|----------|---------------|
| Length | 14 | Controls the lookback period | Increase for smoother signals in volatile markets, decrease for responsiveness |
| Source | close | Price data used for calculation | Consider using hlc3 for a more balanced price representation |
**Pro Tip:** For a good balance between smoothing and responsiveness, try using a TRIMA with period N instead of an SMA with period 2N - you'll get similar smoothing characteristics but with less lag.
## Calculation and Mathematical Foundation
**Simplified explanation:**
TRIMA calculates a weighted average of prices where the weights form a triangle shape. The middle prices get the most weight, and weights gradually decrease toward both the recent and older ends. This creates a smooth filter that effectively removes random price fluctuations while preserving the underlying trend.
**Technical formula:**
TRIMA = Σ(Price  × Weight ) / Σ(Weight )
Where the triangular weights form a symmetric pattern:
- Weight  = min(i, n-1-i) + 1
- Example for n=5: weights =  
- Example for n=4: weights =  
Alternatively, TRIMA can be calculated as:
TRIMA(source, p) = SMA(SMA(source, (p+1)/2), (p+1)/2)
> 🔍 **Technical Note:** The double application of SMA explains why TRIMA provides better smoothing than a single SMA or WMA. This approach effectively applies smoothing twice with optimal period adjustment, creating a -18dB/octave roll-off in the frequency domain compared to -6dB/octave for a simple moving average, and the current implementation achieves $O(1)$ complexity through circular buffers and NA-safe warmup compensation.
## Interpretation Details
TRIMA can be used in various trading strategies:
* **Trend identification:** The direction of TRIMA indicates the prevailing trend
* **Signal generation:** Crossovers between price and TRIMA generate trade signals with fewer false alarms than SMA
* **Support/resistance levels:** TRIMA can act as dynamic support during uptrends and resistance during downtrends
* **Trend strength assessment:** Distance between price and TRIMA can indicate trend strength
* **Multiple timeframe analysis:** Using TRIMAs with different periods can confirm trends across different timeframes
## Limitations and Considerations
* **Market conditions:** Like all moving averages, less effective in choppy, sideways markets
* **Lag factor:** More lag than WMA or EMA due to center-weighted emphasis
* **Limited adaptability:** Fixed weighting scheme cannot adapt to changing market volatility
* **Response time:** Takes longer to reflect sudden price changes than directionally-weighted averages
* **Complementary tools:** Best used with momentum oscillators or volume indicators for confirmation
## References
* Ehlers, John F. "Cycle Analytics for Traders." Wiley, 2013
* Kaufman, Perry J. "Trading Systems and Methods." Wiley, 2013
* Colby, Robert W. "The Encyclopedia of Technical Market Indicators." McGraw-Hill, 2002
Savitzky-Golay Filter (SGF)The Savitzky-Golay Filter (SGF) is a digital filter that performs local polynomial regression on a series of values to determine the smoothed value for each point. Developed by Abraham Savitzky and Marcel Golay in 1964, it is particularly effective at preserving higher moments of the data while reducing noise. This implementation provides a practical adaptation for financial time series, offering superior preservation of peaks, valleys, and other important market structures that might be distorted by simpler moving averages.
## Core Concepts
* **Local polynomial fitting:** Fits a polynomial of specified order to a sliding window of data points
* **Moment preservation:** Maintains higher statistical moments (peaks, valleys, inflection points)
* **Optimized coefficients:** Uses pre-computed coefficients for common polynomial orders
* **Adaptive weighting:** Weight distribution varies based on polynomial order and window size
* **Market application:** Particularly effective for preserving significant price movements while filtering noise
The core innovation of the Savitzky-Golay filter is its ability to smooth data while preserving important features that are often flattened by other filtering methods. This makes it especially valuable for technical analysis where maintaining the shape of price patterns is crucial.
## Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|-----------|---------|----------|---------------|
| Window Size | 11 | Number of points used in local fitting (must be odd) | Increase for smoother output, decrease for better feature preservation |
| Polynomial Order | 2 | Order of fitting polynomial (2 or 4) | Use 2 for general smoothing, 4 for better peak preservation |
| Source | close | Price data used for calculation | Consider using hlc3 for more stable fitting |
**Pro Tip:** A window size of 11 with polynomial order 2 provides a good balance between smoothing and feature preservation. For sharper peaks and valleys, use order 4 with a smaller window size.
## Calculation and Mathematical Foundation
**Simplified explanation:**
The filter fits a polynomial of specified order to a moving window of price data. The smoothed value at each point is computed from this local fit, effectively removing noise while preserving the underlying shape of the data.
**Technical formula:**
For a window of size N and polynomial order M, the filtered value is:
y  = Σ(c_i × x )
Where:
- c_i are the pre-computed filter coefficients
- x  are the input values in the window
- Coefficients depend on window size N and polynomial order M
> 🔍 **Technical Note:** The implementation uses optimized coefficient calculations for orders 2 and 4, which cover most practical applications while maintaining computational efficiency.
## Interpretation Details
The Savitzky-Golay filter can be used in various trading strategies:
* **Pattern recognition:** Preserves chart patterns while removing noise
* **Peak detection:** Maintains amplitude and width of significant peaks
* **Trend analysis:** Smooths price movement without distorting important transitions
* **Divergence trading:** Better preservation of local maxima and minima
* **Volatility analysis:** Accurate representation of price movement dynamics
## Limitations and Considerations
* **Computational complexity:** More intensive than simple moving averages
* **Edge effects:** First and last few points may show end effects
* **Parameter sensitivity:** Performance depends on appropriate window size and order selection
* **Data requirements:** Needs sufficient points for polynomial fitting
* **Complementary tools:** Best used with volume analysis and momentum indicators
## References
* Savitzky, A., Golay, M.J.E. "Smoothing and Differentiation of Data by Simplified Least Squares Procedures," Analytical Chemistry, 1964
* Press, W.H. et al. "Numerical Recipes: The Art of Scientific Computing," Chapter 14
* Schafer, R.W. "What Is a Savitzky-Golay Filter?" IEEE Signal Processing Magazine, 2011
Bilateral Filter (BILATERAL)The Bilateral Filter is an edge-preserving smoothing technique that combines spatial filtering with intensity filtering to achieve noise reduction while maintaining significant price structure. Originally developed in computer vision for image processing, this adaptive filter has been adapted for financial time series analysis to provide superior smoothing that preserves important market transitions. The filter intelligently reduces noise in stable price regions while preserving sharp transitions like breakouts, reversals, and other significant market structures that would be blurred by conventional filters.
## Core Concepts
* **Dual-domain filtering:** Combines traditional time-based (spatial) filtering with value-based (range) filtering for adaptive smoothing
* **Edge preservation:** Maintains important price transitions while aggressively smoothing areas of minor fluctuation
* **Adaptive processing:** Automatically adjusts filtering strength based on local price characteristics
The core innovation of the Bilateral Filter is its ability to distinguish between random noise and significant price movements. Unlike conventional filters that smooth everything equally, Bilateral filtering preserves major price transitions by reducing the influence of price points that differ significantly from the current price, effectively preserving market structure while still eliminating noise.
## Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|-----------|---------|----------|---------------|
| Length | 14 | Controls the lookback window size | Increase for more context in filtering decisions, decrease for quicker response |
| Sigma_S_Ratio | 0.3 | Controls spatial (time) weighting | Lower values emphasize recent bars, higher values distribute influence more evenly |
| Sigma_R_Mult | 2.0 | Controls range (price) sensitivity | Lower values increase edge preservation, higher values increase smoothing |
| Source | close | Price data used for calculation | Consider using hlc3 for a more balanced price representation |
**Pro Tip:** For breakout trading strategies, try reducing Sigma_R_Mult to 1.0-1.5 to make the filter more sensitive to significant price moves, allowing it to preserve breakout signals while still filtering noise.
## Calculation and Mathematical Foundation
**Simplified explanation:**
The Bilateral Filter calculates a weighted average of nearby prices, where the weights depend on two factors: how far away in time the price point is (spatial weight) and how different the price value is (range weight). Points that are close in time AND similar in value get the highest weight. This means stable price regions get smoothed while significant changes are preserved.
**Technical formula:**
BF  = (1 / Wp) × Σ_{q ∈ S} G_s(||p - q||) × G_r(|I  - I |) × I 
Where:
- G_s is the spatial Gaussian kernel: exp(-||p - q||² / (2 × σ_s²))
- G_r is the range Gaussian kernel: exp(-|I  - I |² / (2 × σ_r²))
- Wp is the normalization factor (sum of all weights)
> 🔍 **Technical Note:** The sigma_r parameter is typically calculated dynamically based on local price volatility (standard deviation) to provide adaptive filtering - this automatically adjusts filtering strength based on market conditions.
## Interpretation Details
The Bilateral Filter can be applied in various trading contexts:
* **Trend identification:** Reveals cleaner underlying price direction by removing noise while preserving trend changes
* **Support/resistance identification:** Provides clearer price levels by preserving significant turning points
* **Pattern recognition:** Maintains critical chart patterns while eliminating distracting minor fluctuations
* **Breakout trading:** Preserves sharp price transitions for more reliable breakout signals
* **Pre-processing:** Can be used as an initial filter before applying other technical indicators to reduce false signals
## Limitations and Considerations
* **Computational complexity:** More intensive calculations than traditional linear filters
* **Parameter sensitivity:** Performance highly dependent on proper parameter selection
* **Non-linearity:** Non-linear behavior may produce unexpected results in certain market conditions
* **Interpretation adjustment:** Requires different interpretation than conventional moving averages
* **Complementary tools:** Best used alongside volume analysis and traditional indicators for confirmation
## References
* Tomasi, C. and Manduchi, R. "Bilateral Filtering for Gray and Color Images," Proceedings of IEEE ICCV, 1998
* Paris, S. et al. "A Gentle Introduction to Bilateral Filtering and its Applications," ACM SIGGRAPH, 2008
Easy Read Short‑Term EMA CrossoverThis TradingView panel shows a multi-indicator setup for analyzing the S&P 500 Index (SPX):
Main chart (top): displays price candles with two Exponential Moving Averages (EMA 8 and 21). When the short-term EMA (blue) crosses above the long-term EMA (red), it gives a Buy signal; when it crosses below, a Sell signal appears — helping identify short-term trend shifts.
Middle panel: shows the Easy-Read RSI, highlighting overbought (OB) and oversold (OS) zones. When RSI moves above 70 it signals potential weakness (sell), and below 30 suggests a rebound zone (buy).
Bottom panel: plots the Easy-Read MACD, which tracks momentum by comparing short- and long-term moving averages. When the MACD line crosses above the Signal line, it indicates bullish momentum; crossing below suggests bearish momentum.
Together, these three indicators provide a layered view of trend, momentum, and potential entry/exit points.
Bardan Indicator 2.0 (Compact)Uses EMAs and SMAs anchored to both daily and weekly chart to determine bullish, bearish, or flat bias
EMA8/21+VWAP+MOM+ADX FilterEMA8/21 MTF Momentum-ADX Trade Assistant
This script is not a basic “EMA crossover” indicator. The goal is not just to flash a signal, but to provide an actual trade plan: entry, confirmation, stop, profit targets, and position management in one package.
1. Core Logic
The main trigger of the indicator is the EMA8 and EMA21 crossover:
When EMA8 crosses ABOVE EMA21 → potential LONG signal.
When EMA8 crosses BELOW EMA21 → potential EXIT / WEAKNESS signal.
This structure is designed to work on 30-minute and 60-minute charts.
Fast EMA: default 8
Slow EMA: default 21
Trend EMA: for 30m charts ~50–55, for 60m charts ~100 (this is adjustable via input)
2. Advanced confirmations for LONG entries
The LONG signal is not taken blindly at every crossover. It can be filtered (optionally) by several confirmation layers. All of these can be turned on/off from the inputs:
Momentum filter: Is price actually pushing, or did it just barely cross? A long is only confirmed if momentum is above a chosen threshold.
ADX / DMI filter: Is there real trend strength? The script can require ADX above a threshold and +DI > -DI (bullish directional bias). This helps avoid fake breakouts in choppy, sideways zones.
Relative Volume filter: Is there real participation behind the move? The script can require current volume to be at least X times the recent average volume (for example 1.5x the 20-bar average). This helps avoid signals that appear on “empty” volume.
Higher Timeframe Trend filter (MTF): Example: if you’re trading on the 30-minute chart, you can force longs to only trigger when the 60-minute trend is already bullish. This prevents going long against the dominant higher-timeframe direction. (On a 60m chart you might compare against 240m / 4h, etc.)
The purpose of these filters is:
→ When entering long, don’t just chase any crossover. Demand alignment in trend, strength, demand, and higher timeframe structure.
Note: These filters are independent. You are NOT forced to enable all of them at once. Different tickers behave differently. The user can decide which confirmations make sense for that specific instrument.
3. How does the SHORT/EXIT signal work?
The exit/weakness signal is intentionally kept simple:
When EMA8 crosses BELOW EMA21, the script immediately fires a signal.
No extra conditions (no momentum, no ADX, etc.).
You can treat this as “take profit / reduce risk / exit warning.”
Why is it designed like that?
When entering a position, you want to be very selective.
When protecting profit or cutting risk, you want to be fast, not slow.
So LONG entry is filtered and disciplined. EXIT warning is fast and blunt.
4. Trade management (automatic Stop / Targets / Trailing Stop)
When a confirmed LONG signal appears, the indicator does more than say “go long.” It also drafts a mini plan on the chart:
Entry: Uses the close of the signal candle as the assumed entry.
Stop: Default stop level is placed at (or near) the low of the signal candle.
TP1 (Partial Take Profit): A first target such as 1R (customizable). Think of this as partial take profit. When TP1 is reached, the label updates visually (e.g. “TP1 ✅”).
TP2 (Final target): A second target such as 2R (customizable). This is plotted separately with its own line and label.
Trailing Stop: While the position is “open,” the stop level can automatically trail upward as new higher lows form. The stop is never moved downward. You can turn trailing on/off.
All of these levels (Stop / TP1 / TP2) are drawn directly on the chart, with readable labels.
After an EXIT (bearish crossover) is triggered and the position is considered closed, those lines/labels are grayed out. Visually this makes it clear: “that trade is done.”
5. Position state tracking
The script internally tracks whether you are considered “in a position” or “flat”:
When a confirmed LONG triggers and you are not already in a position → it marks you as “in position.”
When an EXIT signal triggers → it marks you as flat / position closed.
While in position, it keeps updating Stop / TP levels and the trailing stop logic.
It will not spam repeated “long long long” signals every bar.
This makes the tool behave more like a lightweight trade assistant rather than a dumb arrow plotter.
6. How to actually use it
This tool does NOT force a single style. Instead, it gives you building blocks (filters and management rules) that you can mix depending on the instrument and market condition.
For example:
Profile A: Trend-Following / Swing-Style
ADX filter: ON
Higher Timeframe filter: ON
Momentum filter: ON
Relative Volume filter: optional
Larger R targets (TP2 ~2R or more), trailing stop ON
This profile is for cleaner, directional names that actually trend. You’re trying to ride continuation, not scalp noise.
Profile B: Intraday Momentum / One-Shot Burst
Momentum filter: ON
Relative Volume filter: ON (you want expansion in volume)
ADX filter: OFF (ADX often lags on the first impulse bar)
Higher Timeframe filter: can be looser if you’re just playing the spike
Focus on TP1 / fast partial exit more than holding forever
This profile tries to catch sharp breakouts that come with volume. You care about speed, not holding all day.
Profile C: Simple / Low-Stress Mode
Only Higher Timeframe filter: ON
Other filters: OFF
Idea: “I’ll only take longs if the bigger timeframe is already bullish. Otherwise I do nothing.”
This is useful when you don’t want to overthink. Fewer rules, less noise.
So in practice, instead of forcing the same confirmation stack on every ticker, you select the subset of filters that best fits how that ticker usually moves and how YOU want to trade it. That flexibility is intentional.
7. Time-of-day context
Signal quality is not only about technical conditions, it’s also about timing:
A “perfect” long setup in the first strong impulse of the session is not the same as a random crossover in low-liquidity midday chop.
Near the close, a signal might mean “carry this into the next session,” which is a different risk profile than a quick intraday scalp.
The script does not automatically block signals by session time, but you should treat early-session breakouts, midday noise, and late-session continuation differently in your decision-making. The filters (volume, higher timeframe alignment, ADX) help, but discretion about timing still matters.
8. Mental discipline
One very important workflow tip:
Before you take a trade, say (to yourself), which “profile” you are using.
For example:
“This is a Momentum Burst trade. I’m using volume + momentum. I only care about TP1. I’m not trying to swing this overnight.”
or
“This is a Trend-Follow trade. ADX is on, higher timeframe is aligned. I will trail this and aim for TP2.”
Why is this important?
It stops you from panicking mid-trade and changing your plan emotionally.
After 10–20 trades, you can review which profile actually performs for you. You’ll see which filters are truly adding edge, and which are just “comfort filters” that feel safe but don’t actually improve results.
That review is how this tool goes from “indicator” to “personal trading process.”
9. Disclaimer
This script is for educational and experimental trading workflow support.
It is NOT financial advice.
Trading involves significant risk. All decisions and outcomes are your own.
Do not use this live with real capital without forward testing and proper risk management.
Summary:
This script is not just an arrow that says “BUY/SELL.”
It’s a compact trade assistant built around the EMA8/21 structure.
It can:
filter long entries using momentum, ADX/DMI strength, higher timeframe alignment, and relative volume,
generate fast exit warnings on bearish cross,
automatically draw stop, TP1, TP2, and even trail the stop while the position is active,
and track whether you’re “in a trade” or flat.
You’re not forced into one rigid style. You choose which confirmation layers match the personality of the ticker you’re trading — and you get visual risk management on the chart.
EMA6 or SMA6 Touch AlertThis script monitors the market and notifies you whenever the price touches either the 6-period EMA or the 6-period SMA.
It helps identify potential pullbacks, reaction points, or entry zones, as price interaction with these moving averages often signals short-term market shifts.
What the script does:
Calculates the EMA 6 and SMA 6
Detects if price touches either moving average within the candle
Plots both lines on the chart for visibility
Allows you to set alerts to receive automatic notifications
Best suited for:
Scalping
Day Trading
Pullback Entries
Short-term trend reactions
Cyberbikes Adjustable 4x EMA + 4x SMAProbably the best EMA + SMA because you can choose the lenght of 8 different EMA and SMA.
By standard 9,21,80,200 EMA and SMA. Great for tradingview free users, many EMA and SMA in one indicator!
HEK Dynamic Price Channel StrategyHEK Dynamic Price Channel Strategy
Concept
The HEK Dynamic Price Channel provides a channel structure that expands and contracts according to price momentum and time-based equilibrium.
Unlike fixed-band systems, it evaluates the interaction between price and its balance line through an adaptive channel width that dynamically adjusts to changing market conditions.
How It Works
When the price reacts to the midline, the channel bands automatically reposition themselves.
Touching the upper band indicates a strengthening trend, while touching the lower band signals weakening momentum.
This adaptive mechanism helps filter out false signals during sudden directional changes, enhancing overall signal quality.
Advantages
✅ Maintains trend continuity while avoiding overtrading.
✅ Automatically adapts to changing volatility conditions.
✅ Detects early signals of short- and mid-term trend reversals.
Applications
Directional confirmation in spot and futures markets.
A supporting tool in channel breakout strategies.
Identifying price consolidation and equilibrium zones.
Note
This strategy is intended for educational and research purposes only.
It should not be considered financial advice. Always consult a professional financial advisor before making investment decisions.
© HEK — Adaptive Channel Approach on Dynamic Market Structures
(15M) Gold Daily Signal — Invite OnlyQuick Start 
Symbol XAUUSD, timeframe 15m.
Defaults: TP 50 pips, SL 150 pips.
Wait for green (long) or red (short) background after bar close.
Place orders at the plotted Entry / TP / SL; optional scale-ins at E1/E2.
Max signals kept on chart – housekeeping only (limits old drawings).
 Alerts 
Turn Green → ready-to-buy signal.
Turn Red → ready-to-sell signal.
Create alerts once per bar close and keep the default message or customize.
Multi-MA Multi-TFMulti-MA Multi-TF Indicator 
Visualize up to  8 customizable Moving Averages  across  multiple timeframes  directly on your current chart. This indicator is designed to provide a comprehensive overview of trend dynamics without cluttering your workspace with numerous separate indicators.
 Key Features: 
 
   Up to 8 Moving Averages:  Configure each MA individually.
   Flexible Configuration:  For each MA, independently set:
     
      Timeframe (5m, 15m, 1h, 4h, Daily, Weekly)
      MA Type (SMA or EMA)
      Length (Period)
      Line Width
      Color
      Whether to plot the MA line
      Whether to show the MA in the summary table
      Whether to display its label
     
   Informative Labels:  Optional labels appear next to the MA lines, displaying:
     
      MA identification (e.g., Daily EMA(9))
      Current MA value
      Optional percentage distance of the MA from the current price (+% if MA is above price, -% if MA is below).
     
   Label Only Mode:  Choose to display only the labels with short line segments, hiding the main MA lines for a cleaner look.
   Summary Table:  An optional table provides a quick overview of selected MAs:
     
      Lists the MA name (Timeframe, Type, Length).
      Shows the percentage distance from the current price, color-coded for clarity:
         
           Green ▲:  Price is currently  above  the MA.
           Red ▼:  Price is currently  below  the MA.
         
      Select which MAs appear in the table via individual MA settings.
      Position the table in any corner of the chart.
     
|Magical Trend Line with RSI & ADX|# 📊 Multi-Symbol RSI + ADX Trend Confirmation System  
### Adaptive Multi-Layer Trend Analyzer with EMA Structure, RSI Momentum, ADX Strength & Table Dashboard  
**Version:** 1.0 | **Language:** Pine Script v6 | **Author:** ask2maniish  
---
## 🔍 Summary of the Script
This indicator combines **EMA trend structure**, **RSI**, and **ADX** to form a **multi-layered trend confirmation system** with rich visual cues and a live table dashboard.
---
## 🧭 1. Trend Direction System
Uses **EMA Fast**, **EMA Slow**, and **Main EMA (default 100-period)** to detect the current trend structure.  
Classifies trends into 5 categories:
| Trend Type | Color | Description |
|-------------|--------|-------------|
| 🟢 Bright Green | Strong Bullish | Strong upside with momentum |
| 🟩 Green | Moderate Bullish | Controlled upward structure |
| ⚪ Gray | Sideways / Neutral | Low momentum or indecision |
| 🟧 Orange | Moderate Bearish | Controlled decline |
| 🔴 Red | Strong Bearish | Aggressive downward pressure |
---
## ⚙️ 2. RSI + ADX Momentum Filter
**RSI** detects momentum direction and exhaustion:  
- RSI > 70 → Overbought (Potential reversal)  
- RSI < 30 → Oversold (Potential reversal)  
- RSI rising above 50 → Bullish momentum  
- RSI falling below 50 → Bearish momentum  
**ADX** identifies trend strength:  
- ADX > 25 → Strong trend  
- ADX < 25 → Weak / ranging market  
✅ **Combined Logic:**  
RSI defines direction, ADX confirms strength.  
When both align with EMA structure, trend continuation probability increases.
---
## 📈 3. Multiple EMA Layers (7 Total)
Optionally visualize up to **7 EMAs (5, 8, 13, 21, 144-high, 144-close, 144-low)**.  
Each EMA auto-colors using localized slope and RSI/ADX confluence logic.  
Gives a clear view of **momentum stacking** and **trend maturity**.
---
## 📊 4. Trend Meter Table (HTF + LTF View)
A dynamic table provides both **current timeframe (LTF)** and **higher timeframe (HTF)** trend confirmation.  
| Table Section | Description |
|----------------|-------------|
| **Current TF Trend** | EMA-based directional bias |
| **HTF Trend** | Optional higher timeframe confirmation |
| **RSI Status** | Momentum context |
| **ADX Strength** | Trend power |
| **Overall Bias** | Combined directional strength |
🧩 Example:  
- ✅ Both LTF & HTF show Bullish → focus on longs.  
- ❌ Both Bearish → focus on shorts.  
- ⚪ Mixed → stand aside or scalp.
---
## 🎨 5. Background & Label System
- **Soft background shading** → shows live market bias.  
- **On-chart labels** → display EMA trend, RSI/ADX values, and crossover events.  
- **Color-coded EMA bands** → provide instant visual context.
---
## 🎯 How to Trade Using This Indicator
### 1️⃣ Identify Overall Market Context
Use the **Trend Meter Table** for directional bias.  
- ✅ Bullish on both TFs → Focus on long setups.  
- ❌ Bearish on both TFs → Focus on short setups.  
- ⚪ Mixed signals → Wait for clarity or scalp only.
---
### 2️⃣ Entry Logic
**Long Setup**
- Main EMA color = 🟢 Green or Bright Green  
- RSI rising above 50 (not yet overbought)  
- ADX > threshold (e.g., 25)  
- Price above both Fast & Slow EMA  
**Short Setup**
- Main EMA color = 🟧 Orange or 🔴 Red  
- RSI below 50 (not yet oversold)  
- ADX > threshold  
- Price below both Fast & Slow EMA  
---
### 3️⃣ Exit / Reversal
- RSI enters overbought/oversold zone → take profit or tighten stop.  
- Trend label shifts from “Strong” to “Moderate” → trend weakening.  
- Candle closes below/above EMA cluster → exit signal.  
---
### 4️⃣ Multi-Timeframe Confirmation
Always trade in the direction of **HTF bias**.  
Example:  
📍 On 15m → Confirm with 4H trend.  
If 4H = “Strong Bullish”, only take long entries when local (15m) = bullish.
---
## ⚡ Tips
- Use with Smart Money Concepts or liquidity tools for added confluence.  
- Works well for swing, intraday, and positional setups.  
- Adjust RSI/ADX thresholds to match volatility regime.
---
## 📘 Disclaimer
This indicator is for **educational purposes** only and does not constitute financial advice.  
Trade responsibly and use risk management at all times.
---
**© 2025 ask2maniish | Magical Trend Line with RSI & ADX**
Double Weighted Moving Average (DWMA)# DWMA: Double Weighted Moving Average
## Overview and Purpose
The Double Weighted Moving Average (DWMA) is a technical indicator that applies weighted averaging twice in sequence to create a smoother signal with enhanced noise reduction. Developed in the late 1990s as an evolution of traditional weighted moving averages, the DWMA was created by quantitative analysts seeking enhanced smoothing without the excessive lag typically associated with longer period averages. By applying a weighted moving average calculation to the results of an initial weighted moving average, DWMA achieves more effective filtering while preserving important trend characteristics.
## Core Concepts
* **Cascaded filtering:** DWMA applies weighted averaging twice in sequence for enhanced smoothing and superior noise reduction
* **Linear weighting:** Uses progressively increasing weights for more recent data in both calculation passes
* **Market application:** Particularly effective for trend following strategies where noise reduction is prioritized over rapid signal response
* **Timeframe flexibility:** Works across multiple timeframes but particularly valuable on daily and weekly charts for identifying significant trends
The core innovation of DWMA is its two-stage approach that creates more effective noise filtering while minimizing the additional lag typically associated with longer-period or higher-order filters. This sequential processing creates a more refined output that balances noise reduction and signal preservation better than simply increasing the length of a standard weighted moving average.
## Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|-----------|---------|----------|---------------|
| Length | 14 | Controls the lookback period for both WMA calculations | Increase for smoother signals in volatile markets, decrease for more responsiveness |
| Source | close | Price data used for calculation | Consider using hlc3 for a more balanced price representation |
**Pro Tip:** For trend following, use a length of 10-14 with DWMA instead of a single WMA with double the period - this provides better smoothing with less lag than simply increasing the period of a standard WMA.
## Calculation and Mathematical Foundation
**Simplified explanation:**
DWMA first calculates a weighted moving average where recent prices have more importance than older prices. Then, it applies the same weighted calculation again to the results of the first calculation, creating a smoother line that reduces market noise more effectively.
**Technical formula:**
```
DWMA is calculated by applying WMA twice:
1. First WMA calculation:
   WMA₁ = (P₁ × w₁ + P₂ × w₂ + ... + Pₙ × wₙ) / (w₁ + w₂ + ... + wₙ)
2. Second WMA calculation applied to WMA₁:
   DWMA = (WMA₁₁ × w₁ + WMA₁₂ × w₂ + ... + WMA₁ₙ × wₙ) / (w₁ + w₂ + ... + wₙ)
```
Where:
- Linear weights: most recent value has weight = n, second most recent has weight = n-1, etc.
- n is the period length
- Sum of weights = n(n+1)/2
**O(1) Optimization - Inline Dual WMA Architecture:**
This implementation uses an advanced O(1) algorithm with two complete inline WMA calculations. Each WMA uses the dual running sums technique:
1. **First WMA (source → wma1)**:
   - Maintains buffer1, sum1, weighted_sum1
   - Recurrence: `W₁_new = W₁_old - S₁_old + (n × P_new)`
   - Cached denominator norm1 after warmup
2. **Second WMA (wma1 → dwma)**:
   - Maintains buffer2, sum2, weighted_sum2
   - Recurrence: `W₂_new = W₂_old - S₂_old + (n × WMA₁_new)`
   - Cached denominator norm2 after warmup
**Implementation details:**
- Both WMAs fully integrated inline (no helper functions)
- Each maintains independent state: buffers, sums, counters, norms
- Both warm up independently from bar 1
- Performance: ~16 operations per bar regardless of period (vs ~10,000 for naive O(n²) implementation)
**Why inline architecture:**
Unlike helper functions, the inline approach makes all state variables and calculations visible in a single scope, eliminating function call overhead and making the dual-pass nature explicit. This is ideal for educational purposes and when debugging complex cascaded filters.
> 🔍 **Technical Note:** The dual-pass O(1) approach creates a filter that effectively increases smoothing without the quadratic increase in computational cost. Original O(n²) implementations required ~10,000 operations for period=100; this optimized version requires only ~16 operations, achieving a 625x speedup while maintaining exact mathematical equivalence.
## Interpretation Details
DWMA can be used in various trading strategies:
* **Trend identification:** The direction of DWMA indicates the prevailing trend
* **Signal generation:** Crossovers between price and DWMA generate trade signals, though they occur later than with single WMA
* **Support/resistance levels:** DWMA can act as dynamic support during uptrends and resistance during downtrends
* **Trend strength assessment:** Distance between price and DWMA can indicate trend strength
* **Noise filtering:** Using DWMA to filter noisy price data before applying other indicators
## Limitations and Considerations
* **Market conditions:** Less effective in choppy, sideways markets where its lag becomes a disadvantage
* **Lag factor:** More lag than single WMA due to double calculation process
* **Initialization requirement:** Requires more data points for full calculation, showing more NA values at chart start
* **Short-term trading:** May miss short-term trading opportunities due to increased smoothing
* **Complementary tools:** Best used with momentum oscillators or volume indicators for confirmation
## References
* Jurik, M. "Double Weighted Moving Averages: Theory and Applications in Algorithmic Trading Systems", Jurik Research Papers, 2004
* Ehlers, J.F. "Cycle Analytics for Traders," Wiley, 2013
Weighted Moving Average (WMA)This implementation uses O(1) algorithm that eliminates the need to loop through all period values on each bar. It also generates valid WMA values from the first bar and is not returning NA when number of bars is less than period.
## Overview and Purpose
The Weighted Moving Average (WMA) is a technical indicator that applies progressively increasing weights to more recent price data. Emerging in the early 1950s during the formative years of technical analysis, WMA gained significant adoption among professional traders through the 1970s as computational methods became more accessible. The approach was formalized in Robert Colby's 1988 "Encyclopedia of Technical Market Indicators," establishing it as a staple in technical analysis software. Unlike the Simple Moving Average (SMA) which gives equal weight to all prices, WMA assigns greater importance to recent prices, creating a more responsive indicator that reacts faster to price changes while still providing effective noise filtering.
## Core Concepts
* **Linear weighting:** WMA applies progressively increasing weights to more recent price data, creating a recency bias that improves responsiveness
* **Market application:** Particularly effective for identifying trend changes earlier than SMA while maintaining better noise filtering than faster-responding averages like EMA
* **Timeframe flexibility:** Works effectively across all timeframes, with appropriate period adjustments for different trading horizons
The core innovation of WMA is its linear weighting scheme, which strikes a balance between the equal-weight approach of SMA and the exponential decay of EMA. This creates an intuitive and effective compromise that prioritizes recent data while maintaining a finite lookback period, making it particularly valuable for traders seeking to reduce lag without excessive sensitivity to price fluctuations.
## Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|-----------|---------|----------|---------------|
| Length | 14 | Controls the lookback period | Increase for smoother signals in volatile markets, decrease for responsiveness |
| Source | close | Price data used for calculation | Consider using hlc3 for a more balanced price representation |
**Pro Tip:** For most trading applications, using a WMA with period N provides better responsiveness than an SMA with the same period, while generating fewer whipsaws than an EMA with comparable responsiveness.
## Calculation and Mathematical Foundation
**Simplified explanation:**
WMA calculates a weighted average of prices where the most recent price receives the highest weight, and each progressively older price receives one unit less weight. For example, in a 5-period WMA, the most recent price gets a weight of 5, the next most recent a weight of 4, and so on, with the oldest price getting a weight of 1.
**Technical formula:**
```
WMA = (P₁ × w₁ + P₂ × w₂ + ... + Pₙ × wₙ) / (w₁ + w₂ + ... + wₙ)
```
Where:
- Linear weights: most recent value has weight = n, second most recent has weight = n-1, etc.
- The sum of weights for a period n is calculated as: n(n+1)/2
- For example, for a 5-period WMA, the sum of weights is 5(5+1)/2 = 15
**O(1) Optimization - Dual Running Sums:**
The key insight is maintaining two running sums:
1. **Unweighted sum (S)**: Simple sum of all values in the window
2. **Weighted sum (W)**: Sum of all weighted values
The recurrence relation for a full window is:
```
W_new = W_old - S_old + (n × P_new)
```
This works because when all weights decrement by 1 (as the window slides), it's mathematically equivalent to subtracting the entire unweighted sum. The implementation:
- **During warmup**: Accumulates both sums as the window fills, computing denominator each bar
- **After warmup**: Uses cached denominator (constant at n(n+1)/2), updates both sums in constant time
- **Performance**: ~8 operations per bar regardless of period, vs ~100+ for naive O(n) implementation
> 🔍 **Technical Note:** Unlike EMA which theoretically considers all historical data (with diminishing influence), WMA has a finite memory, completely dropping prices that fall outside its lookback window. This creates a cleaner break from outdated market conditions. The O(1) optimization achieves 12-25x speedup over naive implementations while maintaining exact mathematical equivalence.
## Interpretation Details
WMA can be used in various trading strategies:
* **Trend identification:** The direction of WMA indicates the prevailing trend with greater responsiveness than SMA
* **Signal generation:** Crossovers between price and WMA generate trade signals earlier than with SMA
* **Support/resistance levels:** WMA can act as dynamic support during uptrends and resistance during downtrends
* **Moving average crossovers:** When a shorter-period WMA crosses above a longer-period WMA, it signals a potential uptrend (and vice versa)
* **Trend strength assessment:** Distance between price and WMA can indicate trend strength
## Limitations and Considerations
* **Market conditions:** Still suboptimal in highly volatile or sideways markets where enhanced responsiveness may generate false signals
* **Lag factor:** While less than SMA, still introduces some lag in signal generation
* **Abrupt window exit:** The oldest price suddenly drops out of calculation when leaving the window, potentially causing small jumps
* **Step changes:** Linear weighting creates discrete steps in influence rather than a smooth decay
* **Complementary tools:** Best used with volume indicators and momentum oscillators for confirmation
## References
* Colby, Robert W. "The Encyclopedia of Technical Market Indicators." McGraw-Hill, 2002
* Murphy, John J. "Technical Analysis of the Financial Markets." New York Institute of Finance, 1999
* Kaufman, Perry J. "Trading Systems and Methods." Wiley, 2013






















