REJECTION DETECTOR🔥 CTR (Candle Terjepit - Rejection)
This indicator is specifically designed to detect Rejection Candles, which are moments when the price rejects a certain level and has the potential to form a strong reversal or rapid reaction — an important signal for scalpers and price action traders.
💡 Key Concept:
Rejection is a form of market reaction to areas of liquidity, support-resistance, or order block zones. Candles with long tails and small bodies indicate an imbalance between buyers and sellers, providing an early indication that the price may soon reverse.
⚙️ Key Features
🔍 Automatic Rejection Candle Detection (Buy & Sell)
🧠 Body-to-tail ratio filter for more precise signal validation
🎨 Customizable candle colors and appearance
📊 Suitable for all pairs and timeframes
Indicadores e estratégias
Quantura - Trendchange ZonesIntroduction
“Quantura – Trendchange Zones” is an advanced technical indicator that identifies and visualizes potential market reversal zones using dynamic RSI-based logic. It highlights areas of overbought and oversold conditions, marking them as visual zones directly on the price chart, and generates corresponding bullish and bearish signals when the RSI exits these extremes. The tool helps traders anticipate possible trend change regions and confirm momentum shifts in a clean, intuitive way.
Originality & Value
Unlike traditional RSI indicators that only show a static oscillator, this tool transforms RSI behavior into on-chart visual zones that represent structural overbought and oversold phases. It converts RSI threshold breaches into price-based regions (boxes) and marks reversal signals at the moment of momentum change.
The indicator’s originality and usefulness come from its:
Direct visualization of RSI overbought and oversold areas as dynamic chart zones.
Automatic detection of potential reversal regions where momentum exhaustion is likely.
Integration of RSI-based signals and visual cues without requiring users to monitor the RSI window.
Adjustable sensitivity for RSI length and upper/lower levels.
Clear color-coded separation of bullish and bearish phases.
Functionality & Core Logic
The indicator continuously monitors RSI values relative to the user-defined thresholds.
When RSI moves above the upper level, an Overbought Zone is created and extends until RSI falls back below that threshold.
When RSI moves below the lower level, an Oversold Zone is generated and extends until RSI returns above that level.
When RSI exits one of these zones, a corresponding Trendchange Signal (▲ bullish or ▼ bearish) appears at the transition point.
Each zone dynamically adjusts its high and low levels during formation, representing the complete range of the exhaustion phase.
Parameters & Customization
RSI Length: Defines the sensitivity of RSI calculation. Shorter lengths make signals more responsive; longer lengths filter noise.
Upper Level / Lower Level: Set thresholds for overbought and oversold conditions (default 70 / 30).
Signals: Toggle on/off for displaying bullish (▲) and bearish (▼) reversal signals.
Zones: Toggle the visualization of shaded RSI-based zones.
Colors: Fully customizable bullish and bearish colors for both signals and zones.
Visualization & Display
Bullish reversal zones (oversold exits) are shaded using the chosen bullish color (default: blue).
Bearish reversal zones (overbought exits) are shaded using the chosen bearish color (default: red).
Each completed zone is outlined and filled with transparent shading for better clarity.
Reversal arrows (▲ for bullish, ▼ for bearish) are displayed at the bar where RSI exits the extreme level.
Clean overlay design ensures compatibility with any chart style or color scheme.
Use Cases
Identify overbought and oversold periods directly on the price chart without switching to the RSI window.
Anticipate potential market reversals or exhaustion points based on RSI momentum shifts.
Combine with trend indicators, moving averages, or volume tools for confirmation.
Apply across multiple timeframes to align short-term reversal signals with higher timeframe momentum.
Use zone width and duration to assess the strength and persistence of overbought/oversold conditions.
Limitations & Recommendations
The indicator is not a standalone trading system but a visual confirmation tool.
False signals may occur in strongly trending markets where RSI remains overextended.
Optimal RSI settings may differ between assets (e.g., crypto vs. equities).
Combining this indicator with additional trend or structure filters can enhance accuracy.
Markets & Timeframes
The “Quantura – Trendchange Zones” indicator works across all markets and timeframes, including cryptocurrencies, Forex, stocks, and commodities. It is suitable for both short-term scalping and long-term swing analysis.
Author & Access
Developed 100% by Quantura. Published as a Open-source script indicator. Access is free.
Important
This description complies with TradingView’s Script Publishing and House Rules. It provides a clear explanation of the indicator’s originality, logic, and function while avoiding unrealistic performance or predictive claims.
Quantura - Supply & Demand Zone DetectionIntroduction
“Quantura – Supply & Demand Zone Detection” is an advanced indicator designed to automatically detect and visualize institutional supply and demand zones, as well as breaker blocks, directly on the chart. The tool helps traders identify key areas of market imbalance and potential reversal or continuation zones, based on price structure, volume, and ATR dynamics.
Originality & Value
This indicator provides a unique and adaptive method of zone detection that goes beyond simple pivot or candle-based logic. It merges multiple layers of confirmation—volume sensitivity, ATR filters, and swing structure—while dynamically tracking how zones evolve as the market progresses. Unlike traditional supply and demand indicators, this script also detects and plots Breaker Zones when previous imbalances are violated, giving traders an extra layer of market context.
The key values of this tool include:
Automated detection of high-probability supply and demand zones.
Integration of both volume and ATR filters for precision and adaptability.
Dynamic zone merging and updating based on price evolution.
Identification of breaker blocks (invalidated zones) to visualize market structure shifts.
Optional bullish and bearish trade signals when zones are retested.
Clear, visually optimized plotting for efficient chart interpretation.
Functionality & Core Logic
The indicator continuously scans recent price data for swing highs/lows and combines them with optional volume and ATR conditions to validate potential zones.
Demand Zones are formed when price action indicates accumulation or a strong bullish rejection from a low area.
Supply Zones are created when distribution or strong bearish rejection occurs near local highs.
Breaker Blocks appear when existing zones are invalidated by price, helping traders visualize potential market structure shifts.
Bullish and bearish signals appear when price re-enters an active zone or breaks through a breaker block.
Parameters & Customization
Demand Zones / Supply Zones: Enable or disable each individually.
Breaker Zones: Activate breaker block detection for invalidated zones.
Volume Filter: Optional filter to only confirm zones when volume exceeds its long-term average by a user-defined multiplier.
ATR Filter: Optional filter for volatility confirmation, ensuring zones form under strong momentum conditions.
Swing Length: Controls the number of bars used to detect structural pivots.
Sensitivity Controls: Adjustable ATR and volume multipliers to fine-tune detection responsiveness.
Signals: Toggle for on-chart bullish (▲) and bearish (▼) signal plotting when price interacts with zones.
Color Customization: User-defined bullish and bearish colors for both standard and breaker zones.
Core Calculations
Zones are detected using pivot highs and lows with a defined lookback and lookahead period.
Additional filters apply if ATR and volume are enabled, requiring conditions like “ATR > average * multiplier” and “Volume > average * multiplier.”
Detected zones are merged if overlapping, keeping the chart clean and logical.
When price breaks through a zone, the original box is closed, and a new breaker zone is plotted automatically.
Bullish and bearish markers appear when zones are retested from the opposite side.
Visualization & Display
Demand zones are shaded in semi-transparent bullish color (default: blue).
Supply zones are shaded in semi-transparent bearish color (default: red).
Breaker zones appear when previous imbalances are broken, helping to spot structural shifts.
Optional arrows (▲ / ▼) indicate potential buy or sell reactions on zone interaction.
Use Cases
Identify institutional areas of accumulation (demand) or distribution (supply).
Detect potential breakout traps and market structure shifts using breaker zones.
Combine with other tools such as volume profile, EMA, or liquidity indicators for deeper confirmation.
Observe retests and reactions of zones to anticipate possible reversals or continuations.
Apply multi-timeframe analysis to align higher timeframe zones with lower timeframe entries.
Limitations & Recommendations
The indicator does not predict future price movement; it highlights structural imbalances only.
Performance depends on chosen swing length and sensitivity—users should optimize parameters for each market.
Works best in volatile markets where supply and demand imbalances are clearly expressed.
Should be used as part of a broader trading framework, not as a standalone signal generator.
Markets & Timeframes
The “Quantura – Supply & Demand Zone Detection” indicator is suitable for all asset classes including cryptocurrencies, Forex, indices, commodities, and equities. It performs reliably across multiple timeframes, from intraday scalping to higher timeframe swing analysis.
Author & Access
Developed 100% by Quantura. Published as a Open-source script indicator. Access is free.
Important
This description complies with TradingView’s Script Publishing and House Rules. It clearly explains the indicator’s originality, underlying logic, functionality, and intended use without unrealistic claims or performance guarantees.
Quantura - Liquidity Sweep & Run LevelsIntroduction
“Quantura – Liquidity Sweep & Run Levels” is a structural price-action indicator designed to automatically detect swing-based liquidity zones and visualize potential sweep and run events. It helps traders identify areas where liquidity has likely been taken (sweep) or released (run), improving precision in market structure analysis and timing of entries or exits.
Originality & Value
This tool translates institutional liquidity concepts into an automated visual framework. Instead of simply marking highs and lows, it dynamically monitors swing points, tracks their breaches, and identifies subsequent reactions. The indicator is built to highlight the liquidity dynamics that often precede reversals or continuations.
Its originality lies in:
Automatic identification and tracking of swing highs and lows.
Real-time detection of broken levels and liquidity sweeps.
Distinction between “Run” and “Sweep” modes for different market behaviors.
Persistent historical visualization of liquidity levels using clean line structures.
Configurable signal markers for bullish and bearish sweep confirmations.
Functionality & Core Logic
Detects swing highs and lows using a user-defined Swing Length parameter.
Stores and updates all swing levels dynamically with arrays for efficient memory handling.
Draws horizontal lines from each detected swing point to visualize potential liquidity zones.
Monitors when price breaks a swing level and marks that event as “broken.”
Generates signals when the market either sweeps above/below or runs away from those levels, depending on the chosen mode.
Provides optional visual signal markers (“▲” for bullish sweeps, “▼” for bearish sweeps).
Parameters & Customization
Mode: Choose between “Sweep” (detects liquidity grabs) or “Run” (detects breakout continuations).
Swing Length: Sets the sensitivity for detecting swing highs/lows. A higher value focuses on larger structures, while smaller values detect micro liquidity points.
Bullish Color / Bearish Color: Customize color themes for sweep/run lines and signal markers.
Signals: Enables or disables visual up/down markers for confirmed events.
Visualization & Display
Horizontal lines represent potential liquidity levels (unbroken swing highs/lows).
Once broken, lines automatically stop extending, marking the moment liquidity is taken.
Depending on the selected mode:
“Sweep” mode identifies false breaks or stop-hunt behavior.
“Run” mode highlights breakouts that continue the trend.
Colored arrows indicate the direction and type of liquidity reaction.
Clean, non-intrusive visualization suitable for overlaying on price charts.
Use Cases
Detect liquidity sweeps before major reversals.
Identify breakout continuations after liquidity runs.
Combine with Supply/Demand or FVG indicators for multi-layered confirmation.
Validate liquidity bias in algorithmic or discretionary strategies.
Analyze market manipulation patterns and institutional stop-hunting behavior.
Limitations & Recommendations
This indicator identifies structural behavior but does not guarantee trade direction or profitability.
Works best on liquid markets with clear swing structures (e.g., crypto, forex, indices).
Signal interpretation should be combined with confluence tools such as volume, order flow, or structure-based filters.
Excessively small swing settings may cause over-signaling in volatile markets.
Markets & Timeframes
Optimized for all major asset classes — including crypto, Forex, indices, and equities — and for intraday to higher-timeframe structural analysis (5-minute up to daily charts).
Author & Access
Developed 100% by Quantura. Published as a Open-source script indicator. Access is free.
Compliance Note
This description fully complies with TradingView’s Script Publishing Rules and House Rules . It avoids performance claims, provides transparency on methodology, and clearly describes indicator behavior and limitations.
MPO4 Lines – Modal Engine█ OVERVIEW
MPO4 Lines – Modal Engine is an advanced multi-line modal oscillator for TradingView, designed to detect momentum shifts, trend strength, and reversal points through candle-based pressure analysis with multiple fast lines and a reference slow line. It features divergence detection on Fast Line A, overbought/oversold return signals, dynamic coloring modes, and layered gradient visualizations for enhanced clarity and decision-making.
█ CONCEPT
The indicator is built upon the Market Pressure Oscillator (MPO) and serves as its expanded evolution, aimed at enabling broader market analysis through multiple lines with varying parameters. It calculates modal pressure using candle body size and direction, weighted against average body size over a lookback period, then normalized and smoothed via EMA. It generates four distinct oscillator lines: a heavily smoothed Slow Line (trend reference), two Fast Lines (A & B) for momentum and support/resistance, and an optional Line 4 for additional confirmation. Divergence is calculated solely on Fast Line A, with visual gradients between lines and bands for intuitive interpretation.
█ WHY USE IT?
- Multi-Layer Momentum: Combines slow trend reference with dual fast lines for precise entry/exit timing.
- Divergence Precision: Bullish/bearish divergences on Fast Line A with labeled confirmation.
- OB/OS Return Signals: Clear buy/sell markers when Fast Line A exits oversold/overbought zones.
- Dynamic Visuals: Gradient fills, line-to-line shading, and band gradients for instant market state recognition.
- Flexible Coloring: Slow Line color by direction or zero-position; fast lines by sign.
- Full Customization: Independent lengths, smoothing, visibility, and transparency — by adjusting the lengths of different lines, you can tailor results for various strategies; for example, enabling Line 4 and tuning its length allows trading based on crossovers between different lines.
█ HOW IT WORKS?
- Candle Pressure Calculation: Body = math.abs(close - open); avgBody = ta.sma(body, len). Direction = +1 (bull), –1 (bear), 0 (neutral). Weight = body / avgBody. Contribution = direction × weight.
- Rolling Sum & Normalization: Sums contributions over lookback, normalizes to ±100 scale (÷ (len × 2) × 100).
Smoothing: Applies primary EMA (smoothLen), with extra EMA on Slow Line for stability.
Line Structure:
- Slow Line = calcCPO(len1=20, smoothLen1=5) → extra EMA (5)
- Fast Line A = calcCPO(len2=6, smoothLen2=7)
- Fast Line B = calcCPO(len3=6, smoothLen3=10)
- Line 4 = calcCPO(len4=14, smoothLen4=1)
Divergence Detection: Uses ta.pivothigh/low on price and Fast Line A (pivotLength left/right). Bullish: lower price low + higher osc low. Bearish: higher price high + lower osc high. Valid within 5–60 bar window.
Signals:
- Buy: Fast Line A crosses above oversold (–30)
- Sell: Fast Line A crosses below overbought (+30)
- Slow Line color flip (direction or zero-cross)
- Divergence labels ("Bull" / "Bear")
- Band Coloring as Momentum Signal:
When Fast Line A ≤ Fast Line B → Overbought band turns red (bearish pressure building)
When Fast Line A > Fast Line B → Oversold band turns green (bullish pressure building) This dynamic coloring serves as visual confirmation of momentum shift following fast line crossovers
Visualization:
- Gradients: Fast B → Zero (multi-layer fade), Fast A ↔ B fill, OB/OS bands
- Dynamic colors: Green/red based on sign or trend
- Zero line + dashed OB/OS thresholds
Alerts: Trigger on OB/OS returns, Slow Line changes, and divergences.
█ SETTINGS AND CUSTOMIZATION
- Line Visibility: Toggle Slow, Fast A, Fast B, Line 4 independently.
Line Lengths:
- Slow Line: Base (20), Primary EMA (5), Extra EMA (5)
- Fast A: Lookback (6), EMA (7)
- Fast B: Lookback (6), EMA (10)
- Line 4: Lookback (14), EMA (1)
- Slow Line Coloring Mode: “Direction” (trend-based) or “Position vs Zero”.
- Bands & Thresholds: Overbought (+30), Oversold (–30), step 0.1.
- Signals: Enable Fast A OB/OS return markers (default: on).
- Divergence: Enable/disable, Pivot Length (default: 2, min 1).
- Colors & Appearance: Full control over bullish/bearish hues for all lines, zero, bands, divergence, and text.
Gradients & Transparency:
- Fast B → Zero: 75 (default)
- Fast A ↔ B fill: 50
- Band gradients: 40
- Toggle each gradient independently
█ USAGE EXAMPLES
The indicator allows users to configure various strategies manually, though no built-in alerts exist for them. Entry signals can include color of fast lines, crossovers between different lines, alignment of colors across lines, or consistency in direction.
- Trend Confirmation: Slow Line above zero + green = bullish bias; below + red = bearish.
- Entry Timing: Buy on Fast A crossing above –30 (circle marker), especially if Slow Line is rising or near zero.
- Reversal Setup: Bullish divergence (“Bull” label) + Fast A in oversold + green gradient band = high-probability long.
- Scalping: Fast A vs Fast B crossover in direction of Slow Line trend.
- Noise Reduction: Increase extraSmoothLen on Slow Line
█ USER NOTES
- Best combined with volume, support/resistance, or trend channels.
- Adjust lookback and smoothing to asset volatility.
- Divergence delay = pivotLength; plan entries accordingly.
Fat Tony's Composite Momentum + ROC (v0.4)Fat Tony's Composite Momentum + ROC Indicator
Overview
Fat Tony's Composite Momentum + ROC is a sophisticated momentum oscillator that combines multiple technical indicators into a single, volume-weighted signal. This indicator helps traders identify overbought/oversold conditions and potential reversal points by synthesizing Williams %R, Stochastic, MACD, and Rate of Change (ROC) into one composite reading.
Key Features
Multi-Indicator Composite: Combines Williams %R, Stochastic %K, MACD Histogram, and ROC for a comprehensive momentum view
Volume Weighting: Optional volume-based amplification to filter out low-conviction moves
Volume Filter: Requires minimum volume threshold (last 2 bars combined) before triggering signals
Adaptive MACD Scaling: Uses tanh normalization to keep MACD contribution proportional regardless of price volatility
Clear Visual Signals: Triangle markers appear only when crossing extreme levels with sufficient volume
Customizable Thresholds: Adjust overbought/oversold levels, volume sensitivity, and component lengths
How It Works
The indicator normalizes each component to a ±50 scale, then averages them together. The composite reading oscillates around zero, with positive values indicating bullish momentum and negative values indicating bearish momentum.
Signal Generation:
🟢 Rebound Watch (Green Triangle): Fires when the composite crosses UP through the oversold level with adequate volume
🔴 Fade Watch (Red Triangle): Fires when the composite crosses DOWN through the overbought level with adequate volume
Customizing Settings
After adding to your chart, click the gear icon next to the indicator name to access settings:
Length: Base period for Williams %R and Stochastic (default: 14)
MACD Fast/Slow/Signal: Standard MACD parameters (default: 12/26/9)
Overbought/Oversold Levels: Threshold values for signals (default: ±100)
Use Volume Weighting: Toggle volume amplification on/off
Volume Sensitivity: Multiplier for volume weighting (default: 1.5)
Include ROC: Toggle Rate of Change component on/off
ROC Length: Lookback period for ROC calculation (default: 10)
Minimum Volume: Required volume (sum of last 2 bars) for signals to trigger (default: 50,000)
Usage Tips
Works best on liquid instruments with consistent volume
Lower timeframes (5m-15m) benefit from higher minimum volume settings
Volume weighting helps filter out noise during consolidation periods
Watch for signal triangles at key support/resistance levels for highest probability setups
The indicator works as a momentum gauge and reversal spotter - not an entry system by itself
Alerts
The indicator includes built-in alert conditions:
Click the "⏰" (alarm clock) icon on your chart
Select "Fat Tony's Composite Momentum + ROC"
Choose "Rebound Watch" or "Fade Watch"
Configure your notification preferences
Directional Strength and Momentum Index█ OVERVIEW
“Directional Strength and Momentum Index” (DSMI) is a technical analysis indicator inspired by DMI, but due to different source data, it produces distinct results. DSMI combines direction measurement, trend strength, and overheat levels into a single index, enhanced with gradient fills, extreme zones, entry signals, candle coloring, and a summary table.
█ CONCEPT
The classic DMI, despite its relatively simple logic, can seem somewhat chaotic due to separate +DI and -DI lines and the need for manual interpretation of their relationships. The DSMI indicator was created to increase clarity and speed up results, consolidating key information into a single index from 0 to 100 that simultaneously:
- Indicates trend direction (bullish/bearish)
- Measures movement strength
- Identifies overheat levels
- Generates ready entry signals
DMI (ADX + +DI / -DI) measures trend direction and strength, but does so based solely on comparing price movements between candles. ADX shows whether the trend is orderly and growing (e.g., above 20–30), but does not assess how dynamic the movement is.
DSMI, on the other hand, takes into account candle size and actual market aggression, thus showing directional momentum — whether the trend has real “fuel” to sustain or accelerate, not just whether it is orderly.
The main calculation difference involves replacing True Range with candle size (high-low) and using directional EMA instead of Wilder smoothing. This allows DSMI to react faster to momentum changes, eliminating delays typical of classic DMI based on TR.
This gives the trader an immediate picture of the market situation without analyzing multiple lines.
█ FEATURES
DSMI Main Line:
- EMA(Directional Index) based on +DS and -DS
- Scale 0–100, smooth color gradient depending on strength
+DS / -DS:
- Positive and Negative Directional Strength
- Gradient fill between lines — more intense with stronger trend
Extreme Zones:
- Default 20 and 80
- Gradient fill outside zones
Trend Strength Levels:
- Weak (<10) → neutral
- Moderate (up to 35)
- Strong (up to 45)
- Overheated (up to 55)
- Extreme (>55)
All levels editable
Entry Signals:
- Activated on crossing entry level (default 20)
Or on direction change when DSMI already ≥ entry level
- Highlighted background (green/red)
Candle Coloring:
- According to current trend
Trend Strength Table:
- Top-right corner
- Shows current strength (WEAK/STRONG etc.) + DSMI value
Alerts:
- DSMI Bullish Entry
- DSMI Bearish Entry
█ HOW TO USE
Add to Chart: Paste code in Pine Editor or find in indicator library.
Settings:
DSMI Parameters:
- DSMI Period → default 20
- Show DSMI Line → on/off
Extreme Zones:
- Lower Level → default 20
- Upper Level → default 80
Trend Strength Levels:
- Weak, Moderate, Strong, Overheated → adjust to strategy
Trend Colors:
- BULLISH → default green
- BEARISH → default red
- NEUTRAL → gray
Entry Signals:
- Show Highlight → on/off
- DSMI Entry Level → default 20
Signal Interpretation:
- DSMI Line: Main strength indicator.
- Gradient between +DS and -DS: Visualizes side dominance.
- Crossing 18 with direction confirmation → entry signal.
- Extreme Zones: Potential reversal or continuation points after correction.
- Table: Quick overview of current trend condition.
█ APPLICATIONS
The indicator works well in:
- Trend-following: Enter on signal, exit on direction change or overheat. When a new trend appears, consider entering a position, preferably with a rising trend strength indicator.
- Scalping/daytrading: Shorter period (7–10), lower entry level.
- Swing/position: Longer period (20–30), higher entry level, extreme zones as filters.
- Noise filtering: Ignores consolidation below “Weak” – increasing value e.g. to 15 highlights consolidation zones, but no signals appear there.
Style Adjustment:
- Aggressive strategies → shorten period and entry level
- Conservative → extend period, raise entry level (25–30), watch “Overheated”
“Weak” level (<10 default) → neutral; increasing it e.g. to 15 gives fewer but higher-quality signals. The Weak zone value controls the level below which no signals appear, and the gradient turns gray (often aligned with consolidation zones).
Combine with:
- Support/resistance levels
- Fair Value Gaps (FVG)
- Volume (Volume Profile, VWAP)
- Other oscillators (RSI, Stochastic)
█ NOTES
- Works on all markets and timeframes.
- Adjust period and levels to instrument volatility.
- Higher entry level → fewer signals, higher quality.
- Neutral color below “Weak” – avoids trading in consolidation.
- Gradient and table enable quick assessment without line analysis.
Ronin Pro Ichimoku Analyzer + ATRRonin Pro Ichimoku Analyzer is a refined Ichimoku-based decision tool designed to read trend strength, momentum shifts, and breakout conditions with clarity.
• It adapts the Kumo cloud dynamically — thickness and trend strength change the cloud’s transparency and color.
• Highlights Tenkan/Kijun crosses and Chikou confirmation to help filter noise.
• Includes optional ATR trailing stop for risk control.
• Shows long/short signals directly on the chart.
• Offers an on-chart analysis table summarizing the current market state in real time.
Traderei SessionsTraderei Sessions shows the previous daily H/L + previous weekly H + L, daily open from the current day, the H/L from Asia/London/NY Session, including the 50% Level for Premium or Discount Price.
VPOC for each Session. VPOC do not work on FX ! only Crypto + Gold !
2 EMAs and 1 SMA, + 1 additional EMA/SMA.
default settings for EMA 20/50, SMA 200
all lines, labels can be toggled
MACD Remastered [CHE]MACD Remastered — Robust MACD with confirmed pivot-based divergence, optional signal bands, and ready-to-use alerts.
Summary
This indicator augments classic MACD with a robust, confirmed pivot-based divergence engine and an optional signal channel using Bollinger Bands. Divergence signals are only produced after a pivot is confirmed, which reduces noise from transient swings. A line-of-sight clearance check filters cases where the MACD histogram path contradicts the divergence, further cutting false flags. Histogram coloring clarifies momentum changes, while optional triangles project the same signals onto the main chart for quick context.
Motivation: Why this design?
Standard MACD divergence tools tend to fire early in volatile phases and flip during consolidation. The core idea here is to delay decision points until a pivot is confirmed and to validate the path between pivots. This addresses fake flips and improves signal credibility at the cost of some latency. Optional bands around the Signal line add context about compression and expansion without altering MACD’s core behavior.
What’s different vs. standard approaches?
Reference baseline: Classical MACD (fast and slow moving averages, Signal line, histogram) with simple divergence checks.
Architecture differences:
Confirmed pivot logic with left and right bars.
Line-of-sight clearance test across the histogram path between pivots.
Optional Signal-line Bollinger Bands with configurable length and width.
Composite “Any Divergence” alert plus separate regular and hidden alerts.
Optional main-chart triangles using forced overlay for at-a-glance context.
Practical effect: Fewer early or contradictory divergence signals, clearer momentum context via histogram colors and a visible Signal channel during compression and expansion.
How it works (technical)
The MACD line derives from a fast and a slow moving average on a chosen source. The Signal line smooths the MACD line using a selected moving average type and length. The histogram is the difference between MACD and Signal and is colored by direction and acceleration.
Divergence uses confirmed pivots: a pivot forms only after a set number of bars on the right side, so the event is locked in. The engine retrieves the last two relevant pivots and checks price movement versus the MACD histogram movement to classify regular or hidden divergence. A line-of-sight clearance routine traverses the histogram path between the two pivots and rejects the signal if the path invalidates the directional relationship. When enabled, Bollinger Bands are plotted around the Signal line; width scales with standard deviation. Programmatic alerts fire only on confirmed bars. No higher-timeframe requests are used.
Parameter Guide
Oscillator MA Type — Sets fast and slow MA family for MACD. Default: EMA. Tip: EMA is more responsive; SMA is steadier.
Fast Length — Fast MA period. Default: 12. Trade-off: Shorter is quicker but noisier.
Slow Length — Slow MA period. Default: 26. Trade-off: Longer reduces noise but adds lag.
Source — Price input. Default: Close. Tip: Use a stable source for consistency.
Signal MA Type — Moving average family for Signal. Default: EMA.
Signal Length — Smoothing of MACD into Signal. Default: 9. Trade-off: Longer smooths more, reacts slower.
Calculate Divergence — Enables divergence engine. Default: True.
Enable Bollinger Bands on Signal — Adds bands around Signal. Default: False.
BB Length — Sampling window for bands. Default: 20. Active: Only when bands are enabled.
BB StdDev — Band width in standard deviations. Default: 2.0. Bounds: between about zero point zero zero one and fifty.
Pivot Left / Pivot Right — Bars to the left and right that define a confirmed pivot. Default: five and five. Trade-off: Larger values mean stronger but slower pivots.
Min / Max Bars Between Pivots — Valid window between two pivots. Default: five and sixty. Tip: Increase minimum to reduce micro-divergences.
Detect Hidden — Include hidden divergence. Default: True.
Draw Lines — Draw connector lines on the MACD pane. Default: True.
Alerts: Enable / Regular / Hidden / Frequency / Prefix — Control alert emission, categories, cadence, and label. Defaults: Enabled, both categories on, once per bar close, prefix “MACD RM”.
Reading & Interpretation
Histogram: Columns above zero reflect positive momentum; below zero reflect negative momentum. Color shifts indicate momentum increasing or decreasing within each side.
MACD and Signal: Crosses and distance indicate momentum shifts and strength. When bands are enabled, touches and departures hint at compression and expansion around the Signal.
Divergence: Solid green lines and labels indicate regular bullish; solid red indicate regular bearish. Dashed teal and dashed orange denote hidden bullish and hidden bearish. Triangles on the main chart mirror these events for quicker visibility.
Practical Workflows & Combinations
Trend following: Use histogram color transitions with a structure filter such as higher highs and higher lows for long bias, or lower highs and lower lows for short bias. Divergence against the prevailing structure suggests caution or partial exits.
Exits and risk: In a long, regular bearish divergence near resistance can justify scaling out or tightening stops. Hidden divergence in the trend direction can support continuation but should not replace risk controls.
Multi-asset / Multi-timeframe: Works across liquid futures, forex, indices, and large-cap equities. Start with defaults on four-hour and daily; shorten lengths on intraday only when liquidity is strong.
Behavior, Constraints & Performance
Repaint and confirmation: Signals are anchored only after the right-side pivot bars complete; alerts trigger on confirmed bars. This intentionally adds latency to reduce noise.
No higher-timeframe requests: No `security` calls are used; repaint risk is primarily tied to live bars before confirmation.
Resources: Declared `max_bars_back` is five hundred. The divergence path check iterates between pivots, bounded by the maximum bars parameter. Line objects may accumulate; limits are set for lines and labels.
Known limits: Latency at sharp turns, potential misses during fast single-bar reversals, and sensitivity to extremely choppy sessions if minimum gap between pivots is set too low.
Sensible Defaults & Quick Tunin g
Starting point: EMA, twelve and twenty-six with Signal nine; pivots five and five; minimum five, maximum sixty; alerts on close; bands off.
Too many flips: Increase Signal length, raise pivot counts, and increase minimum bars between pivots. Consider disabling hidden divergence.
Too sluggish: Reduce pivot counts, lower Signal length, and enable bands to visualize early compression.
Cluttered chart: Keep lines off and rely on labels and main-chart triangles. Use the alert prefix to route events cleanly.
What this indicator is—and isn’t
This is a visualization and signal layer for MACD with confirmed, path-checked divergence and optional Signal bands. It is not a trading system, not predictive, and not a position management framework. Use it together with structure analysis, liquidity context, and explicit risk controls.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on Heikin-Ashi, Renko, Kagi, Point-and-Figure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
[FS] Pivot Measurements# Pivot Measurements
An advanced TradingView indicator that combines LuxAlgo's pivot point detection algorithm with automatic measurement calculations between consecutive pivots.
## Features
### Pivot Detection
- **Regular Pivots**: Detects standard pivot highs and lows using configurable pivot length
- **Missed Pivots**: Identifies missed reversal levels that occurred between regular pivots
- **Visual Indicators**:
- Regular pivot highs: Red downward triangle (▼)
- Regular pivot lows: Teal upward triangle (▲)
- Missed pivots: Ghost emoji (👻)
- **Zigzag Lines**: Connects pivots with colored lines (solid for regular, dashed for missed)
- **Ghost Levels**: Horizontal lines indicating missed pivot levels
### Measurement System
- **Automatic Measurements**: Calculates price movements between consecutive pivots
- **Visual Display**:
- Transparent colored boxes (blue for upward, red for downward movements)
- Measurement labels showing:
- Price change (absolute and percentage)
- Duration (bars, days, hours, minutes)
- Volume approximation
- **Smart Positioning**: Labels positioned outside boxes (above for upward, below for downward)
- **Color Coding**: Blue for positive movements, red for negative movements
## Parameters
### Pivot Detection
- **Pivot Length** (default: 50): Number of bars on each side to identify a pivot point
- **Regular Pivots**: Toggle and colors for regular pivot highs and lows
- **Missed Pivots**: Toggle and colors for missed pivot detection
### Measurements
- **Number of Measurements** (1-10, default: 10): Maximum number of measurements to display
- **Show Measurement Boxes**: Toggle to show/hide measurement boxes and labels
- **Box Transparency** (0-100, default: 90): Transparency level for measurement boxes
- **Border Transparency** (0-100, default: 50): Transparency level for box borders
- **Label Background Transparency** (0-100, default: 30): Transparency level for label backgrounds
- **Label Size**: Size of measurement labels (tiny, small, normal, large)
## Usage
1. Add the indicator to your chart
2. Configure the **Pivot Length** based on your timeframe:
- Lower values for shorter timeframes (e.g., 10-20 for 1-5 min)
- Higher values for longer timeframes (e.g., 50-100 for daily)
3. Adjust pivot colors and visibility as needed
4. Customize measurement display settings:
- Set the number of measurements to display
- Adjust transparency levels for boxes, borders, and labels
- Choose label size
## Technical Details
- **Pine Script Version**: v6
- **Pivot Detection**: Based on () algorithm for detecting regular and missed pivots
- **Measurement Calculation**:
- Measures between consecutive pivots (from most recent to older)
- Calculates price change, percentage change, duration, and approximate volume
- Automatically sorts pivots chronologically
- **Performance**: Optimized with helper functions to reduce code duplication
## Notes
- The indicator automatically limits the number of stored pivots to optimize performance
- Measurements are only created when there are at least 2 pivots detected
- All measurements are recalculated on each bar update
- The indicator uses `max_bars_back=5000` to ensure sufficient historical data
## License
This indicator uses LuxAlgo's pivot detection algorithm from (). Please refer to the original LuxAlgo license for pivot detection components.
Volume Spike & RSI | Buy/Sell SignalsThis indicator is designed for intraday traders who seek clean, actionable buy and sell signals using a blend of momentum (RSI) and volume analysis. It automatically detects momentum bursts based on the RSI crossing user-defined levels with a simultaneous volume spike—helping filter out weak or late signals. Signals are highlighted by discrete, color-coded arrows and non-overlapping labels for easy chart interpretation without clutter.
How it works
Buy signal: Generated when the RSI crosses above your chosen “Buy Threshold” (default 60) AND the volume on that bar is above its 20-period average. This suggests strong momentum with real volume support.
Sell signal: Generated when the RSI crosses below your chosen “Sell Threshold” (default 40) AND the volume on that bar is above average, signaling momentum loss or bearish pressure.
Visuals:
Buy signals are illustrated by green upward labels/arrows beneath candles.
Sell signals feature red downward labels/arrows above candles.
All signals adjust spacing dynamically, so they never overlap the price bar.
Bars are colored lime when momentum and volume are both high.
Customization
Fully adjustable RSI “Buy” and “Sell” levels.
Customizable sensitivity for the volume spike via the SMA period input.
Label spacing can be tuned in settings so signals always remain visible, regardless of volatility.
Alerts
Built-in alert conditions for both buy and sell events, compatible with TradingView’s native alerting system.
How to use
1. Add the indicator to your intraday chart (works on any timeframe).
2. When a buy or sell label/arrow appears, it marks a technical momentum burst with real volume conviction. Use these as actionable entries or exits—always manage risk with your personal trading plan.
3. Adjust parameters in the script’s settings as needed for your market or style.
Originality & credits
The logic and code were developed specifically for this script, combining classic RSI levels with volume confirmation and careful non-overlapping visual presentation to ensure clarity for intraday trading.
This tool is for educational and informational purposes only. It is not financial advice or a guarantee of performance. Always test on demo before using in live trading.
Hindenburg OmenThe Hindenburg Omen highlights periods of internal market stress — when both new 52-week highs and new lows expand while the NYSE remains in an uptrend.
This condition often precedes major corrections or volatility spikes by revealing divergence beneath the surface of an advancing market.
The indicator triggers when four classic breadth rules align: elevated highs and lows, a positive trend, a negative McClellan Oscillator, and a highs-to-lows ratio under 2:1.
Use it on broad indices (NYSE, S&P 500) as an early-warning context tool, NOT a standalone sell signal.
Realtime Squeeze Box [CHE] Realtime Squeeze Box — Detects lowvolatility consolidation periods and draws trimmed price range boxes in realtime to highlight potential breakout setups without clutter from outliers.
Summary
This indicator identifies "squeeze" phases where recent price volatility falls below a dynamic baseline threshold, signaling potential energy buildup for directional moves. By requiring a minimum number of consecutive bars in squeeze, it reduces noise from fleeting dips, making signals more reliable than simple threshold crosses. The core innovation is realtime box visualization: during active squeezes, it builds and updates a box capturing the price range while ignoring extreme values via quantile trimming, providing a cleaner view of consolidation bounds. This differs from static volatility bands by focusing on trimmed ranges and suppressing overlapping boxes, which helps traders spot genuine setups amid choppy markets. Overall, it aids in anticipating breakouts by combining volatility filtering with visual containment of price action.
Motivation: Why this design?
Traders often face whipsaws during brief volatility lulls that mimic true consolidations, leading to premature entries, or miss setups because standard volatility measures lag in adapting to changing market regimes. This design addresses that by using a hold requirement on consecutive lowvolatility bars to denoise signals, ensuring only sustained squeezes trigger visuals. The core idea—comparing rolling standard deviation to a smoothed baseline—creates a responsive yet stable filter for lowenergy periods, while the trimmed box approach isolates the core price cluster, making it easier to gauge breakout potential without distortion from spikes.
What’s different vs. standard approaches?
Reference baseline: Traditional squeeze indicators like the Bollinger Band Squeeze or TTM Squeeze rely on fixed multiples of bands or momentum oscillators crossing zero, which can fire on isolated bars or ignore range compression nuances.
Architecture differences:
Realtime box construction that updates barbybar during squeezes, using arrays to track and trim price values.
Quantilebased outlier rejection to define box bounds, focusing on the bulk of prices rather than full range.
Overlap suppression logic that skips redundant boxes if the new range intersects heavily with the prior one.
Hold counter for consecutive bar validation, adding persistence before signaling.
Practical effect: Charts show fewer, more defined orange boxes encapsulating tight price action, with a horizontal line extension marking the midpoint postsqueeze—visibly reducing clutter in sideways markets and highlighting "coiled" ranges that standard plots might blur with full highs/lows. This matters for quicker visual scanning of multitimeframe setups, as boxes selflimit to recent history and avoid piling up.
How it works (technical)
The indicator starts by computing a rolling average and standard deviation over a userdefined length on the chosen source price series. This deviation measure is then smoothed into a baseline using either a simple or exponential average over a longer window, serving as a reference for normal volatility. A squeeze triggers when the current deviation dips below this baseline scaled by a multiplier less than one, but only after a minimum number of consecutive bars confirm it, which resets the counter on breaks.
Upon squeeze start, it clears a buffer and begins collecting source prices barbybar, limited to the first few bars to keep computation light. For visualization, if enabled, it sorts the buffer and finds a quantile threshold, then identifies the minimum value at or below that threshold to set upper and lower box bounds—effectively clamping the range to exclude tails above the quantile. The box draws from the start bar to the current one, updating its right edge and levels dynamically; if the new bounds overlap significantly with the last completed box, it suppresses drawing to avoid redundancy.
Once the hold limit or squeeze ends, the box freezes: its final bounds become the last reference, a midpoint line extends rightward from the end, and a tiny circle label marks the point. Buffers and states reset on new squeezes, with historical boxes and lines capped to prevent overload. All logic runs on every bar but uses confirmed historical data for calculations, with realtime updates only affecting the active box's position—no future peeking occurs. Initialization seeds with null values, building states progressively from the first bars.
Parameter Guide
Source: Selects the price series (e.g., close, hl2) for deviation and box building; influences sensitivity to wicks or bodies. Default: close. Tradeoffs/Tips: Use hl2 for balanced range view in volatile assets; stick to close for pure directional focus—test on your timeframe to avoid oversmoothing trends.
Length (Mean/SD): Sets window for average and deviation calculation; shorter values make detection quicker but noisier. Default: 20. Tradeoffs/Tips: Increase to 30+ for stability in higher timeframes, reducing false starts; below 10 risks overreacting to singlebar noise.
Baseline Length: Defines smoothing window for the deviation baseline; longer periods create a steadier reference, filtering regime shifts. Default: 50. Tradeoffs/Tips: Pair with Length at 1:2 ratio for calm markets; shorten to 30 if baselines lag during fast volatility drops, but watch for added whips.
Squeeze Multiplier (<1.0): Scales the baseline downward to set the squeeze threshold; lower values tighten criteria for rarer, stronger signals. Default: 0.8. Tradeoffs/Tips: Tighten to 0.6 for highvol assets like crypto to cut noise; loosen to 0.9 in forex for more frequent but shallower setups—balances hit rate vs. depth.
Baseline via EMA (instead of SMA): Switches baseline smoothing to exponential for faster adaptation to recent changes vs. equalweighted simple average. Default: false. Tradeoffs/Tips: Enable in trending markets for quicker baseline drops; disable for uniform history weighting in rangebound conditions to avoid overreacting.
SD: Sample (len1) instead of Population (len): Adjusts deviation formula to divide by length minus one for smallsample bias correction, slightly inflating values. Default: false. Tradeoffs/Tips: Use sample in short windows (<20) for more conservative thresholds; population suits long looks where bias is negligible, keeping signals tighter.
Min. Hold Bars in Squeeze: Requires this many consecutive squeeze bars before confirming; higher denoise but may clip early setups. Default: 1. Tradeoffs/Tips: Bump to 35 for intraday to filter ticks; keep at 1 for swings where quick consolidations matter—trades off timeliness for reliability.
Debug: Plot SD & Threshold: Toggles lines showing raw deviation and threshold for visual backtesting of squeeze logic. Default: false. Tradeoffs/Tips: Enable during tuning to eyeball crossovers; disable live to declutter—great for verifying multiplier impact without alerts.
Tint Bars when Squeeze Active: Overlays semitransparent color on bars during open box phases for quick squeeze spotting. Default: false. Tradeoffs/Tips: Pair with low opacity for subtlety; turn off if using boxes alone, as tint can obscure candlesticks in dense charts.
Tint Opacity (0..100): Controls background tint strength during active squeezes; higher values darken for emphasis. Default: 85. Tradeoffs/Tips: Dial to 60 for light touch; max at 100 risks hiding price action—adjust per chart theme for visibility.
Stored Price (during Squeeze): Price series captured in the buffer for box bounds; defaults to source but allows customization. Default: close. Tradeoffs/Tips: Switch to high/low for wider boxes in gappy markets; keep close for midline focus—impacts trim effectiveness on outliers.
Quantile q (0..1): Fraction of sorted prices below which tails are cut; higher q keeps more data but risks including spikes. Default: 0.718. Tradeoffs/Tips: Lower to 0.5 for aggressive trim in noisy assets; raise to 0.8 for fuller ranges—tune via debug to match your consolidation depth.
Box Fill Color: Sets interior shade of squeeze boxes; semitransparent for layering. Default: orange (80% trans.). Tradeoffs/Tips: Soften with more transparency in multiindicator setups; bold for standalone use—ensures boxes pop without overwhelming.
Box Border Color: Defines outline hue and solidity for box edges. Default: orange (0% trans.). Tradeoffs/Tips: Match fill for cohesion or contrast for edges; thin width keeps it clean—helps delineate bounds in zoomed views.
Keep Last N Boxes: Limits historical boxes/lines/labels to this count, deleting oldest for performance. Default: 10. Tradeoffs/Tips: Increase to 50 for weekly reviews; set to 0 for unlimited (risks lag)—balances history vs. speed on long charts.
Draw Box in Realtime (build/update): Enables live extension of boxes during squeezes vs. waiting for end. Default: true. Tradeoffs/Tips: Disable for confirmedonly views to mimic backtests; enable for proactive trading—adds minor repaint on live bars.
Box: Max First N Bars: Caps buffer collection to initial squeeze bars, freezing after for efficiency. Default: 15. Tradeoffs/Tips: Shorten to 510 for fast intraday; extend to 20 in dailies—prevents bloated arrays but may truncate long squeezes.
Reading & Interpretation
Squeeze phases appear as orange boxes encapsulating the trimmed price cluster during lowvolatility holds—narrow boxes signal tight consolidations, while wider ones indicate looser ranges within the threshold. The box's top and bottom represent the quantilecapped high and low of collected prices, with the interior fill shading the containment zone; ignore extremes outside for "true" bounds. Postsqueeze, a solid horizontal line extends right from the box's midpoint, acting as a reference level for potential breakout tests—drifting prices toward or away from it can hint at building momentum. Tiny orange circles at the line's start mark completion points for easy scanning. Debug lines (if on) show deviation hugging or crossing the threshold, confirming hold logic; a persistent hug below suggests prolonged calm, while spikes above reset counters.
Practical Workflows & Combinations
Trend following: Enter long on squeezeend close above the box top (or midpoint line) confirmed by higher high in structure; filter with rising 50period average to avoid countertrend traps. Use boxes as support/resistance proxies—short below bottom in downtrends.
Exits/Stops: Trail stops to the box midpoint during postsqueeze runs for conservative holds; go aggressive by exiting on retest of opposite box side. If debug shows repeated threshold grazes, tighten stops to curb drawdowns in ranging followups.
Multiasset/MultiTF: Defaults work across stocks, forex, and crypto on 15min+ frames; scale Length proportionally (e.g., x2 on hourly). Layer with highertimeframe boxes for confluence—e.g., daily squeeze + 1H box for entry timing. (Unknown/Optional: Specific multiTF scaling recipes beyond proportional adjustment.)
Behavior, Constraints & Performance
Repaint/confirmation: Core calculations use historical closes, confirming on bar close; active boxes repaint their right edge and levels live during squeezes if enabled, but freeze irrevocably on hold limit or end—mitigates via barbybar buffer adds without future leaks. No lookahead indexes.
security()/HTF: None used, so no external timeframe repaints; all native to chart resolution.
Resources: Caps at 300 boxes/lines/labels total; small arrays (up to 20 elements) and short loops in sorting/minfinding keep it light—suitable for 10k+ bar charts without throttling. Persistent variables track state across bars efficiently.
Known limits: May lag on ultrasharp volatility spikes due to baseline smoothing; gaps or thin markets can skew trims if buffer hits cap early; overlaps suppress visuals but might hide chained squeezes—(Unknown/Optional: Edge cases in nonstandard sessions).
Sensible Defaults & Quick Tuning
Start with defaults for most liquid assets on 1Hdaily: Length 20, Multiplier 0.8, Hold 1, Quantile 0.718—yields balanced detection without excess noise. For too many false starts (choppy charts), increase Hold to 3 and Baseline Length to 70 for stricter confirmation, reducing signals by 3050%. If squeezes feel sluggish or miss quick coils, shorten Length to 14 and enable EMA baseline for snappier adaptation, but monitor for added flips. In highvol environments like options, tighten Multiplier to 0.6 and Quantile to 0.6 to focus on core ranges; reverse for calm pairs by loosening to 0.95. Always backtest tweaks on your asset's history.
What this indicator is—and isn’t
This is a volatilityfiltered visualization tool for spotting and bounding consolidation phases, best as a signal layer atop price action and trend filters—not a standalone predictor of direction or strength. It highlights setups but ignores volume, momentum, or news context, so pair with discreteness rules like higher highs/lows. Never use it alone for entries; always layer risk management, such as 12% stops beyond box extremes, and position sizing based on account drawdown tolerance.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on HeikinAshi, Renko, Kagi, PointandFigure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
chart Pattern & Candle sticks Strategy# **XAUUSD Pattern & Candle Strategy - Complete Description**
## **Overview**
This Pine Script indicator is a comprehensive multi-factor trading system specifically designed for **XAUUSD (Gold) scalping and swing trading**. It combines classical technical analysis methods including candlestick patterns, chart patterns, moving averages, and volume analysis to generate high-probability buy/sell signals with automatic stop-loss and take-profit levels.
***
## **Core Components**
### **1. Moving Average System (Triple MA)**
**Purpose:** Identifies trend direction and momentum
- **Fast MA (20-period)** - Short-term price action
- **Medium MA (50-period)** - Intermediate trend
- **Slow MA (200-period)** - Long-term trend direction
**How it works:**
- **Bullish alignment**: MA20 > MA50 > MA200 (all pointing up)
- **Bearish alignment**: MA20 < MA50 < MA200 (all pointing down)
- **Crossover signals**: When Fast MA crosses Medium MA, it triggers buy/sell signals
- **Choice of SMA or EMA**: Adjustable based on preference
**Visual indicators:**
- Blue line = Fast MA
- Orange line = Medium MA
- Light red line = Slow MA
- Green background tint = Bullish trend
- Red background tint = Bearish trend
---
### **2. Candlestick Pattern Recognition (13 Patterns)**
**Purpose:** Identifies reversal and continuation signals based on price action
#### **Bullish Patterns (Signal potential upward moves):**
1. **Hammer** 🔨
- Long lower wick (2x body size)
- Small body at top
- Indicates rejection of lower prices (buyers stepping in)
- Best at support levels
2. **Inverted Hammer**
- Long upper wick
- Small body at bottom
- Shows buying pressure despite initial selling
3. **Bullish Engulfing** 📈
- Green candle completely engulfs previous red candle
- Strong reversal signal
- Body must be 1.2x larger than previous
4. **Morning Star** ⭐
- 3-candle pattern
- Red candle → Small indecision candle → Large green candle
- Powerful reversal at bottoms
5. **Piercing Line** ⚡
- Green candle closes above 50% of previous red candle
- Indicates strong buying interest
6. **Bullish Marubozu**
- Almost no wicks (95% body)
- Very strong bullish momentum
- Body must be 1.3x average size
#### **Bearish Patterns (Signal potential downward moves):**
7. **Shooting Star** 💫
- Long upper wick
- Small body at bottom
- Indicates rejection of higher prices (sellers in control)
- Best at resistance levels
8. **Hanging Man**
- Similar to hammer but appears at top
- Warning of potential reversal down
9. **Bearish Engulfing** 📉
- Red candle completely engulfs previous green candle
- Strong reversal signal
10. **Evening Star** 🌙
- 3-candle pattern (opposite of Morning Star)
- Green → Small → Large red candle
- Powerful top reversal
11. **Dark Cloud Cover** ☁️
- Red candle closes below 50% of previous green candle
- Indicates strong selling pressure
12. **Bearish Marubozu**
- Almost no wicks, pure red body
- Very strong bearish momentum
#### **Neutral Pattern:**
13. **Doji**
- Open and close nearly equal (tiny body)
- Indicates indecision
- Often precedes major moves
**Detection Logic:**
- Compares body size, wick ratios, and position relative to previous candles
- Uses 14-period average body size as reference
- All patterns validated against volume confirmation
***
### **3. Chart Pattern Recognition**
**Purpose:** Identifies major support/resistance and reversal patterns
#### **Patterns Detected:**
**Double Bottom** 📊 (Bullish)
- Two lows at approximately same level
- Indicates strong support
- Breakout above neckline triggers buy signal
- Most reliable at major support zones
**Double Top** 📊 (Bearish)
- Two highs at approximately same level
- Indicates strong resistance
- Breakdown below neckline triggers sell signal
- Most reliable at major resistance zones
**Support & Resistance Levels**
- Automatically plots recent pivot highs (resistance)
- Automatically plots recent pivot lows (support)
- Uses 3-bar strength for validation
- Levels shown as dashed horizontal lines
**Price Action Patterns**
- **Uptrend detection**: Higher highs + higher lows
- **Downtrend detection**: Lower highs + lower lows
- Confirms overall market structure
***
### **4. Volume Analysis**
**Purpose:** Confirms signal strength and filters false signals
**Metrics tracked:**
- **Volume MA (20-period)**: Baseline average volume
- **High volume threshold**: 1.5x the volume average
- **Volume increase**: Current volume > previous 2 bars
**How it's used:**
- All buy/sell signals **require volume confirmation**
- High volume = institutional participation
- Low volume signals are filtered out
- Prevents whipsaw trades during quiet periods
**Visual indicator:**
- Dashboard shows "High" volume in orange when active
- "Normal" shown in gray during low volume
***
### **5. Signal Generation Logic**
**BUY SIGNALS triggered when ANY of these occur:**
1. **Candlestick + Volume**
- Bullish candle pattern detected
- High volume confirmation
- Price above Fast MA
2. **MA Crossover + Volume**
- Fast MA crosses above Medium MA
- High volume confirmation
3. **Double Bottom Breakout**
- Price breaks above support level
- Volume confirmation present
4. **Trend Continuation**
- Uptrend structure intact (higher highs/lows)
- All MAs in bullish alignment
- Price above Fast MA
- Volume confirmation
**SELL SIGNALS triggered when ANY of these occur:**
1. **Candlestick + Volume**
- Bearish candle pattern detected
- High volume confirmation
- Price below Fast MA
2. **MA Crossunder + Volume**
- Fast MA crosses below Medium MA
- High volume confirmation
3. **Double Top Breakdown**
- Price breaks below resistance level
- Volume confirmation present
4. **Trend Continuation**
- Downtrend structure intact (lower highs/lows)
- All MAs in bearish alignment
- Price below Fast MA
- Volume confirmation
***
### **6. Risk Management System**
**Automatic Stop Loss Calculation:**
- Based on ATR (Average True Range) - 14 periods
- **Formula**: Entry price ± (ATR × SL Multiplier)
- **Default multiplier**: 1.5 (adjustable)
- Adapts to market volatility automatically
**Automatic Take Profit Calculation:**
- **Formula**: Entry price ± (ATR × TP Multiplier)
- **Default multiplier**: 2.5 (adjustable)
- **Default Risk:Reward ratio**: 1:1.67
- Higher TP multiplier = more aggressive targets
**Position Management:**
- Tracks ONE position at a time (no pyramiding)
- Automatically closes position when:
- Stop loss is hit
- Take profit is reached
- Opposite MA crossover occurs
- Prevents revenge trading and over-leveraging
**Visual Representation:**
- **Red horizontal line** = Stop Loss level
- **Green horizontal line** = Take Profit level
- Lines remain on chart while position is active
- Automatically disappear when position closes
***
### **7. Visual Elements**
**On-Chart Displays:**
1. **Moving Average Lines**
- Fast MA (Blue, thick)
- Medium MA (Orange, thick)
- Slow MA (Red, thin)
2. **Support/Resistance**
- Green crosses = Support levels
- Red crosses = Resistance levels
3. **Buy/Sell Arrows**
- Large GREEN "BUY" label below bars
- Large RED "SELL" label above bars
4. **Pattern Labels** (Small markers)
- "Hammer", "Bull Engulf", "Morning Star" (green, below bars)
- "Shooting Star", "Bear Engulf", "Evening Star" (red, above bars)
- "Double Bottom" / "Double Top" (blue/orange)
5. **Signal Detail Labels** (Medium size)
- Shows signal reason (e.g., "Bullish Candle", "MA Cross Up")
- Displays Entry, SL, and TP prices
- Color-coded (green for long, red for short)
6. **Background Coloring**
- Light green tint = Bullish MA alignment
- Light red tint = Bearish MA alignment
***
### **8. Information Dashboard**
**Top-right corner table showing:**
| Metric | Description |
|--------|-------------|
| **Position** | Current trade status (LONG/SHORT/None) |
| **MA Trend** | Overall trend direction (Bullish/Bearish/Neutral) |
| **Volume** | Current volume status (High/Normal) |
| **Pattern** | Last detected candlestick pattern |
| **ATR** | Current volatility measurement |
**Purpose:**
- Quick at-a-glance market assessment
- Real-time position tracking
- No need to check multiple indicators
***
### **9. Alert System**
**Complete alert coverage for:**
✅ **Entry Alerts**
- "Buy Signal" - Triggers when buy conditions met
- "Sell Signal" - Triggers when sell conditions met
✅ **Exit Alerts**
- "Long TP Hit" - Take profit reached on long position
- "Long SL Hit" - Stop loss triggered on long position
- "Short TP Hit" - Take profit reached on short position
- "Short SL Hit" - Stop loss triggered on short position
**How to use:**
1. Click "Create Alert" button
2. Select desired alert from dropdown
3. Set notification method (popup, email, SMS, webhook)
4. Never miss a trade opportunity
***
## **Recommended Settings**
### **For Scalping (Quick trades):**
- **Timeframe**: 5-minute
- **Fast MA**: 9
- **Medium MA**: 21
- **Slow MA**: 50
- **SL Multiplier**: 1.0
- **TP Multiplier**: 2.0
- **Volume Threshold**: 1.5x
### **For Swing Trading (Longer holds):**
- **Timeframe**: 1-hour or 4-hour
- **Fast MA**: 20
- **Medium MA**: 50
- **Slow MA**: 200
- **SL Multiplier**: 2.0
- **TP Multiplier**: 3.0
- **Volume Threshold**: 1.3x
### **Best Trading Hours for XAUUSD:**
- **Asian Session**: 00:00 - 08:00 GMT (lower volatility)
- **London Session**: 08:00 - 16:00 GMT (high volatility) ⭐
- **New York Session**: 13:00 - 21:00 GMT (highest volume) ⭐
- **London-NY Overlap**: 13:00 - 16:00 GMT (BEST for scalping) 🔥
***
## **How to Use This Strategy**
### **Step 1: Setup**
1. Open TradingView
2. Load XAUUSD chart
3. Select timeframe (5m, 15m, 1H, or 4H)
4. Add indicator from Pine Editor
5. Adjust settings based on your trading style
### **Step 2: Wait for Signals**
- Watch for GREEN "BUY" or RED "SELL" labels
- Check the signal reason in the detail label
- Verify dashboard shows favorable conditions
- Confirm volume is "High" (not required but preferred)
### **Step 3: Enter Trade**
- Enter at market or limit order near signal price
- Note the displayed Entry, SL, and TP prices
- Set your broker's SL/TP to match indicator levels
### **Step 4: Manage Position**
- Watch for SL/TP lines on chart
- Monitor dashboard for trend changes
- Exit manually if opposite MA crossover occurs
- Let SL/TP do their job (don't move them!)
### **Step 5: Review & Learn**
- Track win rate over 20+ trades
- Adjust multipliers if needed
- Note which patterns work best for you
- Refine entry timing
***
## **Key Advantages**
✅ **Multi-confirmation approach** - Reduces false signals significantly
✅ **Automatic risk management** - No manual calculation needed
✅ **Adapts to volatility** - ATR-based SL/TP adjusts to market conditions
✅ **Volume filtered** - Ensures institutional participation
✅ **Visual clarity** - Easy to understand at a glance
✅ **Complete alert system** - Never miss opportunities
✅ **Pattern education** - Learn patterns as they appear
✅ **Works on all timeframes** - Scalping to swing trading
***
## **Limitations & Considerations**
⚠️ **Not a holy grail** - No strategy wins 100% of trades
⚠️ **Requires practice** - Demo trade first to understand signals
⚠️ **Market conditions matter** - Works best in trending or volatile markets
⚠️ **News events** - Avoid trading during major economic releases
⚠️ **Slippage on 5m** - Fast markets may have execution delays
⚠️ **Pattern subjectivity** - Some patterns may trigger differently than expected
***
## **Risk Management Rules**
1. **Never risk more than 1-2% per trade**
2. **Maximum 3 positions per day** (avoid overtrading)
3. **Don't trade during major news** (NFP, FOMC, etc.)
4. **Use proper position sizing** (0.01 lot per $100 for micro accounts)
5. **Keep trade journal** (track patterns, win rate, mistakes)
6. **Stop trading after 3 consecutive losses** (psychological reset)
7. **Don't move stop loss further away** (accept losses)
8. **Take partial profits** at 1:1 R:R if desired
***
## **Expected Performance**
**Realistic expectations:**
- **Win rate**: 50-65% (depending on market conditions and timeframe)
- **Risk:Reward**: 1:1.67 default (adjustable to 1:2 or 1:3)
- **Signals per day**: 3-8 on 5m, 1-3 on 1H
- **Best months**: High volatility periods (news events, economic uncertainty)
- **Drawdowns**: Expect 3-5 losing trades in a row occasionally
***
## **Customization Options**
All inputs are adjustable in settings panel:
**Moving Averages:**
- Type (SMA or EMA)
- All three period lengths
**Volume:**
- Volume MA length
- High volume multiplier threshold
**Chart Patterns:**
- Pattern strength (bars for pivot detection)
- Show/hide pattern labels
**Risk Management:**
- ATR period
- Stop loss multiplier
- Take profit multiplier
**Display:**
- Toggle pattern labels
- Customize colors (in code)
***
## **Conclusion**
This is a **professional-grade, multi-factor trading system** that combines the best of classical technical analysis with modern risk management. It's designed to give clear, actionable signals while automatically handling the complex calculations of stop loss and take profit levels.
**Best suited for traders who:**
- Understand basic technical analysis
- Can follow rules consistently
- Prefer systematic approach over gut feeling
- Want visual confirmation before entering trades
- Value proper risk management
**Start with demo trading** for at least 20-30 trades to understand how the signals work in different market conditions. Once comfortable and profitable on demo, transition to live trading with minimal risk per trade.
Happy trading! 📈🎯
Index Weighted Returns [SS]This is the index weighted return indicator.
It supports a few ETFs, including:
SPY/SPX
QQQ/NDX
ARKK
SMH
UFO
XBI
QTUM
What it does is it takes the top, approximately 40, of the most heavily weighted tickers on the ETF, monitors their returns using the request security function, and then uses their weight to calculate the synthetic returns of the ETF of interest.
For example, in the chart we have SMH.
The indicator is looking at the top weighted tickers of SMH, calculating their returns, adjusting it for their individual weight on SMH and then predicting the expected return of SMH based on the weighing and holding's returns themselves.
How to Use it
The indicator is pretty straight forward, you select which ever index you are on and your desired timeframe (you can do as low as 30-Minutes or as high as monthly or quarterly).
The indicator will then retrieve the top holdings for that ticker, their corresponding weights and calculate the expected daily return based on the weight and return of these tickers.
It will plot this return for you on the chart.
Other Options
There is an optional table for you to view the actual weight, ticker composition and period returns for each of the top x tickers for an index. You can simply toggle "Show Table" in the settings menu, and it will show you the list of all tickers included, their period returns and their weight on the ETF.
Tips for Use
Works well to see when an index may be over the actual top weighted tickers, implying a pullback/sell, or under. For example:
SPY today fell well below its top tickers and is currently rallying back up to the expected close range.
You can see in the primary chart, SMH fell below and returned to its balance, being at the expected close range based on its component tickers.
That is the indicator!
Its simple but powerful!
Hope you enjoy and as always, safe trades!
super trader Prosuper trader Pro
super trader Pro
super trader Pro
super trader Pro
super trader Pro
KD-NewAutoTrade for Future Trading - Heikin Ashi candles The KD-NewAutoTrade strategy is a dynamic trend-following indicator designed for scalping and swing trading across crypto, forex, and index futures. It combines the precision of EMA crossovers, RSI momentum, and ADX trend strength to deliver clear Buy/Sell signals with high reliability.
🔹 Core Logic
EMA Fast & Slow Crossover – Identifies short-term and long-term trend shifts.
RSI Confirmation – Filters out false signals by requiring RSI to cross custom Buy/Sell thresholds.
ADX Filter – Ensures trades only trigger when market trend strength exceeds your chosen ADX minimum.
🔹 Key Features
Visual Buy/Sell triangles directly on the chart.
Customizable inputs for EMA, RSI, and ADX lengths.
Works efficiently on all timeframes and all markets (Crypto, Indices, Stocks, Commodities).
Optional background highlights for active trade zones.
Alert conditions for both BUY and SELL setups – ready to use in automated strategies or alert bots.
🔹 Recommended Usage
Use Heikin Ashi candles
Works best on 1M - 5M timeframes.
Combine with volume or higher-timeframe trend confirmation for stronger signals.
BK AK-13⚔️ BK AK-13 — The Mentor’s 13. Revealed on 11. Command the Band. Punish the Extremes. ⚔️
This is my 11th release—and that matters. 11 is a sacred number to me, so for release eleven I’m doing something I never planned to do: I’m putting my mentor’s secret 13 MA into the open.
For years, this 13-based MA framework was part of our private playbook—quietly doing work behind the scenes. Now I’m handing it to you fully armed, because I believe in karma in, karma out: I took years of wisdom from the market. I took years of wisdom from the men who taught me. This is one of the ways I give back—with structure, respect, and intent.
🎖 Full Credit — Respect the Origin
The core architecture of BK AK-13 is not mine. It stands firmly on the work of DZIV.
What comes from DZIV:
The Heikin Ashi MA engine (MA calculated on HA Open/High/Low/Close)
The multi-MA engine on the HA feed (ALMA / HMA / SMA / RMA / VWMA / WMA / ZLEMA / EMA)
The Body / Wick / Band zone classification for price
The dynamic body & wick clouds that give this structure its clean visual form
If this framework changes the way you see trend and price location, remember the name: DZIV.
On top of his backbone, I forged the BK AK-13 enhancement layer: trend-strength regimes, background modes, structured band-reversal arrows, momentum acceleration dots, extreme pivot markers, historical band-touch rails, the info panel, and a complete alert suite.
And as always, the “AK” in the name is not branding—it’s honor. It belongs to my mentor A.K. His secret 13 MA is the spine of this system, and his obsession with clarity, patience, and zero shortcuts sits behind every decision in this tool. Above that, all glory and gratitude to Gd—the real source of any wisdom, edge, or endurance we have in this game.
🧠 Why “BK AK-13”?
BK — my mark, the house I’m building.
AK — my mentor, the standard I’m still chasing.
13 — his secret moving average, the length that quietly shaped how I see trend, location, and pressure.
For years, 13 stayed off the public record—used, not discussed. Now, on indicator number 11, I’m putting that weapon in the open: 11th release. Sacred number. Secret 13 revealed, not for hype—but as karmic give-back. Karma in. Karma out.
🧱 What BK AK-13 Actually Is
BK AK-13 is a Heikin Ashi MA battle band with a brain and a conscience.
It does three big things:
Builds a smoothed HA-MA band using Heikin Ashi OHLC to create a cleaner, truer band around price.
Maps price into zones: Body, Upper Wick, Lower Wick, Above Band, Below Band—so every bar has a role.
Assigns a trend regime by computing a normalized trend-strength %, classifying the environment as Weak / Normal / Strong / Extreme.
You’re never guessing: Is this real trend or just drift? Am I in the spine, the wick, or off the rails? Is this where I press, fade, or stand down? The band, zones, and regimes answer that for you.
🎨 Visual Architecture — Band, Clouds, Regimes
Body & Wick Clouds (DZIV’s craft)
Body cloud between HA-MA Open & Close.
Wick clouds between body and HA-MA High/Low.
Color follows trend: bull, bear, or neutral.
You’re not decoding noisy candles—you’re reading the spine and skin of the move.
Background Regime Modes (BK layer)
Standard – background always on, soft trend-follow color.
Hybrid (Extreme + Breaks) – lights only on extreme trend states or reversal break events.
Hybrid (Strong/Extreme + Breaks) – shows strong & extreme regimes, darker tone on true extremes.
Breaks Only – background flashes only on reversal arrows.
When the background goes quiet, you’re in ordinary flow. When it lights up, something is strategic, not cosmetic.
🎯 Weapons Inside BK AK-13
⭐ Trend Change Stars
Stars appear when the internal band trend crosses zero: bull star when it flips negative → positive, bear star from positive → negative. They’re your pivot flags for swing shifts when aligned with your higher timeframe bias.
🔁 Band Reversal Arrows — Edge Flip Logic
Not every band tap—only structured reversals:
Reversal Down (short idea): first a break of the upper band, then later, for the first time, a break of the lower band.
Reversal Up (long idea): first a break of the lower band, then later, for the first time, a break of the upper band.
You can require a close outside the band and set a minimum break distance (% of band range) so only real punches count. These arrows mark campaign flips, not noise.
💡 Momentum Acceleration Dots
In strong trend regimes only:
Green dot = trend accelerating in its own direction (uptrend steepening, downtrend deepening).
Red dot = trend decelerating, even if direction hasn’t flipped yet.
They protect you from chasing late when the engine is dying and from staying stubborn when momentum is bleeding out.
⚠ Extreme Pivot Markers
Pivot highs/lows are found with a configurable lookback and only marked when trend strength at that pivot bar is above your threshold. You’ll see ⚠ above likely exhaustion tops in strong bulls and ⚠ below likely exhaustion lows in strong bears—perfect for final scale-outs, countertrend scouts, and knowing where campaigns commonly run out of blood.
📏 Historical Band-Touch Rails
Over your lookback window, BK AK-13 tracks the highest upper band touch and lowest lower band touch, drawing them as dashed rails. They’re dynamic SR built from real band extremes—ideal for trend targets, fade zones, and stop/scale-out context.
🧭 Info Panel — On-Chart War Room
The Info Panel compresses everything into a single strip: direction + strength codes (BULL STR, BEAR EXT, NEUT WEAK), four segments that brighten as |trend| climbs from weak → normal → strong → extreme, and a zone + deviation label (BDY/UW/LW/AB/BL × OK/AL/EX).
Hover and you get a full tactical brief: trend, momentum change, acceleration, band levels, distances to upper/lower/nearest band in ticks, outer-band streaks, strategic state, plus “Action” guidance and a “What-if” forward scenario. It doesn’t just tell you where you are—it pushes you toward a structured thought process on each bar.
🕹 How to Use BK AK-13 with Intent
1️⃣ Trend-Rider Mode
In Strong/Extreme bull with price in Body or Lower Wick: buy dips into the band (mid/lower) instead of chasing tops; target the upper band / upper rail while structure holds.
In Strong/Extreme bear with price in Body or Upper Wick: sell rallies into the band; target lower band / lower rail while acceleration stays healthy.
The band defines where you’re allowed to do business.
2️⃣ Extreme Snapback Hunter
Prime conditions: trend tagged Extreme, price pressed into the outer band in trend direction, strategic state lit + Hybrid background active. That’s where pressing fresh risk often flips from reward to punishment. Use it to stop adding, start harvesting, or launch controlled mean-reversion probes back to the midline—if your system and risk rules allow it.
3️⃣ Exhaustion & Turn Zones
Watch for confluence: red momentum dots, extreme pivot ⚠ markers, a reversal arrow, and a nearby historical rail or your own key level (Fibs, VWAP, volume structure, etc.). That’s where campaigns often end, traps are set, and new campaigns begin.
🔔 Alerts — The Chart Calls You
Included alerts: Bullish/Bearish Trend Change, Strategic Extreme at Outer Band, Reversal Up/Down, Extreme Pivot High/Low, and Body Zone Entry during Strong Trend. Use them so you respond to events, not impulses.
🔧 Tuning the Extremes — Help Me Perfect the Advanced Side
The extreme thresholds and advanced features are powerful but sensitive, and there is no single perfect universal setting. I’m still tuning them myself across instruments and timeframes: strong/extreme trend thresholds, extreme background thresholds, momentum acceleration threshold, pivot lookback + pivot trend filter, band-touch lookback, and minimum break distance for reversals.
Different markets and timeframes breathe differently.
If you find killer settings for a specific symbol + timeframe, please share:
Instrument & timeframe
Your tuned values for extremes and advanced modules
A few charts showing why they work
Experiment. Dial it in. Then share your best settings for the extremes and advanced features. Let this become a crowd-forged battle manual: I gave you the engine, you tune it to your battleground, and we all benefit from what’s discovered in live fire. Karma in. Karma out.
🤝 Pay It Forward
If BK AK-13 sharpens your read, don’t just flex screenshots—teach structure. Show newer traders body vs wick vs edge. Talk about when you didn’t take a trade because the band said “danger,” not just the wins. Share your settings, charts, and lessons—especially around the extremes and advanced modules. I’m sharing a mentor’s secret on release 11 for a reason. If it blesses you, don’t let it stop with you.
📜 King Solomon’s Lens
King Solomon said: “The prudent sees danger and hides himself, but the simple go on and suffer for it.”
BK AK-13 is built exactly around that dividing line: the simple chase candles at the outer band in extreme regimes and get punished; the prudent see danger in the structure, hide their size, hedge, or reverse with intent.
This indicator won’t make you prudent. It just removes your excuse for being simple.
⚔️ BK AK-13 — The mentor’s secret 13, revealed on 11. Let the band define the field. Let wisdom define your strike.
May Gd bless your eyes, your patience, your settings, and every decision you make at the edge. 🙏
SSL Hybrid ScalperIt's a ready to trade script V5, that takes the original SSL Hybrid logic and optimizes it for XAUUSD scalping on 1min to 15min charts for buy & sell signals.
🧠 Quantum Regime Shift Detector v2.1🧠 Quantum Regime Shift Detector v2.1
This tool identifies market phase transitions — when conditions shift between stable and volatile regimes.
It blends volatility, trend strength, momentum, and volume dynamics to compute a Quantum Shift Score that highlights regime changes in real time.
🟩 Green = Stable Regime (calm, trending markets)
🟥 Red = Transition Regime (volatility spikes or reversals)
🟨 Yellow = Uncertain Zone
The histogram tracks regime states, while alerts trigger automatically when the market enters a new phase.
Use it to anticipate major shifts before price confirms them.
(Tip: pair with your favorite trend or volume indicator for confirmation.)
SevenDayHighLowTableWithBoxes [CHE]SevenDayHighLowTableWithBoxes — Seven-day day-range boxes with a weekday-aware “ghost” projection and a compact table that tracks recent extremes and per-weekday hit rates.
Summary
This indicator visualizes each trading day as a colored box and annotates the final high and low with compact markers. It maintains a rolling seven-day view and a five-column table showing day name, high, low, range, and a per-weekday projection hit statistic. A dashed “ghost” box projects a typical range for the current weekday using a running average and an adjustable scaling factor. The script is written in Pine v6, runs on the main chart (overlay true), and emphasizes stable object handling and closed-bar finalization at day boundaries.
Motivation: Why this design?
Intraday traders often need fast context for where today’s price sits relative to recent daily extremes, without switching timeframes. A simple daily high/low overlay is informative but lacks structure, sizing context, and continuity. By grouping bars into local days (configurable UTC offset), drawing explicit boxes, and projecting a weekday-typical range, the chart becomes easier to scan. The compact table gives a quick audit trail of the latest seven days while tracking how often the weekday projection would have covered the realized range.
What’s different vs. standard approaches?
Reference baseline: Plain daily high/low lines or session boxes without context.
Architecture differences:
Weekday-tinted boxes and labels for today plus up to six prior days.
Weekday average range drives a dashed projection (“ghost”) sized by a user-defined percentage.
Per-weekday hit statistics recorded as hits over totals and displayed in the table.
ATR-based vertical offsets keep labels readable.
Live updates intraday; state is finalized at the local day switch.
Practical effect: The chart shows where current price sits inside a known daily envelope, plus how “typical” the day’s movement is for this weekday, aiding expectations and planning.
How it works (technical)
The script computes a local daily timestamp using the user’s UTC offset. A day change finalizes the prior day, writes its high, low, start and end indices, and records the bar indices of the terminal high and low.
For each weekday, it maintains a running average of realized ranges with a cap on the lookback count. The ghost projection length is the weekday average scaled by the user’s percentage setting.
Anchor selection for the ghost uses the most recent extreme and the close relative to the intraday midpoint to choose a low-anchored or high-anchored box.
A five-column table (Day, High, Low, Range, Ghost OK) is refreshed on the last bar. The “Ghost OK” column shows per-weekday cumulative hits over totals with a percentage, calculated before including the just-finished day.
Object counts are bounded to seven days by pruning arrays and deleting old boxes and labels. Visual updates for historical objects occur on the last bar to minimize overhead. No `security()` calls are used.
Parameter Guide
UTC (+/−) — Controls local day boundaries — Default: minus five hours — Set to your venue’s local time.
Session (for Time gate) — Session string — Default: full week — (Optional) computed internally; not applied to gating.
Show 7-Day High/Low Table — Toggles the table — Default: true — Disable to reduce UI load.
Show Day Boxes in Chart — Toggles day boxes — Default: true — Disable for a cleaner chart.
Table Position — Nine-point anchor — Default: Middle Right — Move to avoid overlap.
Table Background / Text Color / Min Cell Width — Styling controls — Defaults: gray background, white text, width twelve characters.
Weekday Colors (Sun…Sat) — Row and box tints — Defaults: semi-transparent hues — Adjust for your theme.
Triangle Transparency — Marker opacity — Default: zero — Increase to fade high/low dots.
Day Label Transparency — Day name opacity — Default: zero — Increase to reduce emphasis.
Box Border Width — Box stroke width — Default: one — Increase for stronger edges.
Extend Boxes Right — Extend current box — Default: false — Useful for forward planning.
Show Average Range Ghost Box — Dashed projection — Default: true — Disable if distracting.
Ghost Border Color / Width — Ghost styling — Defaults: gray, width one.
Ghost Length percent of AvgRange — Projection scale — Default: one hundred; bounds zero to five hundred — Lower to be conservative.
Max History Days for Average — Cap per-weekday averaging — Default: two hundred fifty-two; bounds thirty to five hundred.
ATR Length / Day Label ATR Multiplier / Triangle Up ATR Multiplier / Triangle Down ATR Multiplier — Offsets for label placement — Defaults: length one hundred; multipliers zero — Increase on dense instruments to prevent overlap.
Reading & Interpretation
Day boxes: The filled rectangle marks each day’s full high-low span; color encodes the weekday.
Markers: Small dots near the terminal high and low highlight where the final extremes occurred.
Ghost box: A dashed box sized by the weekday average range, anchored based on recent behavior. It is a typical span, not a target.
Table: Row one shows “Today”. Rows below list up to six prior days. “Ghost OK” shows per-weekday cumulative hits over totals with a percentage, which reflects historical coverage quality for that weekday.
Practical Workflows & Combinations
Trend following: Use the current box plus recent boxes to read expansion or compression days; combine with basic structure such as higher-highs and higher-lows or lower-lows and lower-highs for confirmation.
Exits and risk: When price nears the ghost boundary late in the session, consider managing exposure more conservatively.
Multi-asset and multi-timeframe: Works on minute charts. As a starting point, use five to less than sixty minutes. For cross-checks, pair with a higher timeframe bias filter.
Behavior, Constraints & Performance
Repaint/confirmation: The indicator updates intraday; extremes and ghost position can move while the day is open. Values are finalized on the next local day start.
HTF/security: None used; repaint risk is limited to live-bar movement.
Resources: `max_bars_back` five thousand; arrays are pruned to seven days; the table and color sync run on the last bar; the live ghost updates only in real time.
Known limits: Weekday averages can be unrepresentative during regime shifts, events, or gaps. Day boundaries depend on the UTC offset being set correctly. No alerts are included. The script displays warning labels when the timeframe is below five minutes or at sixty minutes and above.
Sensible Defaults & Quick Tuning
Start with the defaults.
Ghost too aggressive: Lower the percent scale.
Labels overlap: Increase ATR multipliers.
Clutter or performance issues: Hide the table or boxes, or disable the ghost.
Day boundary misaligned: Adjust the UTC offset to your market.
What this indicator is—and isn’t
This is a visualization and context layer for daily extremes and a weekday-based typical span. It does not predict direction, does not manage orders, and is not a complete trading system. Use it alongside market structure, risk controls, and position management.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Do not use this indicator on Heikin-Ashi, Renko, Kagi, Point-and-Figure, or Range charts, as these chart types can produce unrealistic results for signal markers and alerts.
Best regards and happy trading
Chervolino
DAX ORB Ultimate - ALGO Suite//@version=5
indicator("DAX ORB Ultimate - ALGO Suite", overlay=true, max_labels_count=200, max_lines_count=100)
// ═══════════════════════════════════════════════════════════════════════════════
// DAX OPENING RANGE BREAKOUT - ULTIMATE EDITION
// Real-time ORB building | Multi-timeframe support | Key levels with bias
// Works on ANY timeframe - uses M1 data for ORB construction
// ═══════════════════════════════════════════════════════════════════════════════
// ════════════════════════ INPUTS ════════════════════════
orb_start_h = input.int(7, "Start Hour (UTC)", minval=0, maxval=23, group="ORB Settings")
orb_start_m = input.int(40, "Start Minute", minval=0, maxval=59, group="ORB Settings")
orb_end_h = input.int(8, "End Hour (UTC)", minval=0, maxval=23, group="ORB Settings")
orb_end_m = input.int(0, "End Minute", minval=0, maxval=59, group="ORB Settings")
exclude_wicks = input.bool(true, "Exclude Wicks", group="ORB Settings")
close_hour = input.int(16, "Market Close Hour", minval=0, maxval=23, group="ORB Settings")
use_tf = input.bool(true, "1. Trend Following", group="Strategies")
use_mr = input.bool(true, "2. Mean Reversion", group="Strategies")
use_sa = input.bool(true, "3. Statistical Arb", group="Strategies")
use_mm = input.bool(true, "4. Market Making", group="Strategies")
use_ba = input.bool(true, "5. Basis Arb", group="Strategies")
use_ema = input.bool(true, "EMA Filter", group="Technical Filters")
use_rsi = input.bool(true, "RSI Filter", group="Technical Filters")
use_macd = input.bool(true, "MACD Filter", group="Technical Filters")
use_vol = input.bool(true, "Volume Filter", group="Technical Filters")
use_bb = input.bool(true, "Bollinger Filter", group="Technical Filters")
use_fixed = input.bool(false, "Fixed SL/TP", group="Risk Management")
fixed_sl = input.float(50, "Fixed SL Points", minval=10, group="Risk Management")
fixed_tp = input.float(150, "Fixed TP Points", minval=10, group="Risk Management")
atr_sl = input.float(2.0, "ATR SL Mult", minval=0.5, group="Risk Management")
atr_tp = input.float(3.0, "ATR TP Mult", minval=0.5, group="Risk Management")
min_rr = input.float(2.0, "Min R:R", minval=1.0, group="Risk Management")
show_dash = input.bool(true, "Show Dashboard", group="Display")
show_lines = input.bool(true, "Show Lines", group="Display")
show_levels = input.bool(true, "Show Key Levels", group="Display")
// ════════════════════════ FUNCTIONS ════════════════════════
is_orb_period(_h, _m) =>
start = orb_start_h * 60 + orb_start_m
end = orb_end_h * 60 + orb_end_m
curr = _h * 60 + _m
curr >= start and curr < end
orb_ended(_h, _m) =>
end = orb_end_h * 60 + orb_end_m
curr = _h * 60 + _m
curr == end
is_market_open() =>
h = hour(time)
h >= orb_start_h and h <= close_hour
// ════════════════════════ DATA GATHERING (M1) ════════════════════════
// Get M1 data for ORB construction (works on ANY chart timeframe)
= request.security(syminfo.tickerid, "1", , barmerge.gaps_off, barmerge.lookahead_off)
// Daily data
d_high = request.security(syminfo.tickerid, "D", high, barmerge.gaps_off, barmerge.lookahead_on)
d_low = request.security(syminfo.tickerid, "D", low, barmerge.gaps_off, barmerge.lookahead_on)
d_open = request.security(syminfo.tickerid, "D", open, barmerge.gaps_off, barmerge.lookahead_on)
// Current day high/low (intraday)
var float today_high = na
var float today_low = na
var float prev_day_high = na
var float prev_day_low = na
var float yest_size = 0
if ta.change(time("D")) != 0
prev_day_high := d_high
prev_day_low := d_low
yest_size := d_high - d_low
today_high := high
today_low := low
else
today_high := math.max(na(today_high) ? high : today_high, high)
today_low := math.min(na(today_low) ? low : today_low, low)
// ════════════════════════ ORB CONSTRUCTION (REAL-TIME) ════════════════════════
var float orb_h = na
var float orb_l = na
var bool orb_ready = false
var float orb_building_h = na
var float orb_building_l = na
var bool is_building = false
// Get M1 bar time components
m1_hour = hour(m1_time)
m1_minute = minute(m1_time)
// Reset daily
if ta.change(time("D")) != 0
orb_h := na
orb_l := na
orb_ready := false
orb_building_h := na
orb_building_l := na
is_building := false
// Build ORB using M1 data
if is_orb_period(m1_hour, m1_minute) and not orb_ready
is_building := true
val_h = exclude_wicks ? m1_close : m1_high
val_l = exclude_wicks ? m1_close : m1_low
if na(orb_building_h)
orb_building_h := val_h
orb_building_l := val_l
else
orb_building_h := math.max(orb_building_h, val_h)
orb_building_l := math.min(orb_building_l, val_l)
// FIX #1: Set is_building to false when NOT in ORB period anymore
if not is_orb_period(m1_hour, m1_minute) and is_building and not orb_ready
is_building := false
// Finalize ORB when period ends
if orb_ended(m1_hour, m1_minute) and not orb_ready
orb_h := orb_building_h
orb_l := orb_building_l
orb_ready := true
is_building := false
// Display building values in real-time
current_orb_h = is_building ? orb_building_h : orb_h
current_orb_l = is_building ? orb_building_l : orb_l
// ════════════════════════ INDICATORS ════════════════════════
ema9 = ta.ema(close, 9)
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
rsi = ta.rsi(close, 14)
= ta.macd(close, 12, 26, 9)
= ta.bb(close, 20, 2)
atr = ta.atr(14)
vol_ma = ta.sma(volume, 20)
// ════════════════════════ STRATEGY SIGNALS ════════════════════════
// 1. Trend Following
tf_short = ta.sma(close, 10)
tf_long = ta.sma(close, 30)
tf_bull = tf_short > tf_long
tf_bear = tf_short < tf_long
// 2. Mean Reversion
mr_mean = ta.sma(close, 20)
mr_dev = (close - mr_mean) / mr_mean * 100
mr_bull = mr_dev <= -0.5
mr_bear = mr_dev >= 0.5
// 3. Statistical Arb
sa_mean = ta.sma(close, 120)
sa_std = ta.stdev(close, 120)
sa_z = sa_std > 0 ? (close - sa_mean) / sa_std : 0
var string sa_st = "flat"
if sa_st == "flat"
if sa_z <= -2.0
sa_st := "long"
else if sa_z >= 2.0
sa_st := "short"
else if math.abs(sa_z) <= 0.5 or math.abs(sa_z) >= 4.0
sa_st := "flat"
sa_bull = sa_st == "long"
sa_bear = sa_st == "short"
// 4. Market Making
mm_spread = (high - low) / close * 100
mm_mid = (high + low) / 2
mm_bull = close < mm_mid and mm_spread >= 0.5
mm_bear = close > mm_mid and mm_spread >= 0.5
// 5. Basis Arb
ba_fair = ta.sma(close, 50)
ba_bps = ba_fair != 0 ? (close - ba_fair) / ba_fair * 10000 : 0
ba_bull = ba_bps <= -8.0
ba_bear = ba_bps >= 8.0
// Vote counting
bull_v = 0
bear_v = 0
if use_tf
bull_v := bull_v + (tf_bull ? 1 : 0)
bear_v := bear_v + (tf_bear ? 1 : 0)
if use_mr
bull_v := bull_v + (mr_bull ? 1 : 0)
bear_v := bear_v + (mr_bear ? 1 : 0)
if use_sa
bull_v := bull_v + (sa_bull ? 1 : 0)
bear_v := bear_v + (sa_bear ? 1 : 0)
if use_mm
bull_v := bull_v + (mm_bull ? 1 : 0)
bear_v := bear_v + (mm_bear ? 1 : 0)
if use_ba
bull_v := bull_v + (ba_bull ? 1 : 0)
bear_v := bear_v + (ba_bear ? 1 : 0)
// Technical filters - Simplified scoring system
ema_ok_b = not use_ema or (ema9 > ema21 and close > ema50)
ema_ok_s = not use_ema or (ema9 < ema21 and close < ema50)
rsi_ok_b = not use_rsi or (rsi > 40 and rsi < 80) // More lenient
rsi_ok_s = not use_rsi or (rsi < 60 and rsi > 20) // More lenient
macd_ok_b = not use_macd or macd > sig
macd_ok_s = not use_macd or macd < sig
vol_ok = not use_vol or volume > vol_ma * 1.2 // More lenient
bb_ok_b = not use_bb or close > bb_mid
bb_ok_s = not use_bb or close < bb_mid
// Technical score (need at least 2 out of 5 filters)
tech_score_b = (ema_ok_b ? 1 : 0) + (rsi_ok_b ? 1 : 0) + (macd_ok_b ? 1 : 0) + (bb_ok_b ? 1 : 0) + (vol_ok ? 1 : 0)
tech_score_s = (ema_ok_s ? 1 : 0) + (rsi_ok_s ? 1 : 0) + (macd_ok_s ? 1 : 0) + (bb_ok_s ? 1 : 0) + (vol_ok ? 1 : 0)
tech_bull = tech_score_b >= 2
tech_bear = tech_score_s >= 2
// Breakout - SIMPLIFIED (just need close above/below ORB)
brk_bull = orb_ready and close > current_orb_h
brk_bear = orb_ready and close < current_orb_l
// Consensus - At least 2 strategies agree (not majority)
total_st = (use_tf ? 1 : 0) + (use_mr ? 1 : 0) + (use_sa ? 1 : 0) + (use_mm ? 1 : 0) + (use_ba ? 1 : 0)
consensus_b = bull_v >= 2
consensus_s = bear_v >= 2
// Final signals - MUCH MORE LENIENT
daily_ok = yest_size >= 50 // Reduced from 100
buy = brk_bull and consensus_b and tech_bull and is_market_open()
sell = brk_bear and consensus_s and tech_bear and is_market_open()
// ════════════════════════ SL/TP ════════════════════════
// IMMEDIATE SL/TP LEVELS - Calculated as soon as ORB is ready (at 8:00)
var float long_entry = na
var float long_sl = na
var float long_tp = na
var float short_entry = na
var float short_sl = na
var float short_tp = na
// Calculate potential levels immediately when ORB is ready
if orb_ready and not na(orb_h) and not na(orb_l)
// Long scenario: Entry at ORB high breakout
long_entry := orb_h
long_sl := use_fixed ? long_entry - fixed_sl : long_entry - atr * atr_sl
long_tp := use_fixed ? long_entry + fixed_tp : long_entry + atr * atr_tp
// Short scenario: Entry at ORB low breakout
short_entry := orb_l
short_sl := use_fixed ? short_entry + fixed_sl : short_entry + atr * atr_sl
short_tp := use_fixed ? short_entry - fixed_tp : short_entry - atr * atr_tp
// Signal-based entry tracking (for dashboard and alerts)
var float buy_entry = na
var float buy_sl = na
var float buy_tp = na
var float sell_entry = na
var float sell_sl = na
var float sell_tp = na
if buy
buy_entry := close
buy_sl := use_fixed ? buy_entry - fixed_sl : buy_entry - atr * atr_sl
buy_tp := use_fixed ? buy_entry + fixed_tp : buy_entry + atr * atr_tp
if sell
sell_entry := close
sell_sl := use_fixed ? sell_entry + fixed_sl : sell_entry + atr * atr_sl
sell_tp := use_fixed ? sell_entry - fixed_tp : sell_entry - atr * atr_tp
buy_rr = not na(buy_entry) ? (buy_tp - buy_entry) / (buy_entry - buy_sl) : 0
sell_rr = not na(sell_entry) ? (sell_entry - sell_tp) / (sell_sl - sell_entry) : 0
buy_final = buy and buy_rr >= min_rr
sell_final = sell and sell_rr >= min_rr
// ════════════════════════ TRAILING STOPS ════════════════════════
// Trailing Stop Loss and Take Profit Management
var float trailing_sl_long = na
var float trailing_sl_short = na
var float trailing_tp_long = na
var float trailing_tp_short = na
var bool in_long = false
var bool in_short = false
var float highest_since_entry = na
var float lowest_since_entry = na
// Enter long position
if buy_final and not in_long
in_long := true
in_short := false
trailing_sl_long := buy_sl
trailing_tp_long := buy_tp
highest_since_entry := close
// Enter short position
if sell_final and not in_short
in_short := true
in_long := false
trailing_sl_short := sell_sl
trailing_tp_short := sell_tp
lowest_since_entry := close
// Update trailing stops for LONG
if in_long
// Track highest price since entry
highest_since_entry := math.max(highest_since_entry, high)
// Trail stop loss (moves up as price moves up)
// When price moves 1 ATR in profit, move SL to breakeven
// When price moves 2 ATR in profit, move SL to +1 ATR
profit_atr = (highest_since_entry - buy_entry) / atr
if profit_atr >= 2.0
trailing_sl_long := math.max(trailing_sl_long, buy_entry + atr * 1.0)
else if profit_atr >= 1.0
trailing_sl_long := math.max(trailing_sl_long, buy_entry)
// Smart trailing TP - extends TP if strong momentum
if highest_since_entry > trailing_tp_long * 0.9 and rsi > 60 // Within 10% of TP and strong momentum
trailing_tp_long := trailing_tp_long + atr * 0.5 // Extend TP
// Exit conditions
if close <= trailing_sl_long or close >= trailing_tp_long
in_long := false
trailing_sl_long := na
trailing_tp_long := na
highest_since_entry := na
// Update trailing stops for SHORT
if in_short
// Track lowest price since entry
lowest_since_entry := math.min(lowest_since_entry, low)
// Trail stop loss (moves down as price moves down)
profit_atr = (sell_entry - lowest_since_entry) / atr
if profit_atr >= 2.0
trailing_sl_short := math.min(trailing_sl_short, sell_entry - atr * 1.0)
else if profit_atr >= 1.0
trailing_sl_short := math.min(trailing_sl_short, sell_entry)
// Smart trailing TP - extends TP if strong momentum
if lowest_since_entry < trailing_tp_short * 1.1 and rsi < 40 // Within 10% of TP and strong momentum
trailing_tp_short := trailing_tp_short - atr * 0.5 // Extend TP
// Exit conditions
if close >= trailing_sl_short or close <= trailing_tp_short
in_short := false
trailing_sl_short := na
trailing_tp_short := na
lowest_since_entry := na
// ════════════════════════ ANALYTICS ════════════════════════
prob_strat = total_st > 0 ? math.max(bull_v, bear_v) / total_st * 100 : 50
prob_tech = (tech_bull or tech_bear) ? 75 : 35
prob_vol = vol_ok ? 85 : 50
prob_daily = daily_ok ? 85 : 30
prob_orb = orb_ready ? 80 : 20
probability = prob_strat * 0.3 + prob_tech * 0.25 + prob_vol * 0.15 + prob_daily * 0.15 + prob_orb * 0.15
dir_score = 0
dir_score := dir_score + (ema9 > ema21 ? 2 : -2)
dir_score := dir_score + (tf_bull ? 2 : -2)
dir_score := dir_score + (macd > sig ? 1 : -1)
dir_score := dir_score + (rsi > 50 ? 1 : -1)
direction = dir_score >= 2 ? "STRONG BULL" : (dir_score > 0 ? "BULL" : (dir_score <= -2 ? "STRONG BEAR" : (dir_score < 0 ? "BEAR" : "NEUTRAL")))
clean_trend = math.abs(ema9 - ema21) / close * 100
clean_noise = atr / close * 100
clean_struct = close > ema9 and close > ema21 and close > ema50 or close < ema9 and close < ema21 and close < ema50
clean_score = (clean_trend > 0.5 ? 30 : 10) + (clean_noise < 1.5 ? 30 : 10) + (clean_struct ? 40 : 10)
quality = clean_score >= 70 ? "CLEAN" : (clean_score >= 50 ? "GOOD" : (clean_score >= 30 ? "OK" : "CHOPPY"))
mom = ta.mom(close, 10)
mom_str = math.abs(mom) / close * 100
vol_rat = atr / ta.sma(atr, 20)
movement = buy_final or sell_final ? (mom_str > 0.8 and vol_rat > 1.3 ? "STRONG" : (mom_str > 0.5 ? "MODERATE" : "GRADUAL")) : "WAIT"
ok_score = (daily_ok ? 25 : 0) + (orb_ready ? 25 : 0) + (is_market_open() ? 20 : 0) + (clean_score >= 50 ? 20 : 5) + (probability >= 60 ? 10 : 0)
ok_trade = ok_score >= 65
// ════════════════════════ KEY LEVELS WITH BIAS ════════════════════════
// Calculate potential reaction levels with directional bias
var float key_levels = array.new_float(0)
var string key_bias = array.new_string(0)
if barstate.islast and show_levels
array.clear(key_levels)
array.clear(key_bias)
// Add levels with bias
if not na(current_orb_h)
array.push(key_levels, current_orb_h)
array.push(key_bias, consensus_b ? "BULL BREAK" : "RESISTANCE")
if not na(current_orb_l)
array.push(key_levels, current_orb_l)
array.push(key_bias, consensus_s ? "BEAR BREAK" : "SUPPORT")
if not na(prev_day_high)
array.push(key_levels, prev_day_high)
bias_pdh = close > prev_day_high ? "BULLISH" : (close < prev_day_high and close > prev_day_high * 0.995 ? "WATCH" : "RESIST")
array.push(key_bias, bias_pdh)
if not na(prev_day_low)
array.push(key_levels, prev_day_low)
bias_pdl = close < prev_day_low ? "BEARISH" : (close > prev_day_low and close < prev_day_low * 1.005 ? "WATCH" : "SUPPORT")
array.push(key_bias, bias_pdl)
if not na(today_high)
array.push(key_levels, today_high)
array.push(key_bias, "TODAY HIGH")
if not na(today_low)
array.push(key_levels, today_low)
array.push(key_bias, "TODAY LOW")
// Add EMA50 as dynamic level
array.push(key_levels, ema50)
ema_bias = close > ema50 ? "BULL SUPPORT" : "BEAR RESIST"
array.push(key_bias, ema_bias)
// ════════════════════════ VISUALS ════════════════════════
// Previous day lines
plot(show_lines ? prev_day_high : na, "Prev Day H", color.new(color.yellow, 0), 1, plot.style_line)
plot(show_lines ? prev_day_low : na, "Prev Day L", color.new(color.orange, 0), 1, plot.style_line)
// Current day high/low
plot(show_lines ? today_high : na, "Today High", color.new(color.lime, 40), 2, plot.style_circles)
plot(show_lines ? today_low : na, "Today Low", color.new(color.red, 40), 2, plot.style_circles)
// ORB lines (show building values in real-time with separate plots)
// Building phase - circles (orange during building)
plot(show_lines and is_building and not na(current_orb_h) ? current_orb_h : na, "ORB High Building", color.new(color.orange, 30), 3, plot.style_circles)
plot(show_lines and is_building and not na(current_orb_l) ? current_orb_l : na, "ORB Low Building", color.new(color.orange, 30), 3, plot.style_circles)
// Ready phase - ULTRA BRIGHT solid lines
plot(show_lines and not is_building and not na(current_orb_h) ? current_orb_h : na, "ORB High Ready", color.new(color.aqua, 0), 4, plot.style_line)
plot(show_lines and not is_building and not na(current_orb_l) ? current_orb_l : na, "ORB Low Ready", color.new(color.aqua, 0), 4, plot.style_line)
// ORB zone fill
p1 = plot(not na(current_orb_h) ? current_orb_h : na, display=display.none)
p2 = plot(not na(current_orb_l) ? current_orb_l : na, display=display.none)
fill_color = is_building ? color.new(color.blue, 93) : color.new(color.blue, 88)
fill(p1, p2, fill_color, title="ORB Zone")
// FIX #2: Draw ORB rectangle box ONLY ONCE when ready (use var to track if already drawn)
var box orb_box = na
var int orb_start_bar = na
var bool orb_box_drawn = false
// Reset box drawn flag on new day
if ta.change(time("D")) != 0
orb_box_drawn := false
// Capture the bar when ORB becomes ready
if orb_ready and not orb_ready
orb_start_bar := bar_index
orb_box_drawn := false // Allow new box to be drawn
// Draw box ONLY ONCE when ORB first becomes ready
if orb_ready and not orb_box_drawn and not na(orb_h) and not na(orb_l) and show_lines
if not na(orb_box)
box.delete(orb_box)
// Ultra clear rectangle with thick bright borders
box_color = color.new(color.aqua, 85) // Bright aqua fill
border_color = color.new(color.aqua, 0) // Solid bright aqua border
orb_box := box.new(orb_start_bar, orb_h, bar_index + 50, orb_l,
border_color=border_color,
border_width=3, // Thicker border
bgcolor=box_color,
extend=extend.right,
text="ORB ZONE",
text_size=size.normal, // Larger text
text_color=color.new(color.aqua, 0)) // Bright text
orb_box_drawn := true
// Update box right edge on each bar (without creating new box)
if orb_box_drawn and not na(orb_box) and show_lines
box.set_right(orb_box, bar_index)
// EMAs
plot(use_ema ? ema9 : na, "EMA9", color.new(color.blue, 20), 1)
plot(use_ema ? ema21 : na, "EMA21", color.new(color.orange, 20), 1)
plot(use_ema ? ema50 : na, "EMA50", color.new(color.purple, 30), 2)
// Signals
plotshape(buy_final, "BUY", shape.triangleup, location.belowbar, color.new(color.lime, 0), size=size.small, text="BUY")
plotshape(sell_final, "SELL", shape.triangledown, location.abovebar, color.new(color.red, 0), size=size.small, text="SELL")
// Exit signals
plotshape(in_long and not in_long, "EXIT LONG", shape.xcross, location.abovebar, color.new(color.orange, 0), size=size.tiny, text="EXIT")
plotshape(in_short and not in_short, "EXIT SHORT", shape.xcross, location.belowbar, color.new(color.orange, 0), size=size.tiny, text="EXIT")
// Trailing stop lines
plot(in_long and not na(trailing_sl_long) ? trailing_sl_long : na, "Trail SL Long", color.new(color.red, 0), 2, plot.style_cross)
plot(in_long and not na(trailing_tp_long) ? trailing_tp_long : na, "Trail TP Long", color.new(color.lime, 0), 2, plot.style_cross)
plot(in_short and not na(trailing_sl_short) ? trailing_sl_short : na, "Trail SL Short", color.new(color.red, 0), 2, plot.style_cross)
plot(in_short and not na(trailing_tp_short) ? trailing_tp_short : na, "Trail TP Short", color.new(color.lime, 0), 2, plot.style_cross)
// FIX #3: IMMEDIATE SL/TP LINES - Draw ONLY ONCE when ORB is ready
var line long_sl_ln = na
var line long_tp_ln = na
var line short_sl_ln = na
var line short_tp_ln = na
var label long_sl_lbl = na
var label long_tp_lbl = na
var label short_sl_lbl = na
var label short_tp_lbl = na
var bool sltp_lines_drawn = false
// Reset lines drawn flag on new day
if ta.change(time("D")) != 0
sltp_lines_drawn := false
// Draw lines ONLY ONCE when ORB first becomes ready
if orb_ready and not orb_ready and show_lines
sltp_lines_drawn := false // Allow new lines to be drawn
if orb_ready and not sltp_lines_drawn and show_lines
// Delete old lines
if not na(long_sl_ln)
line.delete(long_sl_ln)
line.delete(long_tp_ln)
line.delete(short_sl_ln)
line.delete(short_tp_ln)
label.delete(long_sl_lbl)
label.delete(long_tp_lbl)
label.delete(short_sl_lbl)
label.delete(short_tp_lbl)
// LONG scenario (green - bullish breakout above ORB high)
if not na(long_sl) and not na(long_tp)
long_sl_ln := line.new(bar_index, long_sl, bar_index + 100, long_sl, color=color.new(color.red, 0), width=2, style=line.style_solid, extend=extend.right)
long_tp_ln := line.new(bar_index, long_tp, bar_index + 100, long_tp, color=color.new(color.lime, 0), width=2, style=line.style_solid, extend=extend.right)
long_sl_lbl := label.new(bar_index, long_sl, "LONG SL: " + str.tostring(long_sl, "#.##"), style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.small)
long_tp_lbl := label.new(bar_index, long_tp, "LONG TP: " + str.tostring(long_tp, "#.##"), style=label.style_label_left, color=color.new(color.lime, 0), textcolor=color.black, size=size.small)
// SHORT scenario (red - bearish breakout below ORB low)
if not na(short_sl) and not na(short_tp)
short_sl_ln := line.new(bar_index, short_sl, bar_index + 100, short_sl, color=color.new(color.red, 0), width=2, style=line.style_solid, extend=extend.right)
short_tp_ln := line.new(bar_index, short_tp, bar_index + 100, short_tp, color=color.new(color.lime, 0), width=2, style=line.style_solid, extend=extend.right)
short_sl_lbl := label.new(bar_index, short_sl, "SHORT SL: " + str.tostring(short_sl, "#.##"), style=label.style_label_left, color=color.new(color.red, 0), textcolor=color.white, size=size.small)
short_tp_lbl := label.new(bar_index, short_tp, "SHORT TP: " + str.tostring(short_tp, "#.##"), style=label.style_label_left, color=color.new(color.lime, 0), textcolor=color.black, size=size.small)
sltp_lines_drawn := true
// FIX #4: Key level labels - Track and delete old labels to prevent duplication
var label key_level_labels = array.new_label(0)
// Delete all old key level labels
if array.size(key_level_labels) > 0
for i = 0 to array.size(key_level_labels) - 1
label.delete(array.get(key_level_labels, i))
array.clear(key_level_labels)
// Create key level labels only on last bar
if barstate.islast and show_levels and array.size(key_levels) > 0
for i = 0 to array.size(key_levels) - 1
lvl = array.get(key_levels, i)
bias = array.get(key_bias, i)
// Color based on bias
lbl_color = str.contains(bias, "BULL") ? color.new(color.green, 70) : (str.contains(bias, "BEAR") ? color.new(color.red, 70) : (str.contains(bias, "SUPPORT") ? color.new(color.blue, 70) : (str.contains(bias, "RESIST") ? color.new(color.orange, 70) : color.new(color.gray, 70))))
txt_color = str.contains(bias, "BULL") ? color.green : (str.contains(bias, "BEAR") ? color.red : (str.contains(bias, "SUPPORT") ? color.blue : (str.contains(bias, "RESIST") ? color.orange : color.gray)))
new_lbl = label.new(bar_index + 2, lvl, str.tostring(lvl, "#.##") + " " + bias, style=label.style_label_left, color=lbl_color, textcolor=txt_color, size=size.tiny, textalign=text.align_left)
array.push(key_level_labels, new_lbl)
// FIX #5: Compact chart info labels - Track and delete to prevent duplication
var label prob_label = na
var label dir_label = na
if barstate.islast and show_lines
// Delete old labels
if not na(prob_label)
label.delete(prob_label)
if not na(dir_label)
label.delete(dir_label)
// Create new labels
prob_c = probability >= 70 ? color.green : (probability >= 50 ? color.yellow : color.red)
prob_label := label.new(bar_index, high + atr * 1.2, str.tostring(probability, "#") + "%", style=label.style_none, textcolor=prob_c, size=size.small)
dir_c = str.contains(direction, "BULL") ? color.green : (str.contains(direction, "BEAR") ? color.red : color.gray)
dir_label := label.new(bar_index, high + atr * 2, direction, style=label.style_none, textcolor=dir_c, size=size.tiny)
// ════════════════════════ DASHBOARD ════════════════════════
var table dash = table.new(position.top_right, 2, 20, bgcolor=color.new(color.black, 5), border_width=1, border_color=color.new(color.gray, 60))
if barstate.islast and show_dash
r = 0
// Header
table.cell(dash, 0, r, "DAX ORB ULTIMATE", text_color=color.white, bgcolor=color.new(color.blue, 30), text_size=size.small)
table.cell(dash, 1, r, timeframe.period, text_color=color.yellow, bgcolor=color.new(color.blue, 30), text_size=size.tiny)
// Current Day
r += 1
table.cell(dash, 0, r, "TODAY H/L", text_color=color.aqua, text_size=size.tiny)
table.cell(dash, 1, r, "", text_color=color.white)
r += 1
table.cell(dash, 0, r, "High", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(today_high, "#.##"), text_color=color.lime, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Low", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(today_low, "#.##"), text_color=color.red, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Range", text_color=color.gray, text_size=size.tiny)
today_range = today_high - today_low
table.cell(dash, 1, r, str.tostring(today_range, "#") + "p", text_color=color.aqua, text_size=size.tiny)
// Previous Day
r += 1
table.cell(dash, 0, r, "PREV H/L", text_color=color.aqua, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(yest_size, "#") + "p", text_color=daily_ok ? color.lime : color.red, text_size=size.tiny)
// ORB Status with real-time values
r += 1
table.cell(dash, 0, r, "ORB 7:40-8:00", text_color=color.aqua, text_size=size.tiny)
orb_status = is_building ? "BUILDING" : (orb_ready ? "READY" : "WAIT")
orb_clr = is_building ? color.orange : (orb_ready ? color.lime : color.gray)
table.cell(dash, 1, r, orb_status, text_color=orb_clr, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "High", text_color=color.gray, text_size=size.tiny)
orb_h_txt = not na(current_orb_h) ? str.tostring(current_orb_h, "#.##") : "---"
table.cell(dash, 1, r, orb_h_txt, text_color=is_building ? color.orange : color.green, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Low", text_color=color.gray, text_size=size.tiny)
orb_l_txt = not na(current_orb_l) ? str.tostring(current_orb_l, "#.##") : "---"
table.cell(dash, 1, r, orb_l_txt, text_color=is_building ? color.orange : color.red, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Size", text_color=color.gray, text_size=size.tiny)
orb_size = not na(current_orb_h) and not na(current_orb_l) ? current_orb_h - current_orb_l : 0
table.cell(dash, 1, r, str.tostring(orb_size, "#") + "p", text_color=color.yellow, text_size=size.tiny)
// Strategies
r += 1
table.cell(dash, 0, r, "STRATEGIES", text_color=color.aqua, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(bull_v) + "B " + str.tostring(bear_v) + "S", text_color=color.yellow, text_size=size.tiny)
// Analytics
r += 1
table.cell(dash, 0, r, "PROBABILITY", text_color=color.white, bgcolor=color.new(color.purple, 70), text_size=size.small)
prob_c = probability >= 70 ? color.lime : (probability >= 50 ? color.yellow : color.red)
table.cell(dash, 1, r, str.tostring(probability, "#") + "%", text_color=prob_c, bgcolor=color.new(color.purple, 70), text_size=size.small)
r += 1
table.cell(dash, 0, r, "Direction", text_color=color.gray, text_size=size.tiny)
dir_c = str.contains(direction, "BULL") ? color.lime : (str.contains(direction, "BEAR") ? color.red : color.gray)
table.cell(dash, 1, r, direction, text_color=dir_c, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Chart", text_color=color.gray, text_size=size.tiny)
qual_c = quality == "CLEAN" ? color.lime : (quality == "GOOD" ? color.green : (quality == "OK" ? color.yellow : color.red))
table.cell(dash, 1, r, quality, text_color=qual_c, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "OK Trade?", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, ok_trade ? "YES" : "NO", text_color=ok_trade ? color.lime : color.red, text_size=size.tiny)
// Position Status
r += 1
pos_txt = in_long ? "IN LONG" : (in_short ? "IN SHORT" : "NO POSITION")
pos_c = in_long ? color.lime : (in_short ? color.red : color.gray)
table.cell(dash, 0, r, "POSITION", text_color=color.white, bgcolor=color.new(color.blue, 50), text_size=size.small)
table.cell(dash, 1, r, pos_txt, text_color=pos_c, bgcolor=color.new(color.blue, 50), text_size=size.small)
// Show trailing stops if in position
if in_long and not na(trailing_sl_long)
r += 1
table.cell(dash, 0, r, "Trail SL", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(trailing_sl_long, "#.##"), text_color=color.red, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Trail TP", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(trailing_tp_long, "#.##"), text_color=color.lime, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Profit", text_color=color.gray, text_size=size.tiny)
pnl = close - buy_entry
pnl_c = pnl > 0 ? color.lime : color.red
table.cell(dash, 1, r, str.tostring(pnl, "#.#") + "p", text_color=pnl_c, text_size=size.tiny)
if in_short and not na(trailing_sl_short)
r += 1
table.cell(dash, 0, r, "Trail SL", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(trailing_sl_short, "#.##"), text_color=color.red, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Trail TP", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(trailing_tp_short, "#.##"), text_color=color.lime, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "Profit", text_color=color.gray, text_size=size.tiny)
pnl = sell_entry - close
pnl_c = pnl > 0 ? color.lime : color.red
table.cell(dash, 1, r, str.tostring(pnl, "#.#") + "p", text_color=pnl_c, text_size=size.tiny)
// Signal
r += 1
table.cell(dash, 0, r, "SIGNAL", text_color=color.white, bgcolor=color.new(color.green, 50), text_size=size.small)
sig_txt = buy_final ? "BUY NOW" : (sell_final ? "SELL NOW" : "WAIT")
sig_c = buy_final ? color.lime : (sell_final ? color.red : color.gray)
table.cell(dash, 1, r, sig_txt, text_color=sig_c, bgcolor=color.new(color.green, 50), text_size=size.small)
// IMMEDIATE Trade Levels - Show as soon as ORB is ready
if orb_ready and not na(long_entry) and not na(short_entry)
r += 1
table.cell(dash, 0, r, "LONG LEVELS", text_color=color.lime, bgcolor=color.new(color.green, 70), text_size=size.tiny)
table.cell(dash, 1, r, "", text_color=color.white)
r += 1
table.cell(dash, 0, r, "Entry", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(long_entry, "#.##"), text_color=color.white, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "SL", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(long_sl, "#.##"), text_color=color.red, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "TP", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(long_tp, "#.##"), text_color=color.lime, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "SHORT LEVELS", text_color=color.red, bgcolor=color.new(color.red, 70), text_size=size.tiny)
table.cell(dash, 1, r, "", text_color=color.white)
r += 1
table.cell(dash, 0, r, "Entry", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(short_entry, "#.##"), text_color=color.white, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "SL", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(short_sl, "#.##"), text_color=color.red, text_size=size.tiny)
r += 1
table.cell(dash, 0, r, "TP", text_color=color.gray, text_size=size.tiny)
table.cell(dash, 1, r, str.tostring(short_tp, "#.##"), text_color=color.lime, text_size=size.tiny)
// ════════════════════════ ALERTS ════════════════════════
alertcondition(buy_final, "BUY Signal", "DAX ORB BUY")
alertcondition(sell_final, "SELL Signal", "DAX ORB SELL")
alertcondition(orb_ready and not orb_ready , "ORB Ready", "DAX ORB READY")
alertcondition(is_building and not is_building , "ORB Building", "DAX ORB BUILDING")
alertcondition(ok_trade and not ok_trade , "Ready to Trade", "DAX OK")






















