Kalman Adjusted Average True Range [BackQuant]Kalman Adjusted Average True Range
A volatility-aware trend baseline that fuses a Kalman price estimate with ATR “rails” to create a smooth, adaptive guide for entries, exits, and trailing risk.
Built on my original Kalman
This indicator is based on my original Kalman Price Filter:
That core smoother is used here to estimate the “true” price path, then blended with ATR to control step size and react proportionally to market noise.
What it plots
Kalman ATR Line the main baseline that turns up/down with the filtered trend.
Optional Moving Average of the Kalman ATR a secondary line for confluence (SMA/Hull/EMA/WMA/DEMA/RMA/LINREG/ALMA).
Candle Coloring (optional) paint bars by the baseline’s current direction.
Why combine Kalman + ATR?
Kalman reduces measurement noise and produces a stable path without the lag of heavy MAs.
ATR rails scale the baseline’s step to current volatility, so it’s calm in chop and more responsive in expansion.
The result is a single, intelligible line you can trade around: slope-up = constructive; slope-down = caution.
How it works (plain English)
Each bar, the Kalman filter updates an internal state (tunable via Process Noise , Measurement Noise , and Filter Order ) to estimate the underlying price.
An ATR band (Period × Factor) defines the allowed per-bar adjustment. The baseline cannot “jump” beyond those rails in one step.
A direction flip is detected when the baseline’s slope changes sign (upturn/downturn), and alerts are provided for both.
Typical uses
Trend confirmation Trade in the baseline’s direction; avoid fading a firmly rising/falling line.
Pullback timing Look for entries when price mean-reverts toward a rising baseline (or exits on tags of a falling one).
Trailing risk Use the baseline as a dynamic guide; many traders set stops a small buffer beyond it (e.g., a fraction of ATR).
Confluence Enable the MA overlay of the Kalman ATR; alignment (baseline above its MA and rising) supports continuation.
Inputs & what they do
Calculation
Kalman Price Source which price the filter tracks (Close by default).
Process Noise how quickly the filter can adapt. Higher = more responsive (but choppier).
Measurement Noise how much you distrust raw price. Higher = smoother (but slower to turn).
Filter Order (N) depth of the internal state array. Higher = slightly steadier behavior.
Kalman ATR
Period ATR lookback. Shorter = snappier; longer = steadier.
Factor scales the allowed step per bar. Larger factors permit faster drift; smaller factors clamp movement.
Confluence (optional)
MA Type & Period compute an MA on the Kalman ATR line , not on price.
Sigma (ALMA) if ALMA is selected, this input controls the curve’s shape. (Ignored for other MA types.)
Visuals
Plot Kalman ATR toggle the main line.
Paint Candles color bars by up/down slope.
Colors choose long/short hues.
Signals & alerts
Trend Up baseline turns upward (slope crosses above 0).
Alert: “Kalman ATR Trend Up”
Trend Down baseline turns downward (slope crosses below 0).
Alert: “Kalman ATR Trend Down”
These are state flips , not “price crossovers,” so you avoid many one-bar head-fakes.
How to start (fast presets)
Swing (daily/4H) ATR Period 7–14, Factor 0.5–0.8, Process Noise 0.02–0.05, Measurement Noise 2–4, N = 3–5.
Intraday (5–15m) ATR Period 5–7, Factor 0.6–1.0, Process Noise 0.05–0.10, Measurement Noise 2–3, N = 3–5.
Slow assets / FX raise Measurement Noise or ATR Period for calmer lines; drop Factor if the baseline feels too jumpy.
Reading the line
Rising & curving upward momentum building; consider long bias until a clear downturn.
Flat & choppy regime uncertainty; many traders stand aside or tighten risk.
Falling & accelerating distribution lower; short bias until a clean upturn.
Practical playbook
Continuation entries After a Trend Up alert, wait for a minor pullback toward the baseline; enter on evidence the line keeps rising.
Exit/reduce If long and the baseline flattens then turns down, trim or exit; reverse logic for shorts.
Filters Add a higher-timeframe check (e.g., only take longs when the daily Kalman ATR is rising).
Stops Place stops just beyond the baseline (e.g., baseline − x% ATR for longs) to avoid “tag & reverse” noise.
Notes
This is a guide to state and momentum, not a guarantee. Combine with your process (structure, volume, time-of-day) for decisions.
Settings are asset/timeframe dependent; start with the presets and nudge Process/Measurement Noise until the baseline “feels right” for your market.
Summary
Kalman ATR takes the noise-reduction of a Kalman price estimate and couples it with volatility-scaled movement to produce a clean, adaptive baseline. If you liked the original Kalman Price Filter (), this is its trend-trading cousin purpose-built for cleaner state flips, intuitive trailing, and confluence with your existing
Analisi trend
Information Flow Analysis[b🔄 Information Flow Analysis: Systematic Multi-Component Market Analysis Framework
SYSTEM OVERVIEW AND ANALYTICAL FOUNDATION
The Information Flow Kernel - Hybrid combines established technical analysis methods into a unified analytical framework. This indicator systematically processes three distinct data streams - directional price momentum, volume-weighted pressure dynamics, and intrabar development patterns - integrating them through weighted mathematical fusion to produce statistically normalized market flow measurements.
COMPREHENSIVE MATHEMATICAL FRAMEWORK
Component 1: Directional Flow Analysis
The directional component analyzes price momentum through three mathematical vectors:
Price Vector: p = C - O (intrabar directional bias)
Momentum Vector: m = C_t - C_{t-1} (bar-to-bar velocity)
Acceleration Vector: a = m_t - m_{t-1} (momentum rate of change)
Directional Signal Integration:
S_d = \text{sgn}(p) \cdot |p| + \text{sgn}(m) \cdot |m| \cdot 0.6 + \text{sgn}(a) \cdot |a| \cdot 0.3
The signum function preserves directional information while absolute values provide magnitude weighting. Coefficients create a hierarchy emphasizing intrabar movement (100%), momentum (60%), and acceleration (30%).
Final Directional Output: K_1 = S_d \cdot w_d where w_d is the directional weight parameter.
Component 2: Volume-Weighted Pressure Analysis
Volume Normalization: r_v = \frac{V_t}{\overline{V_n}} where \overline{V_n} represents the n-period simple moving average of volume.
Base Pressure Calculation: P_{base} = \Delta C \cdot r_v \cdot w_v where \Delta C = C_t - C_{t-1} and w_v is the velocity weighting factor.
Volume Confirmation Function:
f(r_v) = \begin{cases}
1.4 & \text{if } r_v > 1.2 \
0.7 & \text{if } r_v < 0.8 \
1.0 & \text{otherwise}
\end{cases}
Final Pressure Output: K_2 = P_{base} \cdot f(r_v)
Component 3: Intrabar Development Analysis
Bar Position Calculation: B = \frac{C - L}{H - L} when H - L > 0 , else B = 0.5
Development Signal Function:
S_{dev} = \begin{cases}
2(B - 0.5) & \text{if } B > 0.6 \text{ or } B < 0.4 \
0 & \text{if } 0.4 \leq B \leq 0.6
\end{cases}
Final Development Output: K_3 = S_{dev} \cdot 0.4
Master Integration and Statistical Normalization
Weighted Component Fusion: F_{raw} = 0.5K_1 + 0.35K_2 + 0.15K_3
Sensitivity Scaling: F_{master} = F_{raw} \cdot s where s is the sensitivity parameter.
Statistical Normalization Process:
Rolling Mean: \mu_F = \frac{1}{n}\sum_{i=0}^{n-1} F_{master,t-i}
Rolling Standard Deviation: \sigma_F = \sqrt{\frac{1}{n}\sum_{i=0}^{n-1} (F_{master,t-i} - \mu_F)^2}
Z-Score Computation: z = \frac{F_{master} - \mu_F}{\sigma_F}
Boundary Enforcement: z_{bounded} = \max(-3, \min(3, z))
Final Normalization: N = \frac{z_{bounded}}{3}
Flow Metrics Calculation:
Intensity: I = |z|
Strength Percentage: S = \min(100, I \times 33.33)
Extreme Detection: \text{Extreme} = I > 2.0
DETAILED INPUT PARAMETER SPECIFICATIONS
Sensitivity (0.1 - 3.0, Default: 1.0)
Global amplification multiplier applied to the master flow calculation. Functions as: F_{master} = F_{raw} \cdot s
Low Settings (0.1 - 0.5): Enhanced precision for subtle market movements. Optimal for low-volatility environments, scalping strategies, and early detection of minor directional shifts. Increases responsiveness but may amplify noise.
Moderate Settings (0.6 - 1.2): Balanced sensitivity for standard market conditions across multiple timeframes.
High Settings (1.3 - 3.0): Reduced sensitivity to minor fluctuations while emphasizing significant flow changes. Ideal for high-volatility assets, trending markets, and longer timeframes.
Directional Weighting (0.1 - 1.0, Default: 0.7)
Controls emphasis on price direction versus volume and positioning factors. Applied as: K_{1,weighted} = K_1 \times w_d
Lower Values (0.1 - 0.4): Reduces directional bias, favoring volume-confirmed moves. Optimal for ranging markets where momentum may generate false signals.
Higher Values (0.7 - 1.0): Amplifies directional signals from price vectors and acceleration. Ideal for trending conditions where directional momentum drives price action.
Velocity Weighting (0.1 - 1.0, Default: 0.6)
Scales volume-confirmed price change impact. Applied in: P_{base} = \Delta C \times r_v \times w_v
Lower Values (0.1 - 0.4): Dampens volume spike influence, focusing on sustained pressure patterns. Suitable for illiquid assets or news-sensitive markets.
Higher Values (0.8 - 1.0): Amplifies high-volume directional moves. Optimal for liquid markets where volume provides reliable confirmation.
Volume Length (3 - 20, Default: 5)
Defines lookback period for volume averaging: \overline{V_n} = \frac{1}{n}\sum_{i=0}^{n-1} V_{t-i}
Short Periods (3 - 7): Responsive to recent volume shifts, excellent for intraday analysis.
Long Periods (13 - 20): Smoother averaging, better for swing trading and higher timeframes.
DASHBOARD SYSTEM
Primary Flow Gauge
Bilaterally symmetric visualization displaying normalized flow direction and intensity:
Segment Calculation: n_{active} = \lfloor |N| \times 15 \rfloor
Left Fill: Bearish flow when N < -0.01
Right Fill: Bullish flow when N > 0.01
Neutral Display: Empty segments when |N| \leq 0.01
Visual Style Options:
Matrix: Digital blocks (▰/▱) for quantitative precision
Wave: Progressive patterns (▁▂▃▄▅▆▇█) showing flow buildup
Dots: LED-style indicators (●/○) with intensity scaling
Blocks: Modern squares (■/□) for professional appearance
Pulse: Progressive markers (⎯ to █) emphasizing intensity buildup
Flow Intensity Visualization
30-segment horizontal bar graph with mathematical fill logic:
Segment Fill: For i \in : filled if \frac{i}{29} \leq \frac{S}{100}
Color Coding System:
Orange (S > 66%): High intensity, strong directional conviction
Cyan (33% ≤ S ≤ 66%): Moderate intensity, developing bias
White (S < 33%): Low intensity, neutral conditions
Extreme Detection Indicators
Circular markers flanking the gauge with state-dependent illumination:
Activation: I > 2.0 \land |N| > 0.3
Bright Yellow: Active extreme conditions
Dim Yellow: Normal conditions
Metrics Display
Balance Value: Raw master flow output ( F_{master} ) showing absolute directional pressure
Z-Score Value: Statistical deviation ( z_{bounded} ) indicating historical context
Dynamic Narrative System
Context-sensitive interpretation based on mathematical thresholds:
Extreme Flow: I > 2.0 \land |N| > 0.6
Moderate Flow: 0.3 < |N| \leq 0.6
High Volatility: S > 50 \land |N| \leq 0.3
Neutral State: S \leq 50 \land |N| \leq 0.3
ALERT SYSTEM SPECIFICATIONS
Mathematical Trigger Conditions:
Extreme Bullish: I > 2.0 \land N > 0.6
Extreme Bearish: I > 2.0 \land N < -0.6
High Intensity: S > 80
Bullish Shift: N_t > 0.3 \land N_{t-1} \leq 0.3
Bearish Shift: N_t < -0.3 \land N_{t-1} \geq -0.3
TECHNICAL IMPLEMENTATION AND PERFORMANCE
Computational Architecture
The system employs efficient calculation methods minimizing processing overhead:
Single-pass mathematical operations for all components
Conditional visual rendering (executed only on final bar)
Optimized array operations using direct calculations
Real-Time Processing
The indicator updates continuously during bar formation, providing immediate feedback on changing market conditions. Statistical normalization ensures consistent interpretation across varying market regimes.
Market Applicability
Optimal performance in liquid markets with consistent volume patterns. May require parameter adjustment for:
Low-volume or after-hours sessions
News-driven market conditions
Highly volatile cryptocurrency markets
Ranging versus trending market environments
PRACTICAL APPLICATION FRAMEWORK
Market State Classification
This indicator functions as a comprehensive market condition assessment tool providing:
Trend Analysis: High intensity readings ( S > 66% ) with sustained directional bias indicate strong trending conditions suitable for momentum strategies.
Reversal Detection: Extreme readings ( I > 2.0 ) at key technical levels may signal potential trend exhaustion or reversal points.
Range Identification: Low intensity with neutral flow ( S < 33%, |N| < 0.3 ) suggests ranging market conditions suitable for mean reversion strategies.
Volatility Assessment: High intensity without clear directional bias indicates elevated volatility with conflicting pressures.
Integration with Trading Systems
The normalized output range facilitates integration with automated trading systems and position sizing algorithms. The statistical basis provides consistent interpretation across different market conditions and asset classes.
LIMITATIONS AND CONSIDERATIONS
This indicator combines established technical analysis methods and processes historical data without predicting future price movements. The system performs optimally in liquid markets with consistent volume patterns and may produce false signals in thin trading conditions or during news-driven market events. This indicator is provided for educational and analytical purposes only and does not constitute financial advice. Users should combine this analysis with proper risk management, position sizing, and additional confirmation methods before making any trading decisions. Past performance does not guarantee future results.
Note: The term "kernel" in this context refers to modular calculation components rather than mathematical kernel functions in the formal computational sense.
As quantitative analyst Ralph Vince noted: "The essence of successful trading lies not in predicting market direction, but in the systematic processing of market information and the disciplined management of probability distributions."
— Dskyz, Trade with insight. Trade with anticipation.
Intraday Buy/Sell/Average Zones by Chaitu50cIntraday Buy/Sell/Average Zones by chaitu50c
Timeframe:
Tested on the 5-minute chart.
Recommended timeframe: 5-minute
What it does
This indicator marks intraday Buy (green) and Sell (red) zones made by strong close-confirmed breakouts. These zones act as support/resistance. If price later closes through a zone, the zone changes color from that bar forward (support ↔ resistance). It can flip more than once.
How zones form
Single breakout: an opposite-type candle closes beyond the previous candle’s high/low.
Double breakout: a base candle, then two opposite-type candles, and the second one closes beyond the base high/low.
Zone size
Buy zone: from the combo lowest low up to the nearest open/close of the combo.
Sell zone: from the combo highest high down to the nearest open/close of the combo.
Color shift (optional)
If price closes through a zone, it flips color at that bar and behaves as the other side (support ↔ resistance). Flips can happen again later.
Overlap control
When a new zone overlaps an existing same-color zone in the same session, choose:
Merge (combine), or
Suppress (ignore the new one).
Flipped zones use their current color for this.
Right edge & session
All zones extend to the right (your offset). Detection is limited to your chosen session, and you can show only the last N sessions.
---
How to trade (simple)
A) Initial breakout trade
When a new zone forms, that breakout itself can be a trade idea in the breakout direction, The stoploss will be the zone.
B) Zone breakout trade (flip)
If price later closes out of a zone and it changes color, that breakout is another trade opportunity in the new direction.
C) Retrace & average trade
When price retests a zone, wait for a confirmation candle in the zone’s favor
— bullish close for a green zone, bearish close for a red zone — then average entries inside/near the zone.
Place stops just beyond the opposite edge of the zone.
If the zone flips color, stop averaging; bias changed.
---
Key settings
Breakout type: Single and/or Double
Confirm on Close: strict mode (no intrabar preview) or allow intrabar preview that auto-removes if fail
Color Shift on Breaks: on/off
Same-Type Overlap: Merge/Suppress
Session, Sessions to Display, Right Offset, Colors, Max Zones
Reminder: Best results on the 5-minute timeframe (tested and recommended).
RSI Trend Navigator [QuantAlgo]🟢 Overview
The RSI Trend Navigator integrates RSI momentum calculations with adaptive exponential moving averages and ATR-based volatility bands to generate trend-following signals. The indicator applies variable smoothing coefficients based on RSI readings and incorporates normalized momentum adjustments to position a trend line that responds to both price action and underlying momentum conditions.
🟢 How It Works
The indicator begins by calculating and smoothing the RSI to reduce short-term fluctuations while preserving momentum information:
rsiValue = ta.rsi(source, rsiPeriod)
smoothedRSI = ta.ema(rsiValue, rsiSmoothing)
normalizedRSI = (smoothedRSI - 50) / 50
It then creates an adaptive smoothing coefficient that varies based on RSI positioning relative to the midpoint:
adaptiveAlpha = smoothedRSI > 50 ? 2.0 / (trendPeriod * 0.5 + 1) : 2.0 / (trendPeriod * 1.5 + 1)
This coefficient drives an adaptive trend calculation that responds more quickly when RSI indicates bullish momentum and more slowly during bearish conditions:
var float adaptiveTrend = source
adaptiveTrend := adaptiveAlpha * source + (1 - adaptiveAlpha) * nz(adaptiveTrend , source)
The normalized RSI values are converted into price-based adjustments using ATR for volatility scaling:
rsiAdjustment = normalizedRSI * ta.atr(14) * sensitivity
rsiTrendValue = adaptiveTrend + rsiAdjustment
ATR-based bands are constructed around this RSI-adjusted trend value to create dynamic boundaries that constrain trend line positioning:
atr = ta.atr(atrPeriod)
deviation = atr * atrMultiplier
upperBound = rsiTrendValue + deviation
lowerBound = rsiTrendValue - deviation
The trend line positioning uses these band constraints to determine its final value:
if upperBound < trendLine
trendLine := upperBound
if lowerBound > trendLine
trendLine := lowerBound
Signal generation occurs through directional comparison of the trend line against its previous value to establish bullish and bearish states:
trendUp = trendLine > trendLine
trendDown = trendLine < trendLine
if trendUp
isBullish := true
isBearish := false
else if trendDown
isBullish := false
isBearish := true
The final output colors the trend line green during bullish states and red during bearish states, creating visual buy/long and sell/short opportunity signals based on the combined RSI momentum and volatility-adjusted trend positioning.
🟢 Signal Interpretation
Rising Trend Line (Green): Indicates upward momentum where RSI influence and adaptive smoothing favor continued price advancement = Potential buy/long positions
Declining Trend Line (Red): Indicates downward momentum where RSI influence and adaptive smoothing favor continued price decline = Potential sell/short positions
Flattening Trend Lines: Occur when momentum weakens and the trend line slope approaches neutral, suggesting potential consolidation before the next move
Built-in Alert System: Automated notifications trigger when bullish or bearish states change, sending "RSI Trend Bullish Signal" or "RSI Trend Bearish Signal" messages for timely entry/exit
Color Bar Candles Option: Optional candle coloring feature that applies the same green/red trend colors to price bars, providing additional visual confirmation of the current trend direction
Multipower Entry SecretMultipower Entry Secret indicator is designed to be the ultimate trading companion for traders of all skill levels—especially those who struggle with decision-making due to unclear or overwhelming signals. Unlike conventional trading systems cluttered with too many lines and confusing alerts, this indicator provides a clear, adaptive, and actionable guide for market entries and exits.
Key Points:
Clear Buy/Sell/Wait Signals:
The script dynamically analyzes price action, candle patterns, volume, trend strength, and higher time frame context. This means it gives you “Buy,” “Sell,” or “Wait” signals based on real, meaningful market information—filtering out the noise and weak trades.
Multi-Timeframe Adaptive Analysis:
It synchronizes signals between higher and current timeframes, ensuring you get the most reliable direction—reducing the risk of getting caught in fake moves or sudden reversals.
Automatic Support, Resistance & Liquidity Zones:
Key levels like support, resistance, and liquidity zones are auto-detected and displayed directly on the chart, helping you make precise decisions without manual drawing.
Real-Time Dashboard:
All relevant information, such as trend strength, market intent, volume sentiment, and the reason behind each signal, is neatly summarized in a dashboard—making monitoring effortless and intuitive.
Customizable & Beginner-Friendly:
Whether you’re a newcomer wanting straightforward guidance or a professional needing advanced customization, the indicator offers flexible options to adjust analysis depth, timeframes, sensitivity, and more.
Visual & Clutter-Free:
The design ensures that your chart remains clean and readable, showing only the most important information. This minimizes mental overload and allows for instant decision-making.
Who Will Benefit?
Beginners who want to learn trading logic, avoid common traps, and see the exact reason behind every signal.
Advanced traders who require adaptive multi-timeframe analytics, fast execution, and stress-free monitoring.
Anyone who wants to save screen time, reduce analysis paralysis, and have more confidence in every trade they take.
1. No Indicator Clutter
Intent:
Many traders get confused by charts filled with too many indicators and signals. This often leads to hesitation, missed trades, or taking random, risky trades.
In this Indicator:
You get a clean and clutter-free chart. Only the most important buy/sell/wait signals and relevant support/resistance/liquidity levels are shown. These update automatically, removing the “overload” and keeping your focus sharp, so your decision-making is faster and stress-free.
2. Exact Entry Guide
Intent:
Traders often struggle with entry timing, leading to FOMO (fear of missing out) or getting trapped in sudden market reversals.
In this Indicator:
The system uses powerful adaptive logic to filter out weak signals and only highlight the strongest market moves. This not only prevents you from entering late or on noise, but also helps avoid losses from false breakouts or whipsaws. You get actionable suggestions—when to enter, when to hold back—so your entries are high-conviction and disciplined.
3. HTF+LTF Logic: Multitimeframe Sync Analysis
Intent:
Most losing trades happen when you act only on the short-term chart, ignoring the bigger market trend.
In this Indicator:
Signals are based on both the current chart timeframe (LTF) and a higher (HTF, like hourly/daily) timeframe. The indicator synchronizes trend direction, momentum, and structure across both levels, quickly adapting to show you when both are aligned. This filtering results in “only trade with the bigger trend”—dramatically increasing your win rate and market confidence.
4. Auto Support/Resistance & Liquidity Zones
Intent:
Drawing support/resistance and liquidity zones manually is time-consuming and error-prone, especially for beginners.
In this Indicator:
The system automatically identifies and plots the most crucial support/resistance levels and liquidity zones on your chart. This is based on adaptive, real-time price and volume analysis. These zones highlight where major institutional activity, trap setups, or real breakouts/reversals are most likely, removing guesswork and giving you a clear reference for entries, exits, and stop placements.
5. Clear Action/Direction
Intent:
Traders need certainty—what does the market want right now? Most indicators are vague.
In this Indicator:
Your dashboard always displays in plain words (like “BUY”, “SELL”, or “WAIT”) what action makes sense in the current market phase. Whether it’s a bull trap, volume spike, wick reversal, or exhaustion—it’s interpreted and explained clearly. No more confusion—just direct, real-time advice.
6. For Everyone (Beginner to Pro)
Intent:
Most advanced indicators are overwhelming for new traders; simple ones lack depth for professionals.
In this Indicator:
It is simple enough for a beginner—just add it to the chart and instantly see what action to consider. At the same time, it includes advanced adaptive analysis, multi-timeframe logic, and customizable settings so professional traders can fine-tune it for their strategies.
7. Ideal Usage and User Benefits
Instant Decision Support:
Whenever you’re unsure about a trade, just look at the indicator’s suggestion for clarity.
Entry Learning:
Beginners get real-time “practice” by not only seeing signals, but also the reason behind them—improving your chart reading and market understanding.
Screen Time & Stress Reduction:
Clear, relevant information only; no noise, less fatigue, faster decisions.
Makes Trading Confident & Simple:
The smart dashboard splits actionable levels (HTF, LTF, action) so you never miss a move, avoid traps, and stay aligned with high-probability trades.
8. Advanced Input Settings (Smart Customization)
Explained with Examples:
Enable Wick Analysis:
Finds candles with strong upper/lower wicks (signs of rejection/buying/selling force), alerting you to hidden reversals and protecting from FOMO entries.
Enable Absorption:
Detects when heavy order flow from one side is “absorbed” by the other (shows where institutional buyers/sellers are likely active, helps spot fake breakouts).
Enable Unusual Breakout:
Highlights real breakouts—large volatility plus high volume—so you catch genuine moves and avoid random spikes.
Enable Range/Expansion:
Smartly flags sudden range expansions—when the market goes from quiet to volatile—so you can act at the start of real trends.
Trend Bar Lookback:
Adjusts how many bars/candles are used in trend calculations. Short (fast trades, more signals), long (more reliability, fewer whipsaws).
Bull/Bear Bars for Strong Trend Min:
Sets how many candles in a row must support a trend before calling it “strong”—prevents flipping signals, keeps you disciplined.
Volume MA Length:
Lets you adjust how many bars back volume is averaged—fine-tune for your asset and trading style for best volume signals.
Swing Lookback Bars:
Set how many bars to use for swing high/low detection—short (quick swing levels), long (stronger support/resistance).
HTF (Bias Window):
Decide which higher timeframe the indicator should use for big-picture market mood. Adjustable for any style (scalp, swing, position).
Adaptive Lookback (HTF):
Choose how much HTF history is used for detecting major extremes/zones. Quick adjust for more/less sensitivity.
Show Support/Resistance, Liquidity Zones, Trendlines:
Toggle them on/off instantly per your needs—keeps your chart relevant and tailored.
9. Live Dashboard Sections Explained
Intent HTF:
Shows if the bigger timeframe currently has a Bullish, Bearish, or Neutral (“Chop”) intent, based on strict volume/price body calculations. Instant clarity—no more guessing on trend bias.
HTF Bias:
Clear message about which side (buy/sell/sideways) controls the market on the higher timeframe, so you always trade with the “big money.”
Chart Action:
The central action for the current bar—Whether to Buy, Sell, or Wait—calculated from all indicator logic, not just one rule.
TrendScore Long/Short:
See how many candles in your chosen window were bullish or bearish, at a glance. Instantly gauge market momentum.
Reason (WHY):
Every time a signal appears, the “reason” cell tells you the primary logic (breakout, wick, strong trend, etc.) behind it. Full transparency and learning—never trade blindly.
Strong Trend:
Shows if the market is currently in a powerful trend or not—helping you avoid choppy, risky entries.
HTF Vol/Body:
Displays current higher timeframe volume and candle body %—helping spot when big players are active for higher probability trades.
Volume Sentiment:
A real-time analysis of market psychology (strong bullish/bearish, neutral)—making your decision-making much more confident.
10. Smart and User-Friendly Design
Multi-timeframe Adaptive:
All calculations can now be drawn from your choice of higher or current timeframe, ensuring signals are filtered by larger market context.
Flexible Table Position:
You can set the live dashboard/summary anywhere on the chart for best visibility.
Refined Zone Visualization:
Liquidity and order blocks are visually highlighted, auto-tuning for your settings and always cleaning up to stay clutter-free.
Multi-Lingual & Beginner Accessible:
With Hindi and simple English support, descriptions and settings are accessible for a wide audience—anyone can start using powerful trading logic with zero language barrier.
Efficient Labels & Clear Reasoning:
Signal labels and reasons are shown/removed dynamically so your chart stays informative, not messy.
Every detail of this indicator is designed to make trading both simpler and smarter—helping you avoid the common pitfalls, learn real price action, stay in sync with the market’s true mood, and act with discipline for higher consistency and confidence.
This indicator makes professional-grade market analysis accessible to everyone. It’s your trusted assistant for making smarter, faster, and more profitable trading decisions—providing not just signals, but also the “why” behind every action. With auto-adaptive logic, clear visuals, and strong focus on real trading needs, it lets you focus on capturing the moves that matter—every single time.
Hazel nut BB Strategy, volume base- lite versionHazel nut BB Strategy, volume base — lite version
Having knowledge and information in financial markets is only useful when a trader operates with a well-defined trading strategy. Trading strategies assist in capital management, profit-taking, and reducing potential losses.
This strategy is built upon the core principle of supply and demand dynamics. Alongside this foundation, one of the widely used technical tools — the Bollinger Bands — is employed to structure a framework for profit management and risk control.
In this strategy, the interaction of these tools is explained in detail. A key point to note is that for calculating buy and sell volumes, a lower timeframe function is used. When applied with a tick-level resolution, this provides the most precise measurement of buyer/seller flows. However, this comes with a limitation of reduced historical depth. Users should be aware of this trade-off: if precise tick-level data is required, shorter timeframes should be considered to extend historical coverage .
The strategy offers multiple configuration options. Nevertheless, it should be treated strictly as a supportive tool rather than a standalone trading system. Decisions must integrate personal analysis and other instruments. For example, in highly volatile assets with narrow ranges, it is recommended to adjust profit-taking and stop-loss percentages to smaller values.
◉ Volume Settings
• Buyer and seller volume (up/down volume) are requested from a lower timeframe, with an option to override the automatic resolution.
• A global lookback period is applied to calculate moving averages and cumulative sums of buy/sell/delta volumes.
• Ratios of buyers/sellers to total volume are derived both on the current bar and across the lookback window.
◉ Bollinger Band
• Bands are computed using configurable moving averages (SMA, EMA, RMA, WMA, VWMA).
• Inputs allow control of length, standard deviation multiplier, and offset.
• The basis, upper, and lower bands are plotted, with a shaded background between them.
◉ Progress & Proximity
• Relative position of the price to the Bollinger basis is expressed as percentages (qPlus/qMinus).
• “Near band” conditions are triggered when price progress toward the upper or lower band exceeds a user-defined threshold (%).
• A signed score (sScore) represents how far the close has moved above or below the basis relative to band width.
◉ Info Table
• Optional compact table summarizing:
• - Upper/lower band margins
• - Buyer/seller volumes with moving averages
• - Delta and cumulative delta
• - Buyer/seller ratios per bar and across the window
• - Money flow values (buy/sell/delta × price) for bar-level and summed periods
• The table is neutral-colored and resizable for different chart layouts.
◉ Zone Event Gate
• Tracks entry into and exit from “near band” zones.
• Arming logic: a side is armed when price enters a band proximity zone.
• Trigger logic: on exit, a trade event is generated if cumulative buyer or seller volume dominates over a configurable window.
◉ Trading Logic
• Orders are placed only on zone-exit events, conditional on volume dominance.
• Position sizing is defined as a fixed percentage of strategy equity.
• Long entries occur when leaving the lower zone with buyer dominance; short entries occur when leaving the upper zone with seller dominance.
◉ Exit Rules
• Open positions are managed by a strict priority sequence:
• 1. Stop-loss (% of entry price)
• 2. Take-profit (% of entry price)
• 3. Opposite-side event (zone exit with dominance in the other direction)
• Stop-loss and take-profit levels are configurable
◉ Notes
• This lite version is intended to demonstrate the interaction of Bollinger Bands and volume-based dominance logic.
• It provides a framework to observe how price reacts at band boundaries under varying buy/sell pressure, and how zone exits can be systematically converted into entry/exit signals.
When configuring this strategy, it is essential to carefully review the settings within the Strategy Tester. Ensure that the chosen parameters and historical data options are correctly aligned with the intended use. Accurate back testing depends on applying proper configurations for historical reference. The figure below illustrates sample result and configuration type.
Smart Money Flow Index (SMFI) - This tool is useful for comparing price action with underlying money flow and spotting where smart money may be entering or exiting the market.
Guppy MMA [Alpha Extract]A sophisticated trend-following and momentum assessment system that constructs dynamic trader and investor sentiment channels using multiple moving average groups with advanced scoring mechanisms and smoothed CCI-style visualizations for optimal market trend analysis. Utilizing enhanced dual-group methodology with threshold-based trend detection, this indicator delivers institutional-grade GMMA analysis that adapts to varying market conditions while providing high-probability entry and exit signals through crossover and extreme value detection with comprehensive visual mapping and alert integration.
🔶 Advanced Channel Construction
Implements dual-group architecture using short-term and long-term moving averages as foundation points, applying customizable MA types to reduce noise and score-based averaging for sentiment-responsive trend channels. The system creates trader channels from shorter periods and investor channels from longer periods with configurable periods for optimal market reaction zones.
// Core Channel Calculation Framework
maType = input.string("EMA", title="Moving Average Type", options= )
// Short-Term Group Construction
stMA1 = ma(close, st1, maType)
stMA2 = ma(close, st2, maType)
// Long-Term Group Construction
ltMA1 = ma(close, lt1, maType)
ltMA2 = ma(close, lt2, maType)
// Smoothing Application
smoothedavg = ma(overallAvg, 10, maType)
🔶 Volatility-Adaptive Zone Framework
Features dynamic score-based averaging that expands sentiment signals during strong trend periods and contracts during consolidation phases, preventing false signals while maintaining sensitivity to genuine momentum shifts. The dual-group averaging system optimizes zone boundaries for realistic market behavior patterns.
// Dynamic Sentiment Adjustment
shortTermAvg = (stScore1 + stScore2 + ... + stScore11) / 11
longTermAvg = (ltScore1 + ltScore2 + ... + ltScore11) / 11
// Dual-Group Zone Optimization
overallAvg = (shortTermAvg + longTermAvg) / 2
allMAAvg = (shortTermAvg * 11 + longTermAvg * 11) / 22
🔶 Step-Like Boundary Evolution
Creates threshold-based trend boundaries that update on smoothed average changes, providing visual history of evolving bullish and bearish levels with performance-optimized threshold management limited to key zones for clean chart presentation and efficient processing.
🔶 Comprehensive Signal Detection
Generates buy and sell signals through sophisticated crossover analysis, monitoring smoothed average interaction with zero-line and thresholds for high-probability entry and exit identification. The system distinguishes between trend continuation and reversal patterns with precision timing.
🔶 Enhanced Visual Architecture
Provides translucent zone fills with gradient intensity scaling, threshold-based historical boundaries, and dynamic background highlighting that activates upon trend changes. The visual system uses institutional color coding with green bullish zones and red bearish zones for intuitive market structure interpretation.
🔶 Intelligent Zone Management
Implements automatic trend relevance filtering, displaying signals only when smoothed average proximity warrants analysis attention. The system maintains optimal performance through smart averaging management and historical level tracking with configurable MA periods for various market conditions.
🔶 Multi-Dimensional Analysis Framework
Combines trend continuation analysis through threshold crossovers with momentum detection via extreme markers, providing comprehensive market structure assessment suitable for both trending and ranging market conditions with score-normalized accuracy.
🔶 Advanced Alert Integration
Features comprehensive notification system covering buy signals, sell signals, strong bull conditions, and strong bear conditions with customizable alert conditions. The system enables precise position management through real-time notifications of critical sentiment interaction events and zone boundary violations.
🔶 Performance Optimization
Utilizes efficient MA smoothing algorithms with configurable types for noise reduction while maintaining responsiveness to genuine market structure changes. The system includes automatic visual level cleanup and performance-optimized visual rendering for smooth operation across all timeframes.
This indicator delivers sophisticated GMMA-based market analysis through score-adaptive averaging calculations and intelligent group construction methodology. By combining dynamic trader and investor sentiment detection with advanced signal generation and comprehensive visual mapping, it provides institutional-grade trend analysis suitable for cryptocurrency, forex, and equity markets. The system's ability to adapt to varying market conditions while maintaining signal accuracy makes it essential for traders seeking systematic approaches to trend trading, momentum reversals, and sentiment continuation analysis with clearly defined risk parameters and comprehensive alert integration.
Multi-Strategy Trading Screener SummaryI only combined famous scripts, all thanks to wonderful scripts and community out there .
ThankYou !
------
Core Architecture
Multi-Symbol Analysis: Tracks up to 5 configurable tickers simultaneously
Multi-Timeframe Support: Each symbol can use different timeframes
Real-Time Dashboard: Color-coded table displaying all signals and analysis
Trend Validation: All signals include trend alignment confirmation
Integrated Trading Strategies
1. Breaker Blocks (Order Blocks)
Detects institutional order blocks using swing analysis
Tracks when blocks are broken and become "breaker blocks"
Monitors retests of broken levels
Shows trend alignment (✓ aligned, ⚠️ misaligned)
2. Chandelier Exit
ATR-based trend-following exit system
Provides BUY/SELL signals based on dynamic stop levels
Uses configurable ATR multiplier and lookback period
3. Smart Money Breakout
Channel breakout detection with volatility normalization
Identifies accumulation/distribution phases
Generates persistent BUY/SELL signals on breakouts
4. Trendline Breakout
Dynamic trendline detection using pivot highs/lows
Calculates trendline slopes and breakout points
Provides BUY signals on upward breaks, SELL on downward breaks
Dashboard Columns Explained
Symbol: Ticker being analyzed
Trend: Overall SuperTrend direction (🟢 UP / 🔴 DOWN / ⚪ FLAT)
Timeframe: Analysis timeframe with clock icon
Breaker Block: Type (Bullish/Bearish) with trend alignment indicator
Status: Price position relative to breaker block (Inside/Approaching/Far)
Retests: Number of times the broken level was retested (indicates level strength)
Volume: Volume associated with the order block formation
Chandelier: BUY/SELL signals from Chandelier Exit strategy
Smart Money: BUY/SELL signals from breakout detection
Trendline: BUY/SELL signals from trendline breakouts
Key Features
No HOLD States: All signals show definitive BUY (🟢) or SELL (🔴) only
Persistent Signals: Signals remain active until opposite conditions trigger
Color Coding: Visual distinction between bullish (green) and bearish (red) signals
Trend Alignment: Enhanced accuracy through trend confirmation logic
This screener provides a comprehensive view of market conditions across multiple strategies, helping identify high-probability trading opportunities when signals align.
Trend Strength Index Long Strategy📈 Trend Strength Index Long Strategy
This strategy combines the Trend Strength Index (TSI) with a Volume-Weighted Moving Average (VWMA) to identify high-probability long entries based on trend momentum and price confirmation.
📊 TSI Calculation : Measures correlation between price and time (bar index) over a user-defined period. Strong TSI values indicate trend momentum.
📏 VWMA Filter : Confirms bullish bias when price is above the VWMA.
🚀 Entry Condition : Long position is triggered when TSI crosses above -0.65 and price is above VWMA.
🔒 Exit Condition : Position is closed when TSI crosses above 0.65.
🎨 Visuals : Gradient fills highlight bullish and bearish zones. VWMA is plotted for trend context.
🧮 TSI Length: Adjustable (default 14)
📐 VWMA Length: Adjustable (default 55)
💸 Commission: 0.1% per trade
📊 Position Size: 75% of equity
⚙️ Slippage: 10 ticks
✅ Best used in trending markets with steady momentum.
⚠️ Avoid in choppy or range-bound conditions.
Levels, EMS, Volume etc.This is a comprehensive trading indicator that combines three main analysis tools:
EMA System — a set of 12 exponential moving averages with color trend indication.
Consolidation — detects and highlights price accumulation zones with breakout alerts.
S/R Levels — identifies key support and resistance levels across different timeframes, shows their strength, and displays them in a table.
Additionally, it includes a volume histogram and a notification system for important chart events. All these features help traders analyze trends and identify potential entry and exit points.
Это комплексный торговый индикатор, который объединяет три основных инструмента анализа:
EMA-система — набор из 12 экспоненциальных скользящих средних с цветовой индикацией тренда.
Консолидация — определяет и выделяет зоны накопления цены с оповещениями о пробоях.
Уровни S/R — находит ключевые уровни поддержки и сопротивления на разных таймфреймах, показывает их силу и выводит в таблицу.
Дополнительно включает гистограмму объёмов и систему уведомлений о важных событиях на графике. Всё это помогает трейдерам анализировать тренды, определять потенциальные точки входа и выхода.
PE Rating by The Noiseless TraderPE Rating by The Noiseless Trader
This script analyzes a symbol’s Price-to-Earnings (P/E) ratio, using Diluted EPS (TTM) fundamentals directly from TradingView.
The script calculates the Price-to-Earnings ratio (P/E) using Diluted EPS (TTM) fundamentals. It then identifies:
PE High → the highest valuation point over a 3-year historical range.
PE Low → the lowest valuation point over a 3-year historical range.
PE Median → the midpoint between the two extremes, offering a fair-value benchmark.
PE (Int) → an additional intermediate low to track more recent undervaluation points. This is calculated based on lowest valuation point over a 1-year historical range
These levels are plotted directly on the chart as horizontal references, with markers showing the exact bars/dates when the extremes occurred. Candles corresponding to those days are also highlighted for context.
Bars corresponding to these extremes are highlighted (red = PE High, green = PE Low).
How it helps
Provides a historical valuation framework that complements technical analysis. We look for long opportunity or base formation near the PE Low and be cautious when stocks tends to trade near High PE.
We do not short the stock at High PE infact be cautious with long trades.
Helps identify whether current price action is happening near overvalued or undervalued zones.
Adds a long-term perspective to support swing trading and investing decisions. If a stock is coming from Low PE to Median PE and along with that if we get entry based on Classical strategies like Darvas Box, or HH-HL based on Dow Theory.
Offers a simple visual map of how far the market has moved from “cheap” to “expensive.”
This tool is best suited for long-term investors and swing traders who want to merge fundamentals with technical setups.
This indicator is designed as an educational tool to illustrate how valuation metrics (like earnings multiples) can be viewed alongside price action, helping traders connect fundamental context with technical execution in real market conditions.
3-Month Weighted Return RS histogramOriginal idea: x.com/jfsrev/status/1806709652975141131
I would recommend to pair it with 1-Month RS to visualize both short-term and medium-term RS for the ticker.
Definition: Uses log returns instead of raw ratio.
Applies exponential weighting (with alpha) so that recent returns matter more than older ones.
Scales to approximate 3-month cumulative performance with focus on recency and momentum.
Compares asset vs SPY, and converts into a percentile rank (green-colored histogram).
Interpretation: Shows not just where RS is relative to history, but emphasizes momentum recency.
Majority of code and indicator idea is taken from an old post likely by @ChartsLector. I couldn't find the actual post.
Chartlense Dashboard (Data, Trend & Levels)Chartlense Dashboard (Data, Trend & Levels)
Overview
This dashboard is designed to solve two common problems for traders: chart clutter and the manual drawing of support and resistance levels . It consolidates critical data from multiple indicators into a clean table overlay and automatically plots the most relevant S&R levels based on recent price action. The primary goal is to provide a clear, at-a-glance overview of the market's structure and data.
It offers both a vertical and horizontal layout to fit any trader's workspace.
Key Concepts & Calculations Explained
This indicator is more than a simple collection of values; it synthesizes data to provide unique insights. Here’s a conceptual look at how its core components work:
Automatic Support & Resistance (Pivot-Based):
The dashed support (green) and resistance (red) lines are not manually drawn. They are dynamically calculated based on the most recent confirmed pivot highs and pivot lows . A pivot is a foundational concept in technical analysis that identifies potential turning points in price action.
How it works: A pivot high is a candle whose `high` is higher than a specific number of candles to its left and right (the "Pivot Lookback" is set to 5 by default in the settings). A pivot low is the inverse. By automatically identifying these confirmed structural points, the script visualizes the most relevant levels of potential supply and demand on the chart.
Relative Volume (RVOL):
This value in the table is not the standard volume. It measures the current bar's volume against its recent average (specifically, `current volume / 10-period simple moving average of volume`).
Interpretation: A reading above 2.0 (indicated by green text) suggests that the current volume is more than double the recent average. This technique is used to identify significant volume spikes, which can add conviction to breakouts or signal potential market climaxes.
Consolidated Data for Context:
Other values displayed in the table, such as the EMAs (9, 20, 200) , Bollinger Bands (20, 2) , RSI (14) , MACD (12, 26, 9) , and VWAP (on intraday charts), use their standard industry calculations. They are included to provide a complete contextual picture without needing to load each indicator separately, saving valuable chart space.
How to Use This in Your Trading
This dashboard is designed as a tool for confluence and context , not as a standalone signal generator. Here are some ways to integrate it into your analysis workflow:
As a Trend Filter: Before considering a trade, quickly glance at the EMAs and the MACD values in the table. A price above the key EMAs and a positive MACD can serve as a quick confirmation that you are aligned with the dominant trend.
To Validate Breakouts: When the price is approaching a key Resistance level (red pivot line), watch the RVOL value . A reading above 2.0 on the breakout candle adds significant confirmation that the move is backed by strong interest. The same logic applies to breakdowns below a support level.
To Spot Potential Reversals: Confluence is key. For example, if the price is testing a Support level (green pivot line) AND the RSI in the table is approaching oversold levels (e.g., near 30), it can signal a higher probability reversal setup.
About This Indicator
This indicator was developed by the team at ChartLense to help traders declutter their charts and focus on the data that matters. We believe in making complex analysis more accessible and organized. We hope this free tool is a valuable addition to your trading process.
Set & Forget – AlexG Club – ChecklistThe Set & Forget – AlexG Club – Checklist is built to help traders apply the well-known Set and Forget strategy from the famous AlexG (falexg) and the G-Club community.
This indicator displays a clear, on-chart checklist table of trading confluences. Each confluence adds to a total score, making it easier to objectively evaluate whether a trade setup aligns with the AlexG / G-Club strategy.
✅ Features:
• Customizable confluence checklist (trend alignment, S/R levels, candlestick signals, momentum, etc.)
• Automatic scoring system to calculate the Set & Forget readiness of a trade
• Clean table visualization on your chart
• Flexible thresholds — you decide how many confluences equal a strong setup
🚀 How to Use:
Add the indicator to your chart.
Adjust the confluences to reflect your own AlexG / G-Club inspired checklist.
Use the total score to validate trades before you pull the trigger.
⚠️ Disclaimer: This indicator is for educational purposes only. It is not financial advice and does not guarantee profitability. Always manage your risk and test before using live.
Mayfair FX Scalper V-10 Price Action + SMC//@version=5
indicator("Mayfair FX Scalper V-10 Price Action + SMC", overlay=true)
// === INPUTS ===
rsiLength = input.int(14, title="RSI Length")
overbought = input.float(73, title="SELL Level")
oversold = input.float(31, title="BUY Level")
rsiSrc = input.source(open, title="RSI Source")
// === Color Inputs ===
entryLineColor = input.color(color.white, title="entry Label Color")
entryLabelColor = input.color(color.white, title="entry Lable Color")
slLineColor = input.color(color.red, title="Stop Loss Line Color")
slLabelColor = input.color(color.red, title="Stop Loss Label Color")
tpLineColor = input.color(color.blue, title="Take Profit Line Color")
tpLabelColor = input.color(color.blue, title="Take Profit Color")
entryTextColor = input.color(color.rgb(0, 0, 0) , title="entry Text Color")
slTextColor = input.color(color.white, title="Stop Lose Color")
tpTextColor = input.color(color.white, title="Take Profit Text Color")
//indicator("Author Info Display"
// Create table
var table infoTable = table.new(position.top_right, 2, 6, bgcolor=color.new(#000000, 1), border_width=1)
if barstate.islast
table.cell(infoTable, 0, 0, "Author:", text_color=color.white, text_size=size.small)
table.cell(infoTable, 1, 0, "MR WOW", text_color=color.rgb(255, 251, 0), text_size=size.large)
table.cell(infoTable, 0, 1, "YouTube:", text_color=color.white, text_size=size.small)
table.cell(infoTable, 1, 1, "www.youtube.com/@iammrwow", text_color=color.rgb(255, 251, 0), text_size=size.small)
table.cell(infoTable, 0, 3, "Website:", text_color=color.white, text_size=size.small)
table.cell(infoTable, 1, 3, "www.mrwowea.com", text_color=color.rgb(255, 251, 0), text_size=size.small)
// === RSI CALCULATION ===
rsi = ta.rsi(rsiSrc, rsiLength)
rawBuySignal = rsi < oversold
rawSellSignal = rsi > overbought
// === Confirmed Signals ===
isBullish = close > open
isBearish = close < open
newBuy = rawBuySignal and isBullish and close > open == false
newSell = rawSellSignal and isBearish and close < open == false
// === Trade State Variables ===
var bool inPosition = false
var bool isBuy = false
var float entryPrice = na
var float slPrice = na
var float tp1Price = na
var float tp2Price = na
var float tp3Price = na
var int entryBarIndex = na
var label labels = array.new()
var line lines = array.new()
// === Instrument & Timeframe SL/TP Setup ===
isGold = str.contains(syminfo.ticker, "XAU") or str.contains(syminfo.ticker, "GOLD")
instrumentType = syminfo.type == "crypto" ? "Crypto" : isGold ? "Gold" : syminfo.currency == "JPY" ? "JPY" : "Forex"
tf = timeframe.period
slPipsGold = tf == "1" ? 30 : tf == "3" ? 45 : tf == "5" ? 50 : tf == "15" ? 60 : 70
slPipsCrypto = tf == "1" ? 5 : tf == "3" ? 8 : tf == "5" ? 12 : tf == "15" ? 15 : 10
slPipsForex = tf == "1" ? 6 : tf == "3" ? 9 : tf == "5" ? 11 : tf == "15" ? 15 : 15
gold_slDist = 0.1 * slPipsGold
gold_tp1Dist = gold_slDist
gold_tp2Dist = gold_slDist * 2
gold_tp3Dist = gold_slDist * 3
pipSize = instrumentType == "Crypto" ? 1.0 : instrumentType == "Gold" or instrumentType == "JPY" ? 0.01 : 0.0001
slPips = instrumentType == "Crypto" ? slPipsCrypto : instrumentType == "Gold" ? slPipsGold : slPipsForex
slDist = slPips * pipSize
tp1Dist = slDist
tp2Dist = slDist * 2
tp3Dist = slDist * 3
// === Draw Line & Label ===
drawLine(y, txt, col, lblCol, extendToCurrent) =>
int lineEnd = extendToCurrent ? bar_index : entryBarIndex + 2
array.push(lines, line.new(entryBarIndex, y, lineEnd, y, color=col, width=2, extend=extend.none))
textCol = str.contains(txt, "Entry") ? entryTextColor : str.contains(txt, "Stop") ? slTextColor : tpTextColor
array.push(labels, label.new(lineEnd, y, txt, style=label.style_label_left, color=color.new(lblCol, 0), textcolor=textCol, size=size.small))
// === Check Exit ===
slHit = inPosition and ((isBuy and low <= slPrice) or (not isBuy and high >= slPrice))
tp3Hit = inPosition and ((isBuy and high >= tp3Price) or (not isBuy and low <= tp3Price))
shouldExit = slHit or tp3Hit
if shouldExit
for l in labels
label.delete(l)
array.clear(labels)
for ln in lines
line.delete(ln)
array.clear(lines)
inPosition := false
entryPrice := na
slPrice := na
tp1Price := na
tp2Price := na
tp3Price := na
entryBarIndex := na
// === Confirmed Signal with No Position ===
confirmedBuy = not inPosition and newBuy
confirmedSell = not inPosition and newSell
// === Signal Markers ===
plotshape(series=confirmedBuy, location=location.belowbar, color=color.rgb(33, 150, 243), style=shape.triangleup, text="BUY", textcolor=color.rgb(33, 150, 243))
plotshape(series=confirmedSell, location=location.abovebar, color=color.rgb(254, 254, 255), style=shape.triangledown, text="SELL", textcolor=color.rgb(239, 238, 247))
// === Entry Execution ===
if confirmedBuy or confirmedSell
entryPrice := close
entryBarIndex := bar_index
isBuy := confirmedBuy
inPosition := true
if isGold
slPrice := isBuy ? entryPrice - gold_slDist : entryPrice + gold_slDist
tp1Price := isBuy ? entryPrice + gold_tp1Dist : entryPrice - gold_tp1Dist
tp2Price := isBuy ? entryPrice + gold_tp2Dist : entryPrice - gold_tp2Dist
tp3Price := isBuy ? entryPrice + gold_tp3Dist : entryPrice - gold_tp3Dist
else
slPrice := isBuy ? entryPrice - slDist : entryPrice + slDist
tp1Price := isBuy ? entryPrice + tp1Dist : entryPrice - tp1Dist
tp2Price := isBuy ? entryPrice + tp2Dist : entryPrice - tp2Dist
tp3Price := isBuy ? entryPrice + tp3Dist : entryPrice - tp3Dist
drawLine(entryPrice, "Entry Price - After Candle Above Entry Price Then Place Trade: " + str.tostring(entryPrice), entryLineColor, entryLabelColor, false)
drawLine(slPrice, "Stop Loss: " + str.tostring(slPrice), slLineColor, slLabelColor, false)
drawLine(tp1Price, "(1:1) Take Profit: " + str.tostring(tp1Price), tpLineColor, tpLabelColor, false)
drawLine(tp2Price, "(2:1) Take Profit: " + str.tostring(tp2Price), tpLineColor, tpLabelColor, false)
drawLine(tp3Price, "(3:1) Take Profit: " + str.tostring(tp3Price), tpLineColor, tpLabelColor, false)
// === Update TP/SL Lines if Still in Trade ===
if inPosition and not (confirmedBuy or confirmedSell)
for ln in lines
line.delete(ln)
array.clear(lines)
for l in labels
label.delete(l)
array.clear(labels)
drawLine(entryPrice, "After Candle Closed Above Entry Line Buy & Below Sell :Entry Price-" + str.tostring(entryPrice), entryLineColor, entryLabelColor, true)
drawLine(slPrice, "Stop Loss: " + str.tostring(slPrice), slLineColor, slLabelColor, true)
drawLine(tp1Price, "(1:1) Take Profit: " + str.tostring(tp1Price), tpLineColor, tpLabelColor, true)
drawLine(tp2Price, "(2:1) Take Profit: " + str.tostring(tp2Price), tpLineColor, tpLabelColor, true)
drawLine(tp3Price, "(3:1) Take Profit: " + str.tostring(tp3Price), tpLineColor, tpLabelColor, true)
// === Bollinger Bands Inputs ===
bb_length = input.int(20, title="SMA & StdDev Length")
src = input.source(close, title="Source")
// === Bollinger Band Colors ===
color_upper_2_3 = input.color(color.new(#0db107, 64), title="Upper Band 2–3 Color")
color_upper_3_4 = input.color(color.new(#05c41f, 58), title="Upper Band 3–4 Color")
color_lower_2_3 = input.color(color.new(#bdbc9d, 80), title="Lower Band 2–3 Color")
color_lower_3_4 = input.color(color.new(#e9e6bf, 63), title="Lower Band 3–4 Color")
// === Bollinger Band Calculations ===
sma = ta.sma(src, bb_length)
stdev = ta.stdev(src, bb_length)
bb2_upper = sma + 2 * stdev
bb2_lower = sma - 2 * stdev
bb3_upper = sma + 3 * stdev
bb3_lower = sma - 3 * stdev
bb4_upper = sma + 4 * stdev
bb4_lower = sma - 4 * stdev
// === Hidden Plots for Fill ===
p_bb2_upper = plot(bb2_upper, color=na)
p_bb3_upper = plot(bb3_upper, color=na)
p_bb4_upper = plot(bb4_upper, color=na)
p_bb2_lower = plot(bb2_lower, color=na)
p_bb3_lower = plot(bb3_lower, color=na)
p_bb4_lower = plot(bb4_lower, color=na)
// === Band Zone Fills ===
fill(p_bb2_upper, p_bb3_upper, color=color_upper_2_3)
fill(p_bb3_upper, p_bb4_upper, color=color_upper_3_4)
fill(p_bb2_lower, p_bb3_lower, color=color_lower_2_3)
fill(p_bb3_lower, p_bb4_lower, color=color_lower_3_4)
//SMc
BULLISH_LEG = 1
BEARISH_LEG = 0
BULLISH = +1
BEARISH = -1
GREEN = #9c9c9c
RED = #9c9c9c
BLUE = #9c9c9c
GRAY = #ffffff
MONO_BULLISH = #b2b5be
MONO_BEARISH = #5d606b
HISTORICAL = 'Historical'
PRESENT = 'Present'
COLORED = 'Colored'
MONOCHROME = 'Monochrome'
ALL = 'All'
BOS = 'BOS'
CHOCH = 'CHoCH'
TINY = size.tiny
SMALL = size.small
NORMAL = size.normal
ATR = 'Atr'
RANGE = 'Cumulative Mean Range'
CLOSE = 'Close'
HIGHLOW = 'High/Low'
SOLID = '⎯⎯⎯'
DASHED = '----'
DOTTED = '····'
SMART_GROUP = 'Smart Money Concepts'
INTERNAL_GROUP = 'Real Time Internal Structure'
SWING_GROUP = 'Real Time Swing Structure'
BLOCKS_GROUP = 'Order Blocks'
EQUAL_GROUP = 'EQH/EQL'
GAPS_GROUP = 'Fair Value Gaps'
LEVELS_GROUP = 'Highs & Lows MTF'
ZONES_GROUP = 'Premium & Discount Zones'
modeTooltip = 'Allows to display historical Structure or only the recent ones'
styleTooltip = 'Indicator color theme'
showTrendTooltip = 'Display additional candles with a color reflecting the current trend detected by structure'
showInternalsTooltip = 'Display internal market structure'
internalFilterConfluenceTooltip = 'Filter non significant internal structure breakouts'
showStructureTooltip = 'Display swing market Structure'
showSwingsTooltip = 'Display swing point as labels on the chart'
showHighLowSwingsTooltip = 'Highlight most recent strong and weak high/low points on the chart'
showInternalOrderBlocksTooltip = 'Display internal order blocks on the chart Number of internal order blocks to display on the chart'
showSwingOrderBlocksTooltip = 'Display swing order blocks on the chart Number of internal swing blocks to display on the chart'
orderBlockFilterTooltip = 'Method used to filter out volatile order blocks It is recommended to use the cumulative mean range method when a low amount of data is available'
orderBlockMitigationTooltip = 'Select what values to use for order block mitigation'
showEqualHighsLowsTooltip = 'Display equal highs and equal lows on the chart'
equalHighsLowsLengthTooltip = 'Number of bars used to confirm equal highs and equal lows'
equalHighsLowsThresholdTooltip = 'Sensitivity threshold in a range (0, 1) used for the detection of equal highs & lows Lower values will return fewer but more pertinent results'
showFairValueGapsTooltip = 'Display fair values gaps on the chart'
fairValueGapsThresholdTooltip = 'Filter out non significant fair value gaps'
fairValueGapsTimeframeTooltip = 'Fair value gaps timeframe'
fairValueGapsExtendTooltip = 'Determine how many bars to extend the Fair Value Gap boxes on chart'
showPremiumDiscountZonesTooltip = 'Display premium, discount, and equilibrium zones on chart'
modeInput = input.string( HISTORICAL, 'Mode', group = SMART_GROUP, tooltip = modeTooltip, options = )
styleInput = input.string( COLORED, 'Style', group = SMART_GROUP, tooltip = styleTooltip,options = )
showTrendInput = input( false, 'Color Candles', group = SMART_GROUP, tooltip = showTrendTooltip)
showInternalsInput = input( true, 'Show Internal Structure', group = INTERNAL_GROUP, tooltip = showInternalsTooltip)
showInternalBullInput = input.string( ALL, 'Bullish Structure', group = INTERNAL_GROUP, inline = 'ibull', options = )
internalBullColorInput = input( GREEN, '', group = INTERNAL_GROUP, inline = 'ibull')
showInternalBearInput = input.string( ALL, 'Bearish Structure' , group = INTERNAL_GROUP, inline = 'ibear', options = )
internalBearColorInput = input( RED, '', group = INTERNAL_GROUP, inline = 'ibear')
internalFilterConfluenceInput = input( false, 'Confluence Filter', group = INTERNAL_GROUP, tooltip = internalFilterConfluenceTooltip)
internalStructureSize = input.string( TINY, 'Internal Label Size', group = INTERNAL_GROUP, options = )
showStructureInput = input( true, 'Show Swing Structure', group = SWING_GROUP, tooltip = showStructureTooltip)
showSwingBullInput = input.string( ALL, 'Bullish Structure', group = SWING_GROUP, inline = 'bull', options = )
swingBullColorInput = input( GREEN, '', group = SWING_GROUP, inline = 'bull')
showSwingBearInput = input.string( ALL, 'Bearish Structure', group = SWING_GROUP, inline = 'bear', options = )
swingBearColorInput = input( RED, '', group = SWING_GROUP, inline = 'bear')
swingStructureSize = input.string( SMALL, 'Swing Label Size', group = SWING_GROUP, options = )
showSwingsInput = input( false, 'Show Swings Points', group = SWING_GROUP, tooltip = showSwingsTooltip,inline = 'swings')
swingsLengthInput = input.int( 50, '', group = SWING_GROUP, minval = 10, inline = 'swings')
showHighLowSwingsInput = input( true, 'Show Strong/Weak High/Low',group = SWING_GROUP, tooltip = showHighLowSwingsTooltip)
showInternalOrderBlocksInput = input( true, 'Internal Order Blocks' , group = BLOCKS_GROUP, tooltip = showInternalOrderBlocksTooltip, inline = 'iob')
internalOrderBlocksSizeInput = input.int( 5, '', group = BLOCKS_GROUP, minval = 1, maxval = 20, inline = 'iob')
showSwingOrderBlocksInput = input( false, 'Swing Order Blocks', group = BLOCKS_GROUP, tooltip = showSwingOrderBlocksTooltip, inline = 'ob')
swingOrderBlocksSizeInput = input.int( 5, '', group = BLOCKS_GROUP, minval = 1, maxval = 20, inline = 'ob')
orderBlockFilterInput = input.string( 'Atr', 'Order Block Filter', group = BLOCKS_GROUP, tooltip = orderBlockFilterTooltip, options = )
orderBlockMitigationInput = input.string( HIGHLOW, 'Order Block Mitigation', group = BLOCKS_GROUP, tooltip = orderBlockMitigationTooltip, options = )
internalBullishOrderBlockColor = input.color(color.new(#808080, 80), 'Internal Bullish OB', group = BLOCKS_GROUP)
internalBearishOrderBlockColor = input.color(color.new(#808080, 80), 'Internal Bearish OB', group = BLOCKS_GROUP)
swingBullishOrderBlockColor = input.color(color.new(#808080, 80), 'Bullish OB', group = BLOCKS_GROUP)
swingBearishOrderBlockColor = input.color(color.new(#808080, 80), 'Bearish OB', group = BLOCKS_GROUP)
showEqualHighsLowsInput = input( true, 'Equal High/Low', group = EQUAL_GROUP, tooltip = showEqualHighsLowsTooltip)
equalHighsLowsLengthInput = input.int( 3, 'Bars Confirmation', group = EQUAL_GROUP, tooltip = equalHighsLowsLengthTooltip, minval = 1)
equalHighsLowsThresholdInput = input.float( 0.1, 'Threshold', group = EQUAL_GROUP, tooltip = equalHighsLowsThresholdTooltip, minval = 0, maxval = 0.5, step = 0.1)
equalHighsLowsSizeInput = input.string( TINY, 'Label Size', group = EQUAL_GROUP, options = )
showFairValueGapsInput = input( false, 'Fair Value Gaps', group = GAPS_GROUP, tooltip = showFairValueGapsTooltip)
fairValueGapsThresholdInput = input( true, 'Auto Threshold', group = GAPS_GROUP, tooltip = fairValueGapsThresholdTooltip)
fairValueGapsTimeframeInput = input.timeframe('', 'Timeframe', group = GAPS_GROUP, tooltip = fairValueGapsTimeframeTooltip)
fairValueGapsBullColorInput = input.color(color.new(#00ff68, 70), 'Bullish FVG' , group = GAPS_GROUP)
fairValueGapsBearColorInput = input.color(color.new(#ff0008, 70), 'Bearish FVG' , group = GAPS_GROUP)
fairValueGapsExtendInput = input.int( 1, 'Extend FVG', group = GAPS_GROUP, tooltip = fairValueGapsExtendTooltip, minval = 0)
showDailyLevelsInput = input( false, 'Daily', group = LEVELS_GROUP, inline = 'daily')
dailyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'daily', options = )
dailyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'daily')
showWeeklyLevelsInput = input( false, 'Weekly', group = LEVELS_GROUP, inline = 'weekly')
weeklyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'weekly', options = )
weeklyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'weekly')
showMonthlyLevelsInput = input( false, 'Monthly', group = LEVELS_GROUP, inline = 'monthly')
monthlyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'monthly', options = )
monthlyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'monthly')
showPremiumDiscountZonesInput = input( false, 'Premium/Discount Zones', group = ZONES_GROUP , tooltip = showPremiumDiscountZonesTooltip)
premiumZoneColorInput = input.color( RED, 'Premium Zone', group = ZONES_GROUP)
equilibriumZoneColorInput = input.color( GRAY, 'Equilibrium Zone', group = ZONES_GROUP)
discountZoneColorInput = input.color( GREEN, 'Discount Zone', group = ZONES_GROUP)
//---------------------------------------------------------------------------------------------------------------------}
//DATA STRUCTURES & VARIABLES
//---------------------------------------------------------------------------------------------------------------------{
// @type UDT representing alerts as bool fields
// @field internalBullishBOS internal structure custom alert
// @field internalBearishBOS internal structure custom alert
// @field internalBullishCHoCH internal structure custom alert
// @field internalBearishCHoCH internal structure custom alert
// @field swingBullishBOS swing structure custom alert
// @field swingBearishBOS swing structure custom alert
// @field swingBullishCHoCH swing structure custom alert
// @field swingBearishCHoCH swing structure custom alert
// @field internalBullishOrderBlock internal order block custom alert
// @field internalBearishOrderBlock internal order block custom alert
// @field swingBullishOrderBlock swing order block custom alert
// @field swingBearishOrderBlock swing order block custom alert
// @field equalHighs equal high low custom alert
// @field equalLows equal high low custom alert
// @field bullishFairValueGap fair value gap custom alert
// @field bearishFairValueGap fair value gap custom alert
type alerts
bool internalBullishBOS = false
bool internalBearishBOS = false
bool internalBullishCHoCH = false
bool internalBearishCHoCH = false
bool swingBullishBOS = false
bool swingBearishBOS = false
bool swingBullishCHoCH = false
bool swingBearishCHoCH = false
bool internalBullishOrderBlock = false
bool internalBearishOrderBlock = false
bool swingBullishOrderBlock = false
bool swingBearishOrderBlock = false
bool equalHighs = false
bool equalLows = false
bool bullishFairValueGap = false
bool bearishFairValueGap = false
// @type UDT representing last swing extremes (top & bottom)
// @field top last top swing price
// @field bottom last bottom swing price
// @field barTime last swing bar time
// @field barIndex last swing bar index
// @field lastTopTime last top swing time
// @field lastBottomTime last bottom swing time
type trailingExtremes
float top
float bottom
int barTime
int barIndex
int lastTopTime
int lastBottomTime
// @type UDT representing Fair Value Gaps
// @field top top price
// @field bottom bottom price
// @field bias bias (BULLISH or BEARISH)
// @field topBox top box
// @field bottomBox bottom box
type fairValueGap
float top
float bottom
int bias
box topBox
box bottomBox
// @type UDT representing trend bias
// @field bias BULLISH or BEARISH
type trend
int bias
// @type UDT representing Equal Highs Lows display
// @field l_ine displayed line
// @field l_abel displayed label
type equalDisplay
line l_ine = na
label l_abel = na
// @type UDT representing a pivot point (swing point)
// @field currentLevel current price level
// @field lastLevel last price level
// @field crossed true if price level is crossed
// @field barTime bar time
// @field barIndex bar index
type pivot
float currentLevel
float lastLevel
bool crossed
int barTime = time
int barIndex = bar_index
// @type UDT representing an order block
// @field barHigh bar high
// @field barLow bar low
// @field barTime bar time
// @field bias BULLISH or BEARISH
type orderBlock
float barHigh
float barLow
int barTime
int bias
// @variable current swing pivot high
var pivot swingHigh = pivot.new(na,na,false)
// @variable current swing pivot low
var pivot swingLow = pivot.new(na,na,false)
// @variable current internal pivot high
var pivot internalHigh = pivot.new(na,na,false)
// @variable current internal pivot low
var pivot internalLow = pivot.new(na,na,false)
// @variable current equal high pivot
var pivot equalHigh = pivot.new(na,na,false)
// @variable current equal low pivot
var pivot equalLow = pivot.new(na,na,false)
// @variable swing trend bias
var trend swingTrend = trend.new(0)
// @variable internal trend bias
var trend internalTrend = trend.new(0)
// @variable equal high display
var equalDisplay equalHighDisplay = equalDisplay.new()
// @variable equal low display
var equalDisplay equalLowDisplay = equalDisplay.new()
// @variable storage for fairValueGap UDTs
var array fairValueGaps = array.new()
// @variable storage for parsed highs
var array parsedHighs = array.new()
// @variable storage for parsed lows
var array parsedLows = array.new()
// @variable storage for raw highs
var array highs = array.new()
// @variable storage for raw lows
var array lows = array.new()
// @variable storage for bar time values
var array times = array.new()
// @variable last trailing swing high and low
var trailingExtremes trailing = trailingExtremes.new()
// @variable storage for orderBlock UDTs (swing order blocks)
var array swingOrderBlocks = array.new()
// @variable storage for orderBlock UDTs (internal order blocks)
var array internalOrderBlocks = array.new()
// @variable storage for swing order blocks boxes
var array swingOrderBlocksBoxes = array.new()
// @variable storage for internal order blocks boxes
var array internalOrderBlocksBoxes = array.new()
// @variable color for swing bullish structures
var swingBullishColor = styleInput == MONOCHROME ? MONO_BULLISH : swingBullColorInput
// @variable color for swing bearish structures
var swingBearishColor = styleInput == MONOCHROME ? MONO_BEARISH : swingBearColorInput
// @variable color for bullish fair value gaps
var fairValueGapBullishColor = styleInput == MONOCHROME ? color.new(MONO_BULLISH,70) : fairValueGapsBullColorInput
// @variable color for bearish fair value gaps
var fairValueGapBearishColor = styleInput == MONOCHROME ? color.new(MONO_BEARISH,70) : fairValueGapsBearColorInput
// @variable color for premium zone
var premiumZoneColor = styleInput == MONOCHROME ? MONO_BEARISH : premiumZoneColorInput
// @variable color for discount zone
var discountZoneColor = styleInput == MONOCHROME ? MONO_BULLISH : discountZoneColorInput
// @variable bar index on current script iteration
varip int currentBarIndex = bar_index
// @variable bar index on last script iteration
varip int lastBarIndex = bar_index
// @variable alerts in current bar
alerts currentAlerts = alerts.new()
// @variable time at start of chart
var initialTime = time
// we create the needed boxes for displaying order blocks at the first execution
if barstate.isfirst
if showSwingOrderBlocksInput
for index = 1 to swingOrderBlocksSizeInput
swingOrderBlocksBoxes.push(box.new(na,na,na,na,xloc = xloc.bar_time,extend = extend.right))
if showInternalOrderBlocksInput
for index = 1 to internalOrderBlocksSizeInput
internalOrderBlocksBoxes.push(box.new(na,na,na,na,xloc = xloc.bar_time,extend = extend.right))
// @variable source to use in bearish order blocks mitigation
bearishOrderBlockMitigationSource = orderBlockMitigationInput == CLOSE ? close : high
// @variable source to use in bullish order blocks mitigation
bullishOrderBlockMitigationSource = orderBlockMitigationInput == CLOSE ? close : low
// @variable default volatility measure
atrMeasure = ta.atr(200)
// @variable parsed volatility measure by user settings
volatilityMeasure = orderBlockFilterInput == ATR ? atrMeasure : ta.cum(ta.tr)/bar_index
// @variable true if current bar is a high volatility bar
highVolatilityBar = (high - low) >= (2 * volatilityMeasure)
// @variable parsed high
parsedHigh = highVolatilityBar ? low : high
// @variable parsed low
parsedLow = highVolatilityBar ? high : low
// we store current values into the arrays at each bar
parsedHighs.push(parsedHigh)
parsedLows.push(parsedLow)
highs.push(high)
lows.push(low)
times.push(time)
//---------------------------------------------------------------------------------------------------------------------}
//USER-DEFINED FUNCTIONS
//---------------------------------------------------------------------------------------------------------------------{
// @function Get the value of the current leg, it can be 0 (bearish) or 1 (bullish)
// @returns int
leg(int size) =>
var leg = 0
newLegHigh = high > ta.highest( size)
newLegLow = low < ta.lowest( size)
if newLegHigh
leg := BEARISH_LEG
else if newLegLow
leg := BULLISH_LEG
leg
// @function Identify whether the current value is the start of a new leg (swing)
// @param leg (int) Current leg value
// @returns bool
startOfNewLeg(int leg) => ta.change(leg) != 0
// @function Identify whether the current level is the start of a new bearish leg (swing)
// @param leg (int) Current leg value
// @returns bool
startOfBearishLeg(int leg) => ta.change(leg) == -1
// @function Identify whether the current level is the start of a new bullish leg (swing)
// @param leg (int) Current leg value
// @returns bool
startOfBullishLeg(int leg) => ta.change(leg) == +1
// @function create a new label
// @param labelTime bar time coordinate
// @param labelPrice price coordinate
// @param tag text to display
// @param labelColor text color
// @param labelStyle label style
// @returns label ID
drawLabel(int labelTime, float labelPrice, string tag, color labelColor, string labelStyle) =>
var label l_abel = na
if modeInput == PRESENT
l_abel.delete()
l_abel := label.new(chart.point.new(labelTime,na,labelPrice),tag,xloc.bar_time,color=color(na),textcolor=labelColor,style = labelStyle,size = size.small)
// @function create a new line and label representing an EQH or EQL
// @param p_ivot starting pivot
// @param level price level of current pivot
// @param size how many bars ago was the current pivot detected
// @param equalHigh true for EQH, false for EQL
// @returns label ID
drawEqualHighLow(pivot p_ivot, float level, int size, bool equalHigh) =>
equalDisplay e_qualDisplay = equalHigh ? equalHighDisplay : equalLowDisplay
string tag = 'EQL'
color equalColor = swingBullishColor
string labelStyle = label.style_label_up
if equalHigh
tag := 'EQH'
equalColor := swingBearishColor
labelStyle := label.style_label_down
if modeInput == PRESENT
line.delete( e_qualDisplay.l_ine)
label.delete( e_qualDisplay.l_abel)
e_qualDisplay.l_ine := line.new(chart.point.new(p_ivot.barTime,na,p_ivot.currentLevel), chart.point.new(time ,na,level), xloc = xloc.bar_time, color = equalColor, style = line.style_dotted)
labelPosition = math.round(0.5*(p_ivot.barIndex + bar_index - size))
e_qualDisplay.l_abel := label.new(chart.point.new(na,labelPosition,level), tag, xloc.bar_index, color = color(na), textcolor = equalColor, style = labelStyle, size = equalHighsLowsSizeInput)
// @function store current structure and trailing swing points, and also display swing points and equal highs/lows
// @param size (int) structure size
// @param equalHighLow (bool) true for displaying current highs/lows
// @param internal (bool) true for getting internal structures
// @returns label ID
getCurrentStructure(int size,bool equalHighLow = false, bool internal = false) =>
currentLeg = leg(size)
newPivot = startOfNewLeg(currentLeg)
pivotLow = startOfBullishLeg(currentLeg)
pivotHigh = startOfBearishLeg(currentLeg)
if newPivot
if pivotLow
pivot p_ivot = equalHighLow ? equalLow : internal ? internalLow : swingLow
if equalHighLow and math.abs(p_ivot.currentLevel - low ) < equalHighsLowsThresholdInput * atrMeasure
drawEqualHighLow(p_ivot, low , size, false)
p_ivot.lastLevel := p_ivot.currentLevel
p_ivot.currentLevel := low
p_ivot.crossed := false
p_ivot.barTime := time
p_ivot.barIndex := bar_index
if not equalHighLow and not internal
trailing.bottom := p_ivot.currentLevel
trailing.barTime := p_ivot.barTime
trailing.barIndex := p_ivot.barIndex
trailing.lastBottomTime := p_ivot.barTime
if showSwingsInput and not internal and not equalHighLow
drawLabel(time , p_ivot.currentLevel, p_ivot.currentLevel < p_ivot.lastLevel ? 'LL' : 'HL', swingBullishColor, label.style_label_up)
else
pivot p_ivot = equalHighLow ? equalHigh : internal ? internalHigh : swingHigh
if equalHighLow and math.abs(p_ivot.currentLevel - high ) < equalHighsLowsThresholdInput * atrMeasure
drawEqualHighLow(p_ivot,high ,size,true)
p_ivot.lastLevel := p_ivot.currentLevel
p_ivot.currentLevel := high
p_ivot.crossed := false
p_ivot.barTime := time
p_ivot.barIndex := bar_index
if not equalHighLow and not internal
trailing.top := p_ivot.currentLevel
trailing.barTime := p_ivot.barTime
trailing.barIndex := p_ivot.barIndex
trailing.lastTopTime := p_ivot.barTime
if showSwingsInput and not internal and not equalHighLow
drawLabel(time , p_ivot.currentLevel, p_ivot.currentLevel > p_ivot.lastLevel ? 'HH' : 'LH', swingBearishColor, label.style_label_down)
// @function draw line and label representing a structure
// @param p_ivot base pivot point
// @param tag test to display
// @param structureColor base color
// @param lineStyle line style
// @param labelStyle label style
// @param labelSize text size
// @returns label ID
drawStructure(pivot p_ivot, string tag, color structureColor, string lineStyle, string labelStyle, string labelSize) =>
var line l_ine = line.new(na,na,na,na,xloc = xloc.bar_time)
var label l_abel = label.new(na,na)
if modeInput == PRESENT
l_ine.delete()
l_abel.delete()
l_ine := line.new(chart.point.new(p_ivot.barTime,na,p_ivot.currentLevel), chart.point.new(time,na,p_ivot.currentLevel), xloc.bar_time, color=structureColor, style=lineStyle)
l_abel := label.new(chart.point.new(na,math.round(0.5*(p_ivot.barIndex+bar_index)),p_ivot.currentLevel), tag, xloc.bar_index, color=color(na), textcolor=structureColor, style=labelStyle, size = labelSize)
// @function delete order blocks
// @param internal true for internal order blocks
// @returns orderBlock ID
deleteOrderBlocks(bool internal = false) =>
array orderBlocks = internal ? internalOrderBlocks : swingOrderBlocks
for in orderBlocks
bool crossedOderBlock = false
if bearishOrderBlockMitigationSource > eachOrderBlock.barHigh and eachOrderBlock.bias == BEARISH
crossedOderBlock := true
if internal
currentAlerts.internalBearishOrderBlock := true
else
currentAlerts.swingBearishOrderBlock := true
else if bullishOrderBlockMitigationSource < eachOrderBlock.barLow and eachOrderBlock.bias == BULLISH
crossedOderBlock := true
if internal
currentAlerts.internalBullishOrderBlock := true
else
currentAlerts.swingBullishOrderBlock := true
if crossedOderBlock
orderBlocks.remove(index)
// @function fetch and store order blocks
// @param p_ivot base pivot point
// @param internal true for internal order blocks
// @param bias BULLISH or BEARISH
// @returns void
storeOrdeBlock(pivot p_ivot,bool internal = false,int bias) =>
if (not internal and showSwingOrderBlocksInput) or (internal and showInternalOrderBlocksInput)
array a_rray = na
int parsedIndex = na
if bias == BEARISH
a_rray := parsedHighs.slice(p_ivot.barIndex,bar_index)
parsedIndex := p_ivot.barIndex + a_rray.indexof(a_rray.max())
else
a_rray := parsedLows.slice(p_ivot.barIndex,bar_index)
parsedIndex := p_ivot.barIndex + a_rray.indexof(a_rray.min())
orderBlock o_rderBlock = orderBlock.new(parsedHighs.get(parsedIndex), parsedLows.get(parsedIndex), times.get(parsedIndex),bias)
array orderBlocks = internal ? internalOrderBlocks : swingOrderBlocks
if orderBlocks.size() >= 100
orderBlocks.pop()
orderBlocks.unshift(o_rderBlock)
// @function draw order blocks as boxes
// @param internal true for internal order blocks
// @returns void
drawOrderBlocks(bool internal = false) =>
array orderBlocks = internal ? internalOrderBlocks : swingOrderBlocks
orderBlocksSize = orderBlocks.size()
if orderBlocksSize > 0
maxOrderBlocks = internal ? internalOrderBlocksSizeInput : swingOrderBlocksSizeInput
array parsedOrdeBlocks = orderBlocks.slice(0, math.min(maxOrderBlocks,orderBlocksSize))
array b_oxes = internal ? internalOrderBlocksBoxes : swingOrderBlocksBoxes
for in parsedOrdeBlocks
orderBlockColor = styleInput == MONOCHROME ? (eachOrderBlock.bias == BEARISH ? color.new(MONO_BEARISH,80) : color.new(MONO_BULLISH,80)) : internal ? (eachOrderBlock.bias == BEARISH ? internalBearishOrderBlockColor : internalBullishOrderBlockColor) : (eachOrderBlock.bias == BEARISH ? swingBearishOrderBlockColor : swingBullishOrderBlockColor)
box b_ox = b_oxes.get(index)
b_ox.set_top_left_point( chart.point.new(eachOrderBlock.barTime,na,eachOrderBlock.barHigh))
b_ox.set_bottom_right_point(chart.point.new(last_bar_time,na,eachOrderBlock.barLow))
b_ox.set_border_color( internal ? na : orderBlockColor)
b_ox.set_bgcolor( orderBlockColor)
// @function detect and draw structures, also detect and store order blocks
// @param internal true for internal structures or order blocks
// @returns void
displayStructure(bool internal = false) =>
var bullishBar = true
var bearishBar = true
if internalFilterConfluenceInput
bullishBar := high - math.max(close, open) > math.min(close, open - low)
bearishBar := high - math.max(close, open) < math.min(close, open - low)
pivot p_ivot = internal ? internalHigh : swingHigh
trend t_rend = internal ? internalTrend : swingTrend
lineStyle = internal ? line.style_dashed : line.style_solid
labelSize = internal ? internalStructureSize : swingStructureSize
extraCondition = internal ? internalHigh.currentLevel != swingHigh.currentLevel and bullishBar : true
bullishColor = styleInput == MONOCHROME ? MONO_BULLISH : internal ? internalBullColorInput : swingBullColorInput
if ta.crossover(close,p_ivot.currentLevel) and not p_ivot.crossed and extraCondition
string tag = t_rend.bias == BEARISH ? CHOCH : BOS
if internal
currentAlerts.internalBullishCHoCH := tag == CHOCH
currentAlerts.internalBullishBOS := tag == BOS
else
currentAlerts.swingBullishCHoCH := tag == CHOCH
currentAlerts.swingBullishBOS := tag == BOS
p_ivot.crossed := true
t_rend.bias := BULLISH
displayCondition = internal ? showInternalsInput and (showInternalBullInput == ALL or (showInternalBullInput == BOS and tag != CHOCH) or (showInternalBullInput == CHOCH and tag == CHOCH)) : showStructureInput and (showSwingBullInput == ALL or (showSwingBullInput == BOS and tag != CHOCH) or (showSwingBullInput == CHOCH and tag == CHOCH))
if displayCondition
drawStructure(p_ivot,tag,bullishColor,lineStyle,label.style_label_down,labelSize)
if (internal and showInternalOrderBlocksInput) or (not internal and showSwingOrderBlocksInput)
storeOrdeBlock(p_ivot,internal,BULLISH)
p_ivot := internal ? internalLow : swingLow
extraCondition := internal ? internalLow.currentLevel != swingLow.currentLevel and bearishBar : true
bearishColor = styleInput == MONOCHROME ? MONO_BEARISH : internal ? internalBearColorInput : swingBearColorInput
if ta.crossunder(close,p_ivot.currentLevel) and not p_ivot.crossed and extraCondition
string tag = t_rend.bias == BULLISH ? CHOCH : BOS
if internal
currentAlerts.internalBearishCHoCH := tag == CHOCH
currentAlerts.internalBearishBOS := tag == BOS
else
currentAlerts.swingBearishCHoCH := tag == CHOCH
currentAlerts.swingBearishBOS := tag == BOS
p_ivot.crossed := true
t_rend.bias := BEARISH
displayCondition = internal ? showInternalsInput and (showInternalBearInput == ALL or (showInternalBearInput == BOS and tag != CHOCH) or (showInternalBearInput == CHOCH and tag == CHOCH)) : showStructureInput and (showSwingBearInput == ALL or (showSwingBearInput == BOS and tag != CHOCH) or (showSwingBearInput == CHOCH and tag == CHOCH))
if displayCondition
drawStructure(p_ivot,tag,bearishColor,lineStyle,label.style_label_up,labelSize)
if (internal and showInternalOrderBlocksInput) or (not internal and showSwingOrderBlocksInput)
storeOrdeBlock(p_ivot,internal,BEARISH)
// @function draw one fair value gap box (each fair value gap has two boxes)
// @param leftTime left time coordinate
// @param rightTime right time coordinate
// @param topPrice top price level
// @param bottomPrice bottom price level
// @param boxColor box color
// @returns box ID
fairValueGapBox(leftTime,rightTime,topPrice,bottomPrice,boxColor) => box.new(chart.point.new(leftTime,na,topPrice),chart.point.new(rightTime + fairValueGapsExtendInput * (time-time ),na,bottomPrice), xloc=xloc.bar_time, border_color = boxColor, bgcolor = boxColor)
// @function delete fair value gaps
// @returns fairValueGap ID
deleteFairValueGaps() =>
for in fairValueGaps
if (low < eachFairValueGap.bottom and eachFairValueGap.bias == BULLISH) or (high > eachFairValueGap.top and eachFairValueGap.bias == BEARISH)
eachFairValueGap.topBox.delete()
eachFairValueGap.bottomBox.delete()
fairValueGaps.remove(index)
// @function draw fair value gaps
// @returns fairValueGap ID
drawFairValueGaps() =>
= request.security(syminfo.tickerid, fairValueGapsTimeframeInput, [close , open , time , high , low , time , high , low ],lookahead = barmerge.lookahead_on)
barDeltaPercent = (lastClose - lastOpen) / (lastOpen * 100)
newTimeframe = timeframe.change(fairValueGapsTimeframeInput)
threshold = fairValueGapsThresholdInput ? ta.cum(math.abs(newTimeframe ? barDeltaPercent : 0)) / bar_index * 2 : 0
bullishFairValueGap = currentLow > last2High and lastClose > last2High and barDeltaPercent > threshold and newTimeframe
bearishFairValueGap = currentHigh < last2Low and lastClose < last2Low and -barDeltaPercent > threshold and newTimeframe
if bullishFairValueGap
currentAlerts.bullishFairValueGap := true
fairValueGaps.unshift(fairValueGap.new(currentLow,last2High,BULLISH,fairValueGapBox(lastTime,currentTime,currentLow,math.avg(currentLow,last2High),fairValueGapBullishColor),fairValueGapBox(lastTime,currentTime,math.avg(currentLow,last2High),last2High,fairValueGapBullishColor)))
if bearishFairValueGap
currentAlerts.bearishFairValueGap := true
fairValueGaps.unshift(fairValueGap.new(currentHigh,last2Low,BEARISH,fairValueGapBox(lastTime,currentTime,currentHigh,math.avg(currentHigh,last2Low),fairValueGapBearishColor),fairValueGapBox(lastTime,currentTime,math.avg(currentHigh,last2Low),last2Low,fairValueGapBearishColor)))
// @function get line style from string
// @param style line style
// @returns string
getStyle(string style) =>
switch style
SOLID => line.style_solid
DASHED => line.style_dashed
DOTTED => line.style_dotted
// @function draw MultiTimeFrame levels
// @param timeframe base timeframe
// @param sameTimeframe true if chart timeframe is same as base timeframe
// @param style line style
// @param levelColor line and text color
// @returns void
drawLevels(string timeframe, bool sameTimeframe, string style, color levelColor) =>
= request.security(syminfo.tickerid, timeframe, [high , low , time , time],lookahead = barmerge.lookahead_on)
float parsedTop = sameTimeframe ? high : topLevel
float parsedBottom = sameTimeframe ? low : bottomLevel
int parsedLeftTime = sameTimeframe ? time : leftTime
int parsedRightTime = sameTimeframe ? time : rightTime
int parsedTopTime = time
int parsedBottomTime = time
if not sameTimeframe
int leftIndex = times.binary_search_rightmost(parsedLeftTime)
int rightIndex = times.binary_search_rightmost(parsedRightTime)
array timeArray = times.slice(leftIndex,rightIndex)
array topArray = highs.slice(leftIndex,rightIndex)
array bottomArray = lows.slice(leftIndex,rightIndex)
parsedTopTime := timeArray.size() > 0 ? timeArray.get(topArray.indexof(topArray.max())) : initialTime
parsedBottomTime := timeArray.size() > 0 ? timeArray.get(bottomArray.indexof(bottomArray.min())) : initialTime
var line topLine = line.new(na, na, na, na, xloc = xloc.bar_time, color = levelColor, style = getStyle(style))
var line bottomLine = line.new(na, na, na, na, xloc = xloc.bar_time, color = levelColor, style = getStyle(style))
var label topLabel = label.new(na, na, xloc = xloc.bar_time, text = str.format('P{0}H',timeframe), color=color(na), textcolor = levelColor, size = size.small, style = label.style_label_left)
var label bottomLabel = label.new(na, na, xloc = xloc.bar_time, text = str.format('P{0}L',timeframe), color=color(na), textcolor = levelColor, size = size.small, style = label.style_label_left)
topLine.set_first_point( chart.point.new(parsedTopTime,na,parsedTop))
topLine.set_second_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedTop))
topLabel.set_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedTop))
bottomLine.set_first_point( chart.point.new(parsedBottomTime,na,parsedBottom))
bottomLine.set_second_point(chart.point.new(last_bar_time + 20 * (time-time ),na,parsedBottom))
bottomLabel.set_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedBottom))
// @function true if chart timeframe is higher than provided timeframe
// @param timeframe timeframe to check
// @returns bool
higherTimeframe(string timeframe) => timeframe.in_seconds() > timeframe.in_seconds(timeframe)
// @function update trailing swing points
// @returns int
updateTrailingExtremes() =>
trailing.top := math.max(high,trailing.top)
trailing.lastTopTime := trailing.top == high ? time : trailing.lastTopTime
trailing.bottom := math.min(low,trailing.bottom)
trailing.lastBottomTime := trailing.bottom == low ? time : trailing.lastBottomTime
// @function draw trailing swing points
// @returns void
drawHighLowSwings() =>
var line topLine = line.new(na, na, na, na, color = swingBearishColor, xloc = xloc.bar_time)
var line bottomLine = line.new(na, na, na, na, color = swingBullishColor, xloc = xloc.bar_time)
var label topLabel = label.new(na, na, color=color(na), textcolor = swingBearishColor, xloc = xloc.bar_time, style = label.style_label_down, size = size.tiny)
var label bottomLabel = label.new(na, na, color=color(na), textcolor = swingBullishColor, xloc = xloc.bar_time, style = label.style_label_up, size = size.tiny)
rightTimeBar = last_bar_time + 20 * (time - time )
topLine.set_first_point( chart.point.new(trailing.lastTopTime, na, trailing.top))
topLine.set_second_point( chart.point.new(rightTimeBar, na, trailing.top))
topLabel.set_point( chart.point.new(rightTimeBar, na, trailing.top))
topLabel.set_text( swingTrend.bias == BEARISH ? 'Strong High' : 'Weak High')
bottomLine.set_first_point( chart.point.new(trailing.lastBottomTime, na, trailing.bottom))
bottomLine.set_second_point(chart.point.new(rightTimeBar, na, trailing.bottom))
bottomLabel.set_point( chart.point.new(rightTimeBar, na, trailing.bottom))
bottomLabel.set_text( swingTrend.bias == BULLISH ? 'Strong Low' : 'Weak Low')
// @function draw a zone with a label and a box
// @param labelLevel price level for label
// @param labelIndex bar index for label
// @param top top price level for box
// @param bottom bottom price level for box
// @param tag text to display
// @param zoneColor base color
// @param style label style
// @returns void
drawZone(float labelLevel, int labelIndex, float top, float bottom, string tag, color zoneColor, string style) =>
var label l_abel = label.new(na,na,text = tag, color=color(na),textcolor = zoneColor, style = style, size = size.small)
var box b_ox = box.new(na,na,na,na,bgcolor = color.new(zoneColor,80),border_color = color(na), xloc = xloc.bar_time)
b_ox.set_top_left_point( chart.point.new(trailing.barTime,na,top))
b_ox.set_bottom_right_point(chart.point.new(last_bar_time,na,bottom))
l_abel.set_point( chart.point.new(na,labelIndex,labelLevel))
// @function draw premium/discount zones
// @returns void
drawPremiumDiscountZones() =>
drawZone(trailing.top, math.round(0.5*(trailing.barIndex + last_bar_index)), trailing.top, 0.95*trailing.top + 0.05*trailing.bottom, 'Premium', premiumZoneColor, label.style_label_down)
equilibriumLevel = math.avg(trailing.top, trailing.bottom)
drawZone(equilibriumLevel, last_bar_index, 0.525*trailing.top + 0.475*trailing.bottom, 0.525*trailing.bottom + 0.475*trailing.top, 'Equilibrium', equilibriumZoneColorInput, label.style_label_left)
drawZone(trailing.bottom, math.round(0.5*(trailing.barIndex + last_bar_index)), 0.95*trailing.bottom + 0.05*trailing.top, trailing.bottom, 'Discount', discountZoneColor, label.style_label_up)
//---------------------------------------------------------------------------------------------------------------------}
//MUTABLE VARIABLES & EXECUTION
//---------------------------------------------------------------------------------------------------------------------{
parsedOpen = showTrendInput ? open : na
candleColor = internalTrend.bias == BULLISH ? swingBullishColor : swingBearishColor
plotcandle(parsedOpen,high,low,close,color = candleColor, wickcolor = candleColor, bordercolor = candleColor)
if showHighLowSwingsInput or showPremiumDiscountZonesInput
updateTrailingExtremes()
if showHighLowSwingsInput
drawHighLowSwings()
if showPremiumDiscountZonesInput
drawPremiumDiscountZones()
if showFairValueGapsInput
deleteFairValueGaps()
getCurrentStructure(swingsLengthInput,false)
getCurrentStructure(5,false,true)
if showEqualHighsLowsInput
getCurrentStructure(equalHighsLowsLengthInput,true)
if showInternalsInput or showInternalOrderBlocksInput or showTrendInput
displayStructure(true)
if showStructureInput or showSwingOrderBlocksInput or showHighLowSwingsInput
displayStructure()
if showInternalOrderBlocksInput
deleteOrderBlocks(true)
if showSwingOrderBlocksInput
deleteOrderBlocks()
if showFairValueGapsInput
drawFairValueGaps()
if barstate.islastconfirmedhistory or barstate.islast
if showInternalOrderBlocksInput
drawOrderBlocks(true)
if showSwingOrderBlocksInput
drawOrderBlocks()
lastBarIndex := currentBarIndex
currentBarIndex := bar_index
newBar = currentBarIndex != lastBarIndex
if barstate.islastconfirmedhistory or (barstate.isrealtime and newBar)
if showDailyLevelsInput and not higherTimeframe('D')
drawLevels('D',timeframe.isdaily,dailyLevelsStyleInput,dailyLevelsColorInput)
if showWeeklyLevelsInput and not higherTimeframe('W')
drawLevels('W',timeframe.isweekly,weeklyLevelsStyleInput,weeklyLevelsColorInput)
if showMonthlyLevelsInput and not higherTimeframe('M')
drawLevels('M',timeframe.ismonthly,monthlyLevelsStyleInput,monthlyLevelsColorInput)
//---------------------------------------------------------------------------------------------------------------------}
//ALERTS
//---------------------------------------------------------------------------------------------------------------------{
alertcondition(currentAlerts.internalBullishBOS, 'Internal Bullish BOS', 'Internal Bullish BOS formed')
alertcondition(currentAlerts.internalBullishCHoCH, 'Internal Bullish CHoCH', 'Internal Bullish CHoCH formed')
alertcondition(currentAlerts.internalBearishBOS, 'Internal Bearish BOS', 'Internal Bearish BOS formed')
alertcondition(currentAlerts.internalBearishCHoCH, 'Internal Bearish CHoCH', 'Internal Bearish CHoCH formed')
alertcondition(currentAlerts.swingBullishBOS, 'Bullish BOS', 'Internal Bullish BOS formed')
alertcondition(currentAlerts.swingBullishCHoCH, 'Bullish CHoCH', 'Internal Bullish CHoCH formed')
alertcondition(currentAlerts.swingBearishBOS, 'Bearish BOS', 'Bearish BOS formed')
alertcondition(currentAlerts.swingBearishCHoCH, 'Bearish CHoCH', 'Bearish CHoCH formed')
alertcondition(currentAlerts.internalBullishOrderBlock, 'Bullish Internal OB Breakout', 'Price broke bullish internal OB')
alertcondition(currentAlerts.internalBearishOrderBlock, 'Bearish Internal OB Breakout', 'Price broke bearish internal OB')
alertcondition(currentAlerts.swingBullishOrderBlock, 'Bullish Swing OB Breakout', 'Price broke bullish swing OB')
alertcondition(currentAlerts.swingBearishOrderBlock, 'Bearish Swing OB Breakout', 'Price broke bearish swing OB')
alertcondition(currentAlerts.equalHighs, 'Equal Highs', 'Equal highs detected')
alertcondition(currentAlerts.equalLows, 'Equal Lows', 'Equal lows detected')
alertcondition(currentAlerts.bullishFairValueGap, 'Bullish FVG', 'Bullish FVG formed')
alertcondition(currentAlerts.bearishFairValueGap, 'Bearish FVG', 'Bearish FVG formed')
//---------------------------------------------------------------------------------------------------------------------}
10-Crypto Normalized IndexOverview
This indicator builds a custom index for up to 10 cryptocurrencies and plots their combined trend as a single line. Each coin is normalized to 100 at a user-selected base date (or at its first available bar), then averaged (equally or by your custom weights). The result lets you see the market direction of your basket at a glance.
How it works
For each symbol, the script finds a base price (first bar ≥ the chosen base date; or the first bar in history if base-date normalization is off).
It converts the current price to a normalized value: price / base × 100.
It then computes a weighted average of those normalized values to form the index.
A dotted baseline at 100 marks the starting point; values above/below 100 represent % performance vs. the base.
Key inputs
Symbols (10 max): Default set: BTC, ETH, SOL, POL, OKB, BNB, SUI, LINK, 1INCH, TRX (USDT pairs). You can change exchange/quote (keep all the same quote, e.g., all USDT).
Weights: Toggle equal weights or enter custom weights. Custom weights are auto-normalized internally, so they don’t need to sum to 1.
Base date: Year/Month/Day (default: 2025-06-01). Turning normalization off uses each symbol’s first available bar as its base.
Smoothing: Optional SMA to reduce noise.
Show baseline: Toggle the horizontal line at 100.
Interpretation
Index > 100 and rising → your basket is up since the base date.
Index < 100 and falling → down since the base date.
Use shorter timeframes for intraday sentiment, higher timeframes for swing/trend context.
Default basket & weights (editable)
Order: BTC, ETH, SOL, POL, OKB, BNB, SUI, LINK, 1INCH, TRX.
Default custom weight factors: 30, 30, 20, 10, 10, 5, 5, 5, 5, 5 (auto-normalized).
Base date: 2025-06-01.
Big Candle Trend█ OVERVIEW
The "Big Candle Trend" indicator is a technical analysis tool written in Pine Script® v6 that identifies large signal candles on the chart and determines the trend direction based on the analysis of all candles within a specified period. Designed for traders seeking a simple yet effective tool to identify key market movements and trends, the indicator provides clarity and precision through flexible settings, trend line visualization, and retracement lines on signal candles.
█ CONCEPTS
The goal of the "Big Candle Trend" indicator was to create a tool based solely on the size of candle bodies and their relative positions, making it universal and effective across all markets (stocks, forex, cryptocurrencies) and timeframes. Unlike traditional indicators that often rely on complex formulas or external data (e.g., volume), this indicator uses simple yet powerful price action logic. Large signal candles are identified by comparing their body size to the average body size over a selected period, and the trend is determined by analyzing price changes over a longer period relative to the average candle body size. Additionally, the indicator draws horizontal lines on signal candles, aiding in setting Stop Loss levels or delayed entries.
█ FEATURES
Large Signal Candle Detection: Identifies candles with a body larger than the average body multiplied by a user-defined multiplier, aligned with the trend (if the trend filter is enabled). Signals are displayed as triangles (green for bullish, red for bearish).
Trend Analysis: Determines the trend (uptrend, downtrend, or neutral) by comparing the price change over a selected period (trend_length) to the average candle body size multiplied by a trend strength multiplier. The trend starts when:
Uptrend: The price change (difference between the current close and the close from an earlier period) is positive and exceeds the average candle body size multiplied by the trend strength multiplier (avg_body_trend * trend_mult).
Downtrend: The price change is negative and exceeds, in absolute value, the average candle body size multiplied by the trend strength multiplier.
Neutral Trend: The price change is below the required threshold, indicating no clear market direction.The trend ends when the price change no longer meets the conditions for an uptrend or downtrend, transitioning to a neutral state or switching to the opposite trend when the price change reverses and meets the conditions for the new trend. This approach differs from standard methods as it focuses on price dynamics in the context of candle body size, offering a more intuitive and direct way to gauge trend strength.
Smoothed Trend Line: Displays a trend line based on the average price (HL2, i.e., the average of the high and low of a candle), smoothed using a user-defined smoothing parameter. The trend line reflects the market direction but is not tied to breakouts, unlike many other trend indicators, allowing for more flexible interpretation.
Retracement Lines: Draws horizontal lines on signal candles at a user-defined level (e.g., 0.618). The lines are displayed to the right of the candle, with a width of one candle. For bullish candles, the line is measured from the top of the body (close) downward, and for bearish candles, from the bottom of the body (close) upward, aiding in setting Stop Loss or delayed entries.
Trend Option: Option to enable a trend filter that limits large candle signals to those aligned with the current trend, enhancing signal precision.
Customizable Visualization: Allows customization of colors for uptrend, downtrend, and neutral states, trend line style, and shadow fill between the trend line and price.
Alerts: Built-in alerts for large signal candles (bullish and bearish) and trend changes (start of uptrend, downtrend, or neutral trend).
█ HOW TO USE
Add to Chart: Apply the indicator to your TradingView chart via the Pine Editor or Indicators menu.
Configure Settings:
Candle Settings:
Average Period (Candles): Sets the period for calculating the average candle body size.
Large Candle Multiplier: Multiplier determining how large a candle’s body must be to be considered "large".
Trend Settings:
Trend Period: Period for analyzing price changes to determine the trend.
Trend Strength Multiplier: Multiplier setting the minimum price change required to identify a significant trend.
Trend Line Smoothing: Degree of smoothing for the trend line.
Show Trend Line: Enables/disables the display of the trend line.
Apply Trend Filter: Limits large candle signals to those aligned with the current trend.
Trend Colors:
Customize colors for uptrend (green), downtrend (red), and neutral (gray) states, and enable/disable shadow fill.
Retracement Settings:
Retracement Level (0.0-1.0): Sets the level for lines on signal candles (e.g., 0.618).
Line Width: Sets the thickness of retracement lines.
Interpreting Signals:
Bullish Signal: A green triangle below the candle indicates a large bullish candle aligned with an uptrend (if the trend filter is enabled). A horizontal line is drawn to the right of the candle at the retracement level, measured from the top of the body downward.
Bearish Signal: A red triangle above the candle indicates a large bearish candle aligned with a downtrend (if the trend filter is enabled). A horizontal line is drawn to the right of the candle at the retracement level, measured from the bottom of the body upward.
rend Line: Shows the market direction (green for uptrend, red for downtrend, gray for neutral). Unlike many indicators, the trend line’s color is not tied to its breakout, allowing for more flexible interpretation of market dynamics.
Alerts: Set up alerts in TradingView for large signal candles or trend changes to receive real-time notifications.
Combining with Other Tools: Use the indicator alongside other technical analysis tools, such as support/resistance levels, RSI, moving averages, or Fair Value Gaps (FVG), to confirm signals.
█ APPLICATIONS
Price Action Trading: Large signal candles can indicate key market moments, such as breakouts of support/resistance levels or strong price rejections. Use signal candles in conjunction with support/resistance levels or FVG to identify entry opportunities. Retracement lines help set Stop Loss levels (e.g., below the line for bullish candles, above for bearish) or delayed entries after price returns to the retracement level and confirms trend continuation. Note that large candles often generate Fair Value Gaps (FVG), which should be considered when setting Stop Loss levels.
Trend Strategies: Enable the trend filter to limit signals to those aligned with the dominant market direction. For example, in an uptrend, look for large bullish candles as continuation signals. The indicator can also be used for position pyramiding, adding positions as subsequent large candles confirm trend continuation.
Practical Approach:
Large candles with high volume may indicate strong market participation, increasing signal reliability.
The trend line helps visually assess market direction and confirm large candle signals.
Retracement lines on signal candles aid in identifying key levels for Stop Loss or delayed entries.
█ NOTES
The indicator works across all markets and timeframes due to its universal logic based on candle body size and relative positioning.
Adjust settings (e.g., trend period, large candle multiplier, retracement level) to suit your trading style and timeframe.
Test the indicator on various markets (stocks, forex, cryptocurrencies) and timeframes to optimize its performance.
Use in conjunction with other technical analysis tools to enhance signal accuracy.
Bias + VWAP Pullback — v4 (PA + BOS/CHOCH)Simple idea: I identify the trend (bias) from the larger timeframe, and only trade pullbacks to the VWAP/EMA during liquidity (London/New York). When the trend is clear, gold moves strongly, and its pullbacks to the balance lines provide clear opportunities.
Timeframe and Sessions (Cairo Time)
Analysis: H1 to determine the trend.
Implementation: 5m (or 1m if professional).
Trading window:
London Opening: 10:00–12:30
New York Opening: 16:30–19:00
(avoid the rest of the day unless there is exceptional traffic).
Direction determination (BIAS)
On H1:
If the price is above the 200 EMA and the daily VWAP is bullish and the price is above it → uptrend (long-only).
If the price is below the 200 EMA and the daily VWAP is bearish and the price is below it → bearish trend (short-only).
Determine your levels: yesterday's high/low (PDH/PDL) + approximate Asia range (03:00–09:30).
Entry Rules (Setup A: Trend Continuation)
Asia range breakout towards Bias during liquidity window.
Wait for a withdrawal to:
Daily VWAP, or
EMA50 on 5m frame (best if both cross).
Confirmation: Confirmation low/high on 5m (HL buy/LH sell) + clear impulse candle (Body is greater than average of last 10 candles).
Entry:
Buy: When the price returns above VWAP/EMA50 with a confirmation candle close.
Sell: The exact opposite.
Stop Loss (SL): Below/above the last confirmation low/high or ATR(14, 5m) x 1.5 (largest).
Objectives:
TP1 = 1R (Close 50% and move the rest Break-even).
TP2 = 2.5R to 3R or at an important HTF level (PDH/PDL/Bid/Demand Zone).
Entry Rules (Setup B: Reversion to VWAP – “Mean Reversion”)
Use with extreme caution, once daily maximum:
Price deviation from VWAP by more than ~1.5 x ATR(14, 5m) with rejection candles appearing near PDH/PDL.
Reverse entry towards the return of VWAP.
SL small behind rejection top/bottom.
Main target: VWAP. (Don't get greedy — this scenario is for extended periods only.)
News Filtering and Risk Management
Avoid trading 15–30 minutes before/after strong US news (CPI, NFP, FOMC).
Maximum daily loss: 1.5–2% of account balance.
Risk per trade: 0.25–0.5% (if you are learning) or 0.5–1% (if you are experienced).
Do not exceed two consecutive losing trades per day.
Don't chase the market after the opportunity has passed — wait for the next pullback.
Smart Deal Management
After TP1: Move stop to entry point + trail the rest with EMA20 on 5m or ATR Trailing = ATR(14)×1.0.
If the price touches a strong daily level (PDH/PDL) and fails to break, consider taking additional profit.
If VWAP starts to flatten and breaks against the trend on H1, stop trading for the day.
Quick Checklist (Before Entry)
H1 trend is clear and consistent with 200EMA + VWAP.
Penetrating the Asia range towards Bias.
Clean pull to VWAP/EMA50 on 5m.
Confirmation candle and real push.
SL is logical (behind swing/ATR×1.5) and R :R ≥ 1:2.
No red news coming soon.
Example of "ready-made" settings
EMA: 20, 50, 200 on 5m, 200 only on H1.
VWAP: Daily (reset daily).
ATR: 14 on 5m.
Levels: PDH/PDL + Asia Band (03:00–09:30 Cairo).
Gold Notes
Gold is fast and sharp at the open; don't get in early — wait for the draw.
Fakeouts are common before news: it is best to call with the trend after the price returns above/below VWAP.
Don't expect 80% consistent wins every day — the advantage comes from discipline, filtering out bad days, and only withdrawing when you're on the right track.
تعتبر شركة الماسة الألمانية أحد المؤسسات العاملة بالمملكة العربية السعودية ولها تاريخ طويل من الخدمات الكثيرة والمتنوعة التى مازالت تقدمها للكثير من العملاء داخل جميع مدن وأحياء المملكة حيث نقدم أفضل ما لدينا من خلال مجموعة الشركات التالية والتي من خلالها ستتلقي كل ما تحتاج إلية في كل المجال المختلفة فنحن نعمل منذ عام 2015 ولنا سابقات اعمال فى مختلف المجالات الحيوية التى نخدم من خلالها عملائنا ونوفر لهم أرخص الأسعار وبأعلى جودة من الممكن توفرها فى المجالات التالية :-
خدمات تنظيف المنازل والفلل والشقق
خدمات عزل الخزانات تنظيف غسيل صيانة اصلاح
خدمات جلي البلاط والرخام والسيراميك
خدمات نقل العفش عمالة فلبينية مدربة
خدمات مكافحة الحشرات بجدة
كل هذة الخدمات وأكثر نوفرها لكل المتعاقدين بأفضل الطرق مع توفير خطط وبرامج متنوعة لأتمام العمل المسنود إلينا بأفضل وأحدث الطرق الحديثة والعصرية سواء فى شركات النظافة بجدة ومكة المكرمة أو شركات نقل العفش بجدة عمالة فلبينية وباقى الخدمات مثل جلي وتلميع الرخام بمكة وجدة ولا ننسي شركة مكافحة حشرات بجدة التى ساعدت آلاف المواطنين على تنظيف منازلهم من الحشرات بأفضل مبيدات حشرية.
さくらんぼーいⅢSakuranboi III — Indicator Description (English)
Overview
Sakuranboi III visualizes market “trajectory” and timing using an ATR-based Light-Cone projected from a user-defined Anchor (bar & price) and a set of √n convergence stripes placed at quadratic time intervals.
A compact Bias Panel aggregates five independent signals—HTF trend, cone position (z), rail-hug, first fractal inside a stripe, and a simple structure break—into a Bias Score to quickly read UP / DOWN / NEUTRAL conditions.
Key Features
Anchor-driven Light-Cone
Growth modes: Linear n or Diffusive √n.
Height: ATR × multiplier (from Close or Wick range).
Upper / lower cone edges are drawn as infinitely extended diagonal lines.
Optional 0.5c / 1.5c guide lines for mid/outer bands.
√n Convergence Stripes
Stripe centers at anchorBar + stepBars * m² (m = 1..Max M).
Stripe width controlled by halfWindow (center ± halfWindow bars).
Optional vertical center lines (visual aid only).
Fractal Detection
Pivot High/Low (PH/PL) hits inside stripes are counted.
m² Hit Table shows counts per stripe order (PH▲ / PL▼).
Bias Panel (5 cards, ±1 each)
HTF Trend (EMA Fast vs EMA Slow, on a selectable higher timeframe).
Cone z: relative position
z = (Close − AnchorPrice) / (cone height at current distance).
Rail-Hug: ratio of bars touching the 0.5c–1.0c band (upper vs lower).
First Fractal in Stripe after entering a stripe (first PL → +1, first PH → −1).
Structure Break: takeout of recent PH (↑) or PL (↓).
Alerts
Bias UP (score ≥ +3) / Bias DOWN (score ≤ −3).
Fractal High in Convergence / Fractal Low in Convergence.
How to Use
Set the Anchor
Choose Anchor Mode = Time or Bars Ago and select the Anchor Price source (Close/High/Low/Open/Manual).
Shape the Cone
Adjust ATR Length, optional ATR Timeframe, Multiplier, and Growth Mode.
Diffusive √n emphasizes diffusion-like growth.
Linear n gives straight, linear expansion.
Tune Stripes (Time Resonance)
stepBars controls spacing of m² centers.
Max Order M controls how many stripes to draw.
halfWindow controls stripe thickness.
Turn Draw Stripe Center Lines on if you want the exact centers.
Read the Bias Panel
Use +3 or higher → UP, −3 or lower → DOWN as a quick filter.
Set HTF timeframe to your higher-timeframe context (e.g., 15m).
Configure Alerts for your workflow (Bias UP/DOWN, PH/PL in stripe).
Inputs (Highlights)
Anchor (shared): Mode, Time, BarsAgo, Price Mode, Manual Price.
Light-Cone ATR: ATR Length / Timeframe / Horizon / Growth Mode / Multiplier / Height source / Colors.
Guides (0.5c / 1.5c): show/hide, colors, width.
Convergence (√n stripes): stepBars / Max Order M / halfWindow / color / center lines.
Fractal: Left/Right sensitivity for pivots.
Display / Limits: Hit table on/off, screen trimming, past/future draw limits.
Bias Panel: HTF timeframe, EMA Fast/Slow, z threshold, Rail lookback & ratio.
Bias Score Details
HTF Trend: EMA(fast) > EMA(slow) → +1; EMA(fast) < EMA(slow) → −1.
Cone z: z > +threshold → +1; z < −threshold → −1.
Rail-Hug (last N bars):
Upper band (0.5c–1.0c) touch ratio dominant → +1;
Lower band dominant → −1.
First Fractal in Stripe (after entry): PL → +1, PH → −1.
Structure Break: break above recent PH → +1; break below recent PL → −1.
Total: ≥ +3 → UP, ≤ −3 → DOWN, otherwise NEUTRAL.
Alerts
Bias UP — when Bias score >= +3.
Bias DOWN — when Bias score <= -3.
Fractal High in Convergence — PH detected inside a stripe.
Fractal Low in Convergence — PL detected inside a stripe.
Recommended Presets
Scalp / Short-term:
ATR TF = same, Growth = Diffusive √n, Mult = 1.0–1.5,
stepBars = 15–30, halfWindow = 1–2.
Swing:
ATR TF = higher TF, Growth = Linear n, Mult = 1.5–2.5,
stepBars = 60–120, halfWindow = 2–4.
Notes & Limits
Cone edges and guides are drawn as infinitely extended diagonals; the cone fill is rendered between upper/lower edges.
Future plotting respects TradingView’s cap (default max ~500 future bars); governed by futureLimitBars.
Script uses max_bars_back = 5000 and guarded indexing to avoid historical-buffer errors.
If performance is heavy, reduce Max Order M, screenPastBars, or hide the hit table.
Disclaimer
This script is for research and educational purposes only and does not constitute financial advice. Market behavior varies by symbol and timeframe; please backtest and adjust parameters to your own risk tolerance. The author assumes no responsibility for any outcomes.
Multi-Timeframe Candle Color Dashboard (ฺBy WutTrader)// This description should be added to the script's information section on TradingView.
//
// === คู่มือการใช้งาน: Multi-Timeframe Candle Color Dashboard ===
//
// **ภาพรวม:**
// อินดิเคเตอร์นี้แสดงสีของแท่งเทียนจากหลายไทม์เฟรม (M1, M5, M15, M30, H1, H4, D1) บนหน้าจอเดียว
// เพื่อช่วยให้คุณเห็นภาพรวมของแนวโน้มในแต่ละช่วงเวลาได้อย่างรวดเร็ว
//
// - **🟢 สีเขียว:** แสดงว่าแท่งเทียนเป็นขาขึ้น (Bullish) ตามจำนวนแท่งที่กำหนด
// - **🔴 สีแดง:** แสดงว่าแท่งเทียนเป็นขาลง (Bearish) ตามจำนวนแท่งที่กำหนด
// - **⚪ สีเทา:** แสดงว่ายังไม่มีทิศทางที่ชัดเจน
//
// **วิธีการใช้งาน:**
// 1. **การดูสัญญาณ:** ใช้ Dashboard เพื่อยืนยันว่าหลายไทม์เฟรมมีแนวโน้มไปในทิศทางเดียวกัน
// - **ตัวอย่าง:** หากคุณกำลังดูชาร์ต M5 แล้วพบว่า M15, M30 และ H1 เป็นสีเขียวทั้งหมด
// แสดงว่ามีแนวโน้มขาขึ้นที่แข็งแกร่งในภาพรวม ซึ่งอาจเป็นจังหวะที่ดีสำหรับการเข้าซื้อ
// 2. **การตั้งค่า:** คุณสามารถปรับแต่งการแสดงผลได้ในเมนู "Settings"
// - **Global Settings:** เลือกเปิด/ปิดการแสดงผลของแต่ละไทม์เฟรมที่คุณต้องการ
// - **Dashboard Style:** เลือกว่าจะให้ Dashboard แสดงผลเป็นแนวตั้ง (Vertical) หรือแนวนอน (Horizontal)
// - **Color Settings:** ปรับสีสำหรับแนวโน้มขาขึ้น (Bullish) และขาลง (Bearish) ได้ตามใจชอบ
//
// **การตั้งค่าการแจ้งเตือน (Alert):**
// อินดิเคเตอร์นี้รองรับการแจ้งเตือนเมื่อทุกไทม์เฟรมที่คุณเปิดใช้งานเป็นสีเขียวทั้งหมด
// 1. ไปที่เมนู "Alert" (รูปกระดิ่ง) ที่ด้านบนของ TradingView
// 2. ตั้งค่า "Condition" เป็นชื่ออินดิเคเตอร์นี้: `Multi-Timeframe Candle Color Dashboard`
// 3. ตั้งค่า "Condition" เป็น `Bullish Alert`
// 4. ตั้งค่า "Frequency" เป็น `Once Per Bar Close`
//
// === User Manual: Multi-Timeframe Candle Color Dashboard ===
//
// **Overview:**
// This indicator displays the candle color from multiple timeframes (M1, M5, M15, M30, H1, H4, D1) on a single screen,
// helping you to quickly see the trend direction across different time periods.
//
// - **🟢 Green:** Indicates that candles are bullish for the specified number of lookback bars.
// - **🔴 Red:** Indicates that candles are bearish for the specified number of lookback bars.
// - **⚪ Gray:** Indicates a neutral or undefined trend.
//
// **How to Use:**
// 1. **Signal Confirmation:** Use the dashboard to confirm that multiple timeframes are moving in the same direction.
// - **Example:** If you are on an M5 chart and see that the M15, M30, and H1 timeframes are all green,
// it suggests a strong overall bullish momentum, which could be a good entry signal.
// 2. **Settings:** You can customize the display in the "Settings" menu.
// - **Global Settings:** Select which timeframes you want to show or hide.
// - **Dashboard Style:** Choose between a vertical or horizontal layout for the dashboard.
// - **Color Settings:** Adjust the colors for bullish and bearish trends to your preference.
//
// **Setting up an Alert:**
// This indicator supports an alert when all enabled timeframes turn completely green.
// 1. Go to the "Alert" menu (bell icon) at the top of TradingView.
// 2. Set the "Condition" to the name of this indicator: `Multi-Timeframe Candle Color Dashboard`.
// 3. Set the "Condition" to `Bullish Alert`.
// 4. Set the "Frequency" to `Once Per Bar Close`.
Chanpreet Moving AveragesChanpreet Moving Averages
by Chanpreet Singh
This script plots up to four customizable moving averages (SMA, EMA, SMMA/RMA, WMA, VWMA).
You can adjust:
Moving average type
Source (close, open, hl2, etc.)
Length
Color
An optional input lets you select a higher or custom timeframe for the moving averages (e.g., daily MA on a 1-hour chart). If left empty, the script calculates them on the current chart timeframe, so the lines scale and move naturally when zooming or panning.
This tool is designed for educational and visualization purposes, helping traders see trend direction and potential areas of dynamic support/resistance.
⚠️ Disclaimer: This script does not provide financial advice or trading signals. Use it at your own risk. Always do your own research before making trading decisions.