Specter Trend Cloud [ChartPrime]⯁ OVERVIEW
Specter Trend Cloud is a flexible moving-average–based trend tool that builds a colored “cloud” around market direction and highlights key retest opportunities. Using two adaptive MAs (short vs. long), offset by ATR for volatility adjustment, it shades the background with a gradient cloud that switches color on trend flips. When price pulls back to retest the short MA during an active trend, the script plots diamond markers and extends dotted levels from that retest price. If price later breaks through that level, the extension is terminated—giving traders a clean visual of valid vs. invalid retests.
⯁ KEY FEATURES
Multi-MA Core Engine:
Choose from SMA, EMA, SMMA (RMA), WMA, or VWMA as the base. The indicator tracks both a short-term MA (Length) and a longer twin (2 × Length).
Volatility-Adjusted Offset:
Both MAs are shifted by ATR(200) depending on trend direction—pulling them down in uptrends, up in downtrends—so the cloud reflects realistic breathing room instead of razor-thin bands.
Gradient Trend Cloud:
Between the two shifted MAs, the script fills a shaded region:
• Aqua cloud = bullish trend
• Orange cloud = bearish trend
Gradient intensity increases toward the active edge, providing a visual sense of strength.
Trend Flip Logic:
A flip occurs whenever the short MA crosses above or below the long MA. The cloud instantly changes color and begins tracking the new regime.
Retest Detection:
During an ongoing trend (no flip), if price retests the short MA within a 5-bar “cooldown,” the tool:
• Marks the retest with diamond shapes below/above the bar.
• Draws a dotted horizontal line from the retest price, extending into the future.
Automatic Level Termination:
If price later closes through that dotted level, the line disappears—keeping only active, respected retest levels on your chart.
⯁ HOW IT WORKS (UNDER THE HOOD)
MA Calculations:
ma1 = MA(src, Length), ma2 = MA(src, 2 × Length).
Trend = ma1 > ma2 (bull) or ma1 < ma2 (bear).
ATR shift offsets both ma1 and ma2 by ±ATR depending on trend.
Cloud Fill:
Plots ma1 and ma2 (invisible for long MA). Uses fill() with semi-transparent aqua/orange gradient between the two.
Retest Logic:
• Bullish retest: ta.crossover(low, ma1) while trend = bull.
• Bearish retest: ta.crossunder(high, ma1) while trend = bear.
Only valid if at least 5 bars have passed since last retest.
When triggered, it stores bar index and price, draws diamonds, and extends a dotted line.
Level Clearing:
If current high > retest upper line (bearish case) or low < retest lower line (bullish case), that line is deleted (stops extending).
⯁ USAGE
Use the cloud color as the higher-level trend bias (aqua = long, orange = short).
Look for diamonds + dotted lines as pullback/retest zones where trend continuation may launch.
If a retest level holds and price rebounds, it strengthens confidence in the trend.
If a retest level is broken, treat it as a warning of weakening trend or possible reversal.
Experiment with MA Type (SMA vs. EMA, etc.) to align sensitivity with your asset or timeframe.
Adjust Length for faster flips on low timeframes or smoother signals on higher ones.
⯁ CONCLUSION
Specter Trend Cloud combines trend detection, volatility-adjusted shading, and retest visualization into a single tool. The gradient cloud provides instant clarity on direction, while diamonds and dotted retest levels give you tactical entry/retest zones that self-clean when invalidated. It’s a versatile trend-following and confirmation layer, adaptable across multiple assets and styles.
指标和策略
SuperSmoother MA OscillatorSuperSmoother MA Oscillator - Ehlers-Inspired Lag-Minimized Signal Framework
Overview
The SuperSmoother MA Oscillator is a crossover and momentum detection framework built on the pioneering work of John F. Ehlers, who introduced digital signal processing (DSP) concepts into technical analysis. Traditional moving averages such as SMA and EMA are prone to two persistent flaws: excessive lag, which delays recognition of trend shifts, and high-frequency noise, which produces unreliable whipsaw signals. Ehlers’ SuperSmoother filter was designed to specifically address these flaws by creating a low-pass filter with minimal lag and superior noise suppression, inspired by engineering methods used in communications and radar systems.
This oscillator extends Ehlers’ foundation by combining the SuperSmoother filter with multi-length moving average oscillation, ATR-based normalization, and dynamic color coding. The result is a tool that helps traders identify market momentum, detect reliable crossovers earlier than conventional methods, and contextualize volatility and phase shifts without being distracted by transient price noise.
Unlike conventional oscillators, which either oversimplify price structure or overload the chart with reactive signals, the SuperSmoother MA Oscillator is designed to balance responsiveness and stability. By preprocessing price data with the SuperSmoother filter, traders gain a signal framework that is clean, robust, and adaptable across assets and timeframes.
Theoretical Foundation
Traditional MA oscillators such as MACD or dual-EMA systems react to raw or lightly smoothed price inputs. While effective in some conditions, these signals are often distorted by high-frequency oscillations inherent in market data, leading to false crossovers and poor timing. The SuperSmoother approach modifies this dynamic: by attenuating unwanted frequencies, it preserves structural price movements while eliminating meaningless noise.
This is particularly useful for traders who need to distinguish between genuine market cycles and random short-term price flickers. In practical terms, the oscillator helps identify:
Early trend continuations (when fast averages break cleanly above/below slower averages).
Preemptive breakout setups (when compressed oscillator ranges expand).
Exhaustion phases (when oscillator swings flatten despite continued price movement).
Its multi-purpose design allows traders to apply it flexibly across scalping, day trading, swing setups, and longer-term trend positioning, without needing separate tools for each.
The oscillator’s visual system - fast/slow lines, dynamic coloration, and zero-line crossovers - is structured to provide trend clarity without hiding nuance. Strong green/red momentum confirms directional conviction, while neutral gray phases emphasize uncertainty or low conviction. This ensures traders can quickly gauge the market state without losing access to subtle structural signals.
How It Works
The SuperSmoother MA Oscillator builds signals through a layered process:
SuperSmoother Filtering (Ehlers’ Method)
At its core lies Ehlers’ two-pole recursive filter, mathematically engineered to suppress high-frequency components while introducing minimal lag. Compared to traditional EMA smoothing, the SuperSmoother achieves better spectral separation - it allows meaningful cyclical market structures to pass through, while eliminating erratic spikes and aliasing. This makes it a superior preprocessing stage for oscillator inputs.
Fast and Slow Line Construction
Within the oscillator framework, the filtered price series is used to build two internal moving averages: a fast line (short-term momentum) and a slow line (longer-term directional bias). These are not plotted directly on the chart - instead, their relationship is transformed into the oscillator values you see.
The interaction between these two internal averages - crossovers, separation, and compression - forms the backbone of trend detection:
Uptrend Signal : Fast MA rises above the slow MA with expanding distance, generating a positive oscillator swing.
Downtrend Signal : Fast MA falls below the slow MA with widening divergence, producing a negative oscillator swing.
Neutral/Transition : Lines compress, flattening the oscillator near zero and often preceding volatility expansion.
This design ensures traders receive the information content of dual-MA crossovers while keeping the chart visually clean and focused on the oscillator’s dynamics.
ATR-Based Normalization
Markets vary in volatility. To ensure the oscillator behaves consistently across assets, ATR (Average True Range) normalization scales outputs relative to prevailing volatility conditions. This prevents the oscillator from appearing overly sensitive in calm markets or too flat during high-volatility regimes.
Dynamic Color Coding
Color transitions reflect underlying market states:
Strong Green : Bullish alignment, momentum expanding.
Strong Red : Bearish alignment, momentum expanding.
These visual cues allow traders to quickly gauge trend direction and strength at a glance, with expanding colors indicating increasing conviction in the underlying momentum.
Interpretation
The oscillator offers a multi-dimensional view of price dynamics:
Trend Analysis : Fast/slow line alignment and zero-line interactions reveal trend direction and strength. Expansions indicate momentum building; contractions flag weakening conditions or potential reversals.
Momentum & Volatility : Rapid divergence between lines reflects increasing momentum. Compression highlights periods of reduced volatility and possible upcoming expansion.
Cycle Awareness : Because of Ehlers’ DSP foundation, the oscillator captures market cycles more cleanly than conventional MA systems, allowing traders to anticipate turning points before raw price action confirms them.
Divergence Detection : When oscillator momentum fades while price continues in the same direction, it signals exhaustion - a cue to tighten stops or anticipate reversals.
By focusing on filtered, volatility-adjusted signals, traders avoid overreacting to noise while gaining early access to structural changes in momentum.
Strategy Integration
The SuperSmoother MA Oscillator adapts across multiple trading approaches:
Trend Following
Enter when fast/slow alignment is strong and expanding:
A fast line crossing above the slow line with expanding green signals confirms bullish continuation.
Use ATR-normalized expansion to filter entries in line with prevailing volatility.
Breakout Trading
Periods of compression often precede breakouts:
A breakout occurs when fast lines diverge decisively from slow lines with renewed green/red strength.
Exhaustion and Reversals
Oscillator divergence signals weakening trends:
Flattening momentum while price continues trending may indicate overextension.
Traders can exit or hedge positions in anticipation of corrective phases.
Multi-Timeframe Confluence
Apply the oscillator on higher timeframes to confirm the directional bias.
Use lower timeframes for refined entries during compression → expansion transitions.
Technical Implementation Details
SuperSmoother Algorithm (Ehlers) : Recursive two-pole filter minimizes lag while removing high-frequency noise.
Oscillator Framework : Fast/slow MAs derived from filtered prices.
ATR Normalization : Ensures consistent amplitude across market regimes.
Dynamic Color Engine : Aligns visual cues with structural states (expansion and contraction).
Multi-Factor Analysis : Combines crossover logic, volatility context, and cycle detection for robust outputs.
This layered approach ensures the oscillator is highly responsive without overloading charts with noise.
Optimal Application Parameters
Asset-Specific Guidance:
Forex : Normalize with moderate ATR scaling; focus on slow-line confirmation.
Equities : Balance responsiveness with smoothing; useful for capturing sector rotations.
Cryptocurrency : Higher ATR multipliers recommended due to volatility.
Futures/Indices : Lower frequency settings highlight structural trends.
Timeframe Optimization:
Scalping (1-5min) : Higher sensitivity, prioritize fast-line signals.
Intraday (15m-1h) : Balance between fast/slow expansions.
Swing (4h-Daily) : Focus on slow-line momentum with fast-line timing.
Position (Daily-Weekly) : Slow lines dominate; fast lines highlight cycle shifts.
Performance Characteristics
High Effectiveness:
Trending environments with moderate-to-high volatility.
Assets with steady liquidity and clear cyclical structures.
Reduced Effectiveness:
Flat/choppy conditions with little directional bias.
Ultra-short timeframes (<1m), where noise dominates.
Integration Guidelines
Confluence : Combine with liquidity zones, order blocks, and volume-based indicators for confirmation.
Risk Management : Place stops beyond slow-line thresholds or ATR-defined zones.
Dynamic Trade Management : Use expansions/contractions to scale position sizes or tighten stops.
Multi-Timeframe Confirmation : Filter lower-timeframe entries with higher-timeframe momentum states.
Disclaimer
The SuperSmoother MA Oscillator is an advanced trend and momentum analysis tool, not a guaranteed profit system. Its effectiveness depends on proper parameter settings per asset and disciplined risk management. Traders should use it as part of a broader technical framework and not in isolation.
SFI MAGIC
// Join our channel for more free tools: t.me
//@version=5
indicator("SFI MAGIC", overlay=true, max_labels_count=500)
//------------------------------------------------------------------------------
// Input Settings
useBody = input(false, 'Use Candle Body')
signalMode = input.string('Simple Entry + Exits', 'Signal Strategy', , tooltip='Change Your Signal Appearance And Strategies')
sensitivity = input.float(2.3, "Sensitivity", 0.6, 15.1, step=0.1, tooltip='Change Your Signal Sensitivity And Accuracy')
strongSignalOnly = input(false, "STRONG Only", inline='BasicFilters')
noRepainting = input(false, 'No Repainting', inline='BasicFilters', tooltip='Disables all signals except strong signals Disables repainting for signals')
Multiplier = input.float(1.5, "ATR Multiplier", step=0.1)
align_with_supertrend = input.bool(false, "Align Signals with Supertrend", tooltip="Enable to align buy/sell signals with Supertrend direction")
//------------------------------------------------------------------------------
// ATR and Supertrend Calculation
atr = ta.atr(14)
st_atr_length = input.int(10, "Supertrend ATR Length", minval=1)
st_multiplier = input.float(3.0, "Supertrend Multiplier", step=0.1)
upper_band = ta.sma(close, st_atr_length) + st_multiplier * atr
lower_band = ta.sma(close, st_atr_length) - st_multiplier * atr
var float supertrend = na
supertrend := close > nz(supertrend ) ? math.max(lower_band, nz(supertrend )) : math.min(upper_band, nz(supertrend ))
supertrend_up = close > supertrend
supertrend_down = close < supertrend
//------------------------------------------------------------------------------
// Signal Logic
src = close
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x ), t)
smoothrng = ta.ema(avrng, wper) * m
smoothrng
smrng = smoothrng(close, 100, sensitivity)
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt ) ? x - r < nz(rngfilt ) ? nz(rngfilt ) : x - r : x + r > nz(rngfilt ) ? nz(rngfilt ) : x + r
rngfilt
filt = rngfilt(src, smrng)
var float upward = na
var float downward = na
var int CondIni = na
upward := filt > filt ? nz(upward ) + 1 : filt < filt ? 0 : nz(upward )
downward := filt < filt ? nz(downward ) + 1 : filt > filt ? 0 : nz(downward )
longCond = src > filt and src > src and upward > 0 or src > filt and src < src and upward > 0
shortCond = src < filt and src < src and downward > 0 or src < filt and src > src and downward > 0
CondIni := longCond ? 1 : shortCond ? -1 : nz(CondIni )
buyCond = longCond and CondIni == -1
strongBuyCond = buyCond and close <= filt - smrng
sellCond = shortCond and CondIni == 1
strongSellCond = sellCond and open >= filt + smrng
if noRepainting
buyCond := buyCond and barstate.isconfirmed
strongBuyCond := strongBuyCond and barstate.isconfirmed
sellCond := sellCond and barstate.isconfirmed
strongSellCond := strongSellCond and barstate.isconfirmed
//------------------------------------------------------------------------------
// Tradingview indicators. Join ->>> t.me
// -------------------- 👆👆👆👆👆👆 ---------------
//------------------------------------------------------------------------------
// ATR-Based Book Profit and Wait for Supertrend Break
var float buy_entry_price = na
var float sell_entry_price = na
var bool buy_profit_plotted = false
var bool sell_profit_plotted = false
if (buyCond or strongBuyCond)
buy_entry_price := close
buy_profit_plotted := false
if (sellCond or strongSellCond)
sell_entry_price := close
sell_profit_plotted := false
buy_target = buy_entry_price + (atr * Multiplier)
sell_target = sell_entry_price - (atr * Multiplier)
if (not na(buy_entry_price) and close >= buy_target and not buy_profit_plotted)
label.new(bar_index, high, "Book Profit", color=#00db0a, style=label.style_label_down, textcolor=color.white, size=size.normal)
buy_profit_plotted := true
label.new(bar_index, high - atr, "Wait for Supertrend to break", color=color.orange, style=label.style_label_down, textcolor=color.white, size=size.normal)
if (not na(sell_entry_price) and close <= sell_target and not sell_profit_plotted)
label.new(bar_index, low, "Book Profit", color=#ff0000, style=label.style_label_up, textcolor=color.white, size=size.normal)
sell_profit_plotted := true
label.new(bar_index, low + atr, "Wait for Supertrend to break", color=color.orange, style=label.style_label_up, textcolor=color.white, size=size.normal)
//------------------------------------------------------------------------------
// Candle Coloring
barcolor_cond = src > filt and upward > 0 ? color.new(#00db0a, 5) : src < filt and downward > 0 ? color.new(#c90505, 5) : na
barcolor(barcolor_cond, title='Candle Colors')
// Plot Signals
plotshape(buyCond and not strongSignalOnly, 'Buy', shape.labelup, location.belowbar, color.new(#21ff30, 0), size=size.small, textcolor=color.black, text='BUY')
plotshape(strongBuyCond, 'Strong Buy', shape.labelup, location.belowbar, color.new(#09ff00, 0), size=size.small, textcolor=color.black, text='BUY')
plotshape(sellCond and not strongSignalOnly, 'Sell', shape.labeldown, location.abovebar, color.new(#ff0000, 0), size=size.small, textcolor=color.black, text='SELL')
plotshape(strongSellCond, 'Strong Sell', shape.labeldown, location.abovebar, color.new(#ff0000, 0), size=size.small, textcolor=color.black, text='SELL')
// Supertrend Plot
plot(supertrend, color=supertrend_up ? color.green : color.red, title="Supertrend", linewidth=2)
// ==========================================================================================
// === Dashboard with Telegram Link ===
var table myTable = table.new(position.top_center, 1, 1, border_width=1, frame_color=color.black, bgcolor=color.white)
// Add Telegram Message to Dashboard
table.cell(myTable, 0, 0, "Join Telegram @mrexpert_ai", bgcolor=color.blue, text_color=color.white, text_size=size.normal)
Mean Reversion Probability Zones [BigBeluga]🔵 OVERVIEW
The Mean Reversion Probability Zones indicator measures the likelihood of price reverting back toward its mean . By analyzing oscillator dynamics (RSI, MFI, or Stochastic), it calculates probability zones both above and below the oscillator. These zones are visualized as histograms, colored regions on the main chart, and a compact dashboard, helping traders spot when the market is statistically stretched and more likely to revert.
🔵 CONCEPTS
Mean Reversion : The tendency of price to return to its average after significant extensions.
Oscillator-Based Analysis : Uses RSI, MFI, or Stochastic as the base signal for detecting overextension.
Probability Model : The probability of reversion is computed using three factors:
Whether the oscillator is rising or declining.
Whether the oscillator is above or below user-defined thresholds.
The oscillator’s actual value (distance from equilibrium).
Dual-Zone Output :
Upper histogram = probability of downward mean reversion.
Lower histogram = probability of upward mean reversion.
Historical Extremes : The dashboard highlights the recent maximum probability values for both upward and downward scenarios.
🔵 FEATURES
Oscillator Choice : Switch between RSI, MFI, and Stochastic.
Customizable Zones : User-defined upper/lower thresholds with independent colors.
Probability Histograms :
Above oscillator → down reversion probability.
Below oscillator → up reversion probability.
Colored Gradient Zones on Chart : Visual overlays showing where mean reversion probabilities are strongest.
Probability Labels : Percentages displayed next to histogram values for clarity.
Dashboard : Compact table in the corner showing the recent maximum probabilities for both upward and downward mean reversion.
Overlay Compatibility : Works in both chart pane and sub-pane with oscillators.
🔵 HOW TO USE
Set Oscillator : Choose RSI, MFI, or Stochastic depending on your strategy style.
Adjust Zones : Define upper/lower bounds for when oscillator values indicate strong overbought/oversold conditions.
Interpret Histograms :
Orange (upper) histogram → higher chance of a pullback/downward mean reversion.
Green (lower) histogram → higher chance of upward reversion/bounce.
Watch Gradient Zones : On the main chart, shaded areas highlight where probability of mean reversion is elevated.
Consult Dashboard : Use the “Recent MAX” values to understand how strong recent reversion probabilities have been in either direction.
Confluence Strategy : Combine with support/resistance, order flow, or trend filters to avoid counter-trend trades.
🔵 CONCLUSION
The Mean Reversion Probability Zones provides traders with an advanced way to quantify and visualize mean reversion opportunities. By blending oscillator momentum, threshold logic, and probability calculations, it highlights when markets are statistically stretched and primed for reversal. Whether you are a contrarian trader or simply looking for exhaustion signals to fade, this tool helps bring structure and clarity to mean reversion setups.
Combined Cluster & Market StructureI barrowed code from the Mxwll Price Action Suite script as appreciated the structure in which the script defined structure, however I renamed variables and reduced the original script to define only the outer structure. I added volume and CVD clustering to define ranges and initiation market structures and add the ADX to assist with determining trend strength prior to labeling market structure breaks.
Combined Cluster & Market Structure indicator, a powerful and comprehensive tool for technical analysis. This script integrates two core concepts to provide a holistic view of market dynamics:
Z-Score Clustering & Volume Analysis: The indicator calculates Z-scores for both volume and Cumulative Volume Delta (CVD) to categorize market activity into six distinct clusters:
High-Conviction Bullish/Bearish: Signals of strong directional momentum based on high volume and corresponding CVD.
Effort vs. Result: High volume with moderate CVD, suggesting potential indecision or absorption.
Quiet Accumulation/Distribution: Low-volume periods with strong CVD, often preceding major moves.
Low Conviction/Noise: Represents periods of low market participation and weak signals.
These clusters are visually marked on the chart to provide real-time insight into market sentiment.
Market Structure Mapping: The indicator automatically detects and labels significant structural points to help you navigate price action. It identifies:
Higher Highs (HH) and Lower Lows (LL) to show the primary trend direction.
Breaks of Structure (BoS), indicating trend continuation.
Changes of Character (CHoCH), signaling a potential trend reversal.
Additionally, the script features consolidation box detection, which automatically highlights periods of low-conviction market activity, helping you avoid choppy, sideways markets. An integrated ADX filter ensures that structural breaks are only labeled during periods of strong trend strength, reducing false signals.
I want to thank Mxwll Capital for their contribution to the Combined Cluster & Market Structure indicator.
Guardeer//@version=5
indicator("Guardeer", shorttitle = "Guardeer", overlay = true, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 500, max_bars_back = 500, max_polylines_count = 100)
//-----------------------------------------------------------------------------{
//Boolean set
//-----------------------------------------------------------------------------{
s_BOS = 0
s_CHoCH = 1
i_BOS = 2
i_CHoCH = 3
i_pp_CHoCH = 4
green_candle = 5
red_candle = 6
s_CHoCHP = 7
i_CHoCHP = 8
boolean =
array.from(
false
, false
, false
, false
, false
, false
, false
, false
, false
)
//-----------------------------------------------------------------------------{
// User inputs
//-----------------------------------------------------------------------------{
show_swing_ms = input.string ("All" , "Swing " , inline = "1", group = "MARKET STRUCTURE" , options = )
show_internal_ms = input.string ("All" , "Internal " , inline = "2", group = "MARKET STRUCTURE" , options = )
internal_r_lookback = input.int (5 , "" , inline = "2", group = "MARKET STRUCTURE" , minval = 2)
swing_r_lookback = input.int (50 , "" , inline = "1", group = "MARKET STRUCTURE" , minval = 2)
ms_mode = input.string ("Manual" , "Market Structure Mode" , inline = "a", group = "MARKET STRUCTURE" , tooltip = " Use selected lenght Use automatic lenght" ,options = )
show_mtf_str = input.bool (true , "MTF Scanner" , inline = "9", group = "MARKET STRUCTURE" , tooltip = "Display Multi-Timeframe Market Structure Trend Directions. Green = Bullish. Red = Bearish")
show_eql = input.bool (false , "Show EQH/EQL" , inline = "6", group = "MARKET STRUCTURE")
plotcandle_bool = input.bool (false , "Plotcandle" , inline = "3", group = "MARKET STRUCTURE" , tooltip = "Displays a cleaner colored candlestick chart in place of the default candles. (requires hiding the current ticker candles)")
barcolor_bool = input.bool (false , "Bar Color" , inline = "4", group = "MARKET STRUCTURE" , tooltip = "Color the candle bodies according to market strucutre trend")
i_ms_up_BOS = input.color (#089981 , "" , inline = "2", group = "MARKET STRUCTURE")
i_ms_dn_BOS = input.color (#f23645 , "" , inline = "2", group = "MARKET STRUCTURE")
s_ms_up_BOS = input.color (#089981 , "" , inline = "1", group = "MARKET STRUCTURE")
s_ms_dn_BOS = input.color (#f23645 , "" , inline = "1", group = "MARKET STRUCTURE")
lvl_daily = input.bool (false , "Day " , inline = "1", group = "HIGHS & LOWS MTF")
lvl_weekly = input.bool (false , "Week " , inline = "2", group = "HIGHS & LOWS MTF")
lvl_monthly = input.bool (false , "Month" , inline = "3", group = "HIGHS & LOWS MTF")
lvl_yearly = input.bool (false , "Year " , inline = "4", group = "HIGHS & LOWS MTF")
css_d = input.color (color.blue , "" , inline = "1", group = "HIGHS & LOWS MTF")
css_w = input.color (color.blue , "" , inline = "2", group = "HIGHS & LOWS MTF")
css_m = input.color (color.blue , "" , inline = "3", group = "HIGHS & LOWS MTF")
css_y = input.color (color.blue , "" , inline = "4", group = "HIGHS & LOWS MTF")
s_d = input.string ('⎯⎯⎯' , '' , inline = '1', group = 'HIGHS & LOWS MTF' , options = )
s_w = input.string ('⎯⎯⎯' , '' , inline = '2', group = 'HIGHS & LOWS MTF' , options = )
s_m = input.string ('⎯⎯⎯' , '' , inline = '3', group = 'HIGHS & LOWS MTF' , options = )
s_y = input.string ('⎯⎯⎯' , '' , inline = '4', group = 'HIGHS & LOWS MTF' , options = )
ob_show = input.bool (true , "Show Last " , inline = "1", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display volumetric order blocks on the chart Ammount of volumetric order blocks to show")
ob_num = input.int (5 , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Orderblocks number", minval = 1, maxval = 10)
ob_metrics_show = input.bool (true , "Internal Buy/Sell Activity" , inline = "2", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display volume metrics that have formed the orderblock")
css_metric_up = input.color (color.new(#089981, 50) , " " , inline = "2", group = "VOLUMETRIC ORDER BLOCKS")
css_metric_dn = input.color (color.new(#f23645 , 50) , "" , inline = "2", group = "VOLUMETRIC ORDER BLOCKS")
ob_swings = input.bool (false , "Swing Order Blocks" , inline = "a", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Display swing volumetric order blocks")
css_swing_up = input.color (color.new(color.gray , 90) , " " , inline = "a", group = "VOLUMETRIC ORDER BLOCKS")
css_swing_dn = input.color (color.new(color.silver, 90) , "" , inline = "a", group = "VOLUMETRIC ORDER BLOCKS")
ob_filter = input.string ("None" , "Filtering " , inline = "d", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Filter out volumetric order blocks by BOS/CHoCH/CHoCH+", options = )
ob_mitigation = input.string ("Absolute" , "Mitigation " , inline = "4", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Trigger to remove volumetric order blocks", options = )
ob_pos = input.string ("Precise" , "Positioning " , inline = "k", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Position of the Order Block Cover the whole candle Cover half candle Adjust to volatility Same as Accurate but more precise", options = )
use_grayscale = input.bool (false , "Grayscale" , inline = "6", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Use gray as basic order blocks color")
use_show_metric = input.bool (true , "Show Metrics" , inline = "7", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Show volume associated with the orderblock and his relevance")
use_middle_line = input.bool (true , "Show Middle-Line" , inline = "8", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Show mid-line order blocks")
use_overlap = input.bool (true , "Hide Overlap" , inline = "9", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = "Hide overlapping order blocks")
use_overlap_method = input.string ("Previous" , "Overlap Method " , inline = "Z", group = "VOLUMETRIC ORDER BLOCKS" , tooltip = " Preserve the most recent volumetric order blocks Preserve the previous volumetric order blocks", options = )
ob_bull_css = input.color (color.new(#089981 , 90) , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS")
ob_bear_css = input.color (color.new(#f23645 , 90) , "" , inline = "1", group = "VOLUMETRIC ORDER BLOCKS")
show_acc_dist_zone = input.bool (false , "" , inline = "1", group = "Accumulation And Distribution")
zone_mode = input.string ("Fast" , "" , inline = "1", group = "Accumulation And Distribution" , tooltip = " Find small zone pattern formation Find bigger zone pattern formation" ,options = )
acc_css = input.color (color.new(#089981 , 60) , "" , inline = "1", group = "Accumulation And Distribution")
dist_css = input.color (color.new(#f23645 , 60) , "" , inline = "1", group = "Accumulation And Distribution")
show_lbl = input.bool (true , "Show swing point" , inline = "1", group = "High and Low" , tooltip = "Display swing point")
show_mtb = input.bool (true , "Show High/Low/Equilibrium" , inline = "2", group = "High and Low" , tooltip = "Display Strong/Weak High And Low and Equilibrium")
toplvl = input.color (color.red , "Premium Zone " , inline = "3", group = "High and Low")
midlvl = input.color (color.gray , "Equilibrium Zone" , inline = "4", group = "High and Low")
btmlvl = input.color (#089981 , "Discount Zone " , inline = "5", group = "High and Low")
fvg_enable = input.bool (false , " " , inline = "1", group = "FAIR VALUE GAP" , tooltip = "Display fair value gap")
what_fvg = input.string ("FVG" , "" , inline = "1", group = "FAIR VALUE GAP" , tooltip = "Display fair value gap", options = )
fvg_num = input.int (5 , "Show Last " , inline = "1a", group = "FAIR VALUE GAP" , tooltip = "Number of fvg to show")
fvg_upcss = input.color (color.new(#089981, 80) , "" , inline = "1", group = "FAIR VALUE GAP")
fvg_dncss = input.color (color.new(color.red , 80) , "" , inline = "1", group = "FAIR VALUE GAP")
fvg_extend = input.int (10 , "Extend FVG" , inline = "2", group = "FAIR VALUE GAP" , tooltip = "Extend the display of the FVG.")
fvg_src = input.string ("Close" , "Mitigation " , inline = "3", group = "FAIR VALUE GAP" , tooltip = " Use the close of the body as trigger Use the extreme point of the body as trigger", options = )
fvg_tf = input.timeframe ("" , "Timeframe " , inline = "4", group = "FAIR VALUE GAP" , tooltip = "Timeframe of the fair value gap")
t = color.t (ob_bull_css)
invcol = color.new (color.white , 100)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - UDT }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
type bar
float o = open
float c = close
float h = high
float l = low
float v = volume
int n = bar_index
int t = time
type Zphl
line top
line bottom
label top_label
label bottom_label
bool stopcross
bool sbottomcross
bool itopcross
bool ibottomcross
string txtup
string txtdn
float topy
float bottomy
float topx
float bottomx
float tup
float tdn
int tupx
int tdnx
float itopy
float itopx
float ibottomy
float ibottomx
float uV
float dV
type FVG
box box
line ln
bool bull
float top
float btm
int left
int right
type ms
float p
int n
float l
type msDraw
int n
float p
color css
string txt
bool bull
type obC
float top
float btm
int left
float avg
float dV
float cV
int wM
int blVP
int brVP
int dir
float h
float l
int n
type obD
box ob
box eOB
box blB
box brB
line mL
type zone
chart.point points
float p
int c
int t
type hqlzone
box pbx
box ebx
box lbx
label plb
label elb
label lbl
type ehl
float pt
int t
float pb
int b
type pattern
string found = "None"
bool isfound = false
int period = 0
bool bull = false
type alerts
bool chochswing = false
bool chochplusswing = false
bool swingbos = false
bool chochplus = false
bool choch = false
bool bos = false
bool equal = false
bool ob = false
bool swingob = false
bool zone = false
bool fvg = false
bool obtouch = false
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - General Setup }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
bar b = bar.new()
var pattern p = pattern.new()
alerts blalert = alerts.new()
alerts bralert = alerts.new()
if p.isfound
p.period += 1
if p.period == 50
p.period := 0
p.found := "None"
p.isfound := false
p.bull := na
switch
b.c > b.o => boolean.set(green_candle, true)
b.c < b.o => boolean.set(red_candle , true)
f_zscore(src, lookback) =>
(src - ta.sma(src, lookback)) / ta.stdev(src, lookback)
var int iLen = internal_r_lookback
var int sLen = swing_r_lookback
vv = f_zscore(((close - close ) / close ) * 100,iLen)
if ms_mode == "Dynamic"
switch
vv >= 1.5 or vv <= -1.5 => iLen := 10
vv >= 1.6 or vv <= -1.6 => iLen := 9
vv >= 1.7 or vv <= -1.7 => iLen := 8
vv >= 1.8 or vv <= -1.8 => iLen := 7
vv >= 1.9 or vv <= -1.9 => iLen := 6
vv >= 2.0 or vv <= -2.0 => iLen := 5
=> iLen
var msline = array.new(0)
iH = ta.pivothigh(high, iLen, iLen)
sH = ta.pivothigh(high, sLen, sLen)
iL = ta.pivotlow (low , iLen, iLen)
sL = ta.pivotlow (low , sLen, sLen)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - ARRAYS }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
hl () =>
= request.security(syminfo.tickerid , 'D' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , 'W' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , 'M' , hl() , lookahead = barmerge.lookahead_on)
= request.security(syminfo.tickerid , '12M', hl() , lookahead = barmerge.lookahead_on)
lstyle(style) =>
out = switch style
'⎯⎯⎯' => line.style_solid
'----' => line.style_dashed
'····' => line.style_dotted
mtfphl(h, l ,tf ,css, pdhl_style) =>
var line hl = line.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, color = css
, style = lstyle(pdhl_style)
)
var line ll = line.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, color = css
, style = lstyle(pdhl_style)
)
var label lbl = label.new(
na
, na
, xloc = xloc.bar_time
, text = str.format('P{0}L', tf)
, color = invcol
, textcolor = css
, size = size.small
, style = label.style_label_left
)
var label hlb = label.new(
na
, na
, xloc = xloc.bar_time
, text = str.format('P{0}H', tf)
, color = invcol
, textcolor = css
, size = size.small
, style = label.style_label_left
)
hy = ta.valuewhen(h != h , h , 1)
hx = ta.valuewhen(h == high , time , 1)
ly = ta.valuewhen(l != l , l , 1)
lx = ta.valuewhen(l == low , time , 1)
if barstate.islast
extension = time + (time - time ) * 50
line.set_xy1(hl , hx , hy)
line.set_xy2(hl , extension , hy)
label.set_xy(hlb, extension , hy)
line.set_xy1(ll , lx , ly)
line.set_xy2(ll , extension , ly)
label.set_xy(lbl, extension , ly)
if lvl_daily
mtfphl(pdh , pdl , 'D' , css_d, s_d)
if lvl_weekly
mtfphl(pwh , pwl , 'W' , css_w, s_w)
if lvl_monthly
mtfphl(pmh , pml, 'M' , css_m, s_m)
if lvl_yearly
mtfphl(pyh , pyl , '12M', css_y, s_y)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Market Structure }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
method darkcss(color css, float factor, bool bull) =>
blue = color.b(css) * (1 - factor)
red = color.r(css) * (1 - factor)
green = color.g(css) * (1 - factor)
color.rgb(red, green, blue, 0)
method f_line(msDraw d, size, style) =>
var line id = na
var label lbl = na
id := line.new(
d.n
, d.p
, b.n
, d.p
, color = d.css
, width = 1
, style = style
)
if msline.size() >= 250
line.delete(msline.shift())
msline.push(id)
lbl := label.new(
int(math.avg(d.n, b.n))
, d.p
, d.txt
, color = invcol
, textcolor = d.css
, style = d.bull ? label.style_label_down : label.style_label_up
, size = size
, text_font_family = font.family_monospace
)
structure(bool mtf) =>
msDraw drw = na
bool isdrw = false
bool isdrwS = false
var color css = na
var color icss = na
var int itrend = 0
var int trend = 0
bool bull_ob = false
bool bear_ob = false
bool s_bull_ob = false
bool s_bear_ob = false
n = bar_index
var ms up = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms dn = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms sup = ms.new(
array.new()
, array.new< int >()
, array.new()
)
var ms sdn = ms.new(
array.new()
, array.new< int >()
, array.new()
)
switch show_swing_ms
"All" => boolean.set(s_BOS , true ), boolean.set(s_CHoCH, true ) , boolean.set(s_CHoCHP, true )
"CHoCH" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, true ) , boolean.set(s_CHoCHP, false )
"CHoCH+" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, true )
"BOS" => boolean.set(s_BOS , true ), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, false )
"None" => boolean.set(s_BOS , false), boolean.set(s_CHoCH, false) , boolean.set(s_CHoCHP, false )
=> na
switch show_internal_ms
"All" => boolean.set(i_BOS, true ), boolean.set(i_CHoCH, true ), boolean.set(i_CHoCHP, true )
"CHoCH" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, true ), boolean.set(i_CHoCHP, false)
"CHoCH+" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, true )
"BOS" => boolean.set(i_BOS, true ), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, false)
"None" => boolean.set(i_BOS, false), boolean.set(i_CHoCH, false ), boolean.set(i_CHoCHP, false)
=> na
switch
iH =>
up.p.unshift(b.h )
up.l.unshift(b.h )
up.n.unshift(n )
iL =>
dn.p.unshift(b.l )
dn.l.unshift(b.l )
dn.n.unshift(n )
sL =>
sdn.p.unshift(b.l )
sdn.l.unshift(b.l )
sdn.n.unshift(n )
sH =>
sup.p.unshift(b.h )
sup.l.unshift(b.h )
sup.n.unshift(n )
// INTERNAL BULLISH STRUCTURE
if up.p.size() > 0 and dn.l.size() > 1
if ta.crossover(b.c, up.p.first())
bool CHoCH = na
string txt = na
if itrend < 0
CHoCH := true
switch
not CHoCH =>
txt := "BOS"
css := i_ms_up_BOS
blalert.bos := true
if boolean.get(i_BOS) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
up.n.first()
, up.p.first()
, i_ms_up_BOS
, txt
, true
)
CHoCH =>
dn.l.first() > dn.l.get(1) ? blalert.chochplus : blalert.choch
txt := dn.l.first() > dn.l.get(1) ? "CHoCH+" : "CHoCH"
css := i_ms_up_BOS.darkcss(0.25, true)
if (dn.l.first() > dn.l.get(1) ? boolean.get(i_CHoCHP) : boolean.get(i_CHoCH)) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
up.n.first()
, up.p.first()
, i_ms_up_BOS.darkcss(0.25, true)
, txt
, true
)
if mtf == false
switch
ob_filter == "None" => bull_ob := true
ob_filter == "BOS" and txt == "BOS" => bull_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => bull_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => bull_ob := true
itrend := 1
up.n.clear()
up.p.clear()
// INTERNAL BEARISH STRUCTURE
if dn.p.size() > 0 and up.l.size() > 1
if ta.crossunder(b.c, dn.p.first())
bool CHoCH = na
string txt = na
if itrend > 0
CHoCH := true
switch
not CHoCH =>
bralert.bos := true
txt := "BOS"
css := i_ms_dn_BOS
if boolean.get(i_BOS) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
dn.n.first()
, dn.p.first()
, i_ms_dn_BOS
, txt
, false
)
CHoCH =>
if up.l.first() < up.l.get(1)
bralert.chochplus := true
else
bralert.choch := true
txt := up.l.first() < up.l.get(1) ? "CHoCH+" : "CHoCH"
css := i_ms_dn_BOS.darkcss(0.25, false)
if (up.l.first() < up.l.get(1) ? boolean.get(i_CHoCHP) : boolean.get(i_CHoCH)) and mtf == false and na(drw)
isdrw := true
drw := msDraw.new(
dn.n.first()
, dn.p.first()
, i_ms_dn_BOS.darkcss(0.25, false)
, txt
, false
)
if mtf == false
switch
ob_filter == "None" => bear_ob := true
ob_filter == "BOS" and txt == "BOS" => bear_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => bear_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => bear_ob := true
itrend := -1
dn.n.clear()
dn.p.clear()
// SWING BULLISH STRUCTURE
if sup.p.size() > 0 and sdn.l.size() > 1
if ta.crossover(b.c, sup.p.first())
bool CHoCH = na
string txt = na
if trend < 0
CHoCH := true
switch
not CHoCH =>
blalert.swingbos := true
txt := "BOS"
icss := s_ms_up_BOS
if boolean.get(s_BOS) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sup.n.first()
, sup.p.first()
, s_ms_up_BOS
, txt
, true
)
CHoCH =>
if sdn.l.first() > sdn.l.get(1)
blalert.chochplusswing := true
else
blalert.chochswing := true
txt := sdn.l.first() > sdn.l.get(1) ? "CHoCH+" : "CHoCH"
icss := s_ms_up_BOS.darkcss(0.25, true)
if (sdn.l.first() > sdn.l.get(1) ? boolean.get(s_CHoCHP) : boolean.get(s_CHoCH)) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sup.n.first()
, sup.p.first()
, s_ms_up_BOS.darkcss(0.25, true)
, txt
, true
)
if mtf == false
switch
ob_filter == "None" => s_bull_ob := true
ob_filter == "BOS" and txt == "BOS" => s_bull_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => s_bull_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => s_bull_ob := true
trend := 1
sup.n.clear()
sup.p.clear()
// SWING BEARISH STRUCTURE
if sdn.p.size() > 0 and sup.l.size() > 1
if ta.crossunder(b.c, sdn.p.first())
bool CHoCH = na
string txt = na
if trend > 0
CHoCH := true
switch
not CHoCH =>
bralert.swingbos := true
txt := "BOS"
icss := s_ms_dn_BOS
if boolean.get(s_BOS) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sdn.n.first()
, sdn.p.first()
, s_ms_dn_BOS
, txt
, false
)
CHoCH =>
if sup.l.first() < sup.l.get(1)
bralert.chochplusswing := true
else
bralert.chochswing := true
txt := sup.l.first() < sup.l.get(1) ? "CHoCH+" : "CHoCH"
icss := s_ms_dn_BOS.darkcss(0.25, false)
if (sup.l.first() < sup.l.get(1) ? boolean.get(s_CHoCHP) : boolean.get(s_CHoCH)) and mtf == false and na(drw)
isdrwS := true
drw := msDraw.new(
sdn.n.first()
, sdn.p.first()
, s_ms_dn_BOS.darkcss(0.25, false)
, txt
, false
)
if mtf == false
switch
ob_filter == "None" => s_bear_ob := true
ob_filter == "BOS" and txt == "BOS" => s_bear_ob := true
ob_filter == "CHoCH" and txt == "CHoCH" => s_bear_ob := true
ob_filter == "CHoCH+" and txt == "CHoCH+" => s_bear_ob := true
trend := -1
sdn.n.clear()
sdn.p.clear()
= structure(false)
if isdrw
f_line(drw, size.small, line.style_dashed)
if isdrwS
f_line(drw, size.small, line.style_solid)
= request.security("", "15" , structure(true))
= request.security("", "60" , structure(true))
= request.security("", "240" , structure(true))
= request.security("", "1440" , structure(true))
if show_mtf_str
var tab = table.new(position = position.top_right, columns = 10, rows = 10, bgcolor = na, frame_color = color.rgb(54, 58, 69, 0), frame_width = 1, border_color = color.rgb(54, 58, 69, 100), border_width = 1)
table.cell(tab, 0, 1, text = "15" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 2, text = "1H" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 3, text = "4H" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 0, 4, text = "1D" , text_color = color.silver, text_halign = text.align_center, text_size = size.normal, bgcolor = chart.bg_color, text_font_family = font.family_monospace, width = 2)
table.cell(tab, 1, 1, text = itrend15 == 1 ? "BULLISH" : itrend15 == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend15 == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend15 == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 2, text = itrend1H == 1 ? "BULLISH" : itrend1H == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend1H == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend1H == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 3, text = itrend4H == 1 ? "BULLISH" : itrend4H == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend4H == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend4H == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 1, 4, text = itrend1D == 1 ? "BULLISH" : itrend1D == -1 ? "BEARISH" : na , text_halign = text.align_center, text_size = size.normal, text_color = itrend1D == 1 ? i_ms_up_BOS.darkcss(-0.25, true) : itrend1D == -1 ? i_ms_dn_BOS.darkcss(0.25, false) : color.gray, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 0, 5, text = "Detected Pattern", text_halign = text.align_center, text_size = size.normal, text_color = color.silver, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.cell(tab, 0, 6, text = p.found, text_halign = text.align_center, text_size = size.normal, text_color = na(p.bull) ? color.white : p.bull ? i_ms_up_BOS.darkcss(-0.25, true) : p.bull == false ? i_ms_dn_BOS.darkcss(0.25, false) : na, bgcolor = chart.bg_color, text_font_family = font.family_monospace)
table.merge_cells(tab, 0, 5, 1, 5)
table.merge_cells(tab, 0, 6, 1, 6)
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Strong/Weak High/Low And Equilibrium }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
var phl = Zphl.new(
na
, na
, label.new(na , na , color = invcol , textcolor = i_ms_dn_BOS , style = label.style_label_down , size = size.tiny , text = "")
, label.new(na , na , color = invcol , textcolor = i_ms_up_BOS , style = label.style_label_up , size = size.tiny , text = "")
, true
, true
, true
, true
, ""
, ""
, 0
, 0
, 0
, 0
, high
, low
, 0
, 0
, 0
, 0
, 0
, 0
, na
, na
)
zhl(len)=>
upper = ta.highest(len)
lower = ta.lowest(len)
var float out = 0
out := b.h > upper ? 0 : b.l < lower ? 1 : out
top = out == 0 and out != 0 ? b.h : 0
btm = out == 1 and out != 1 ? b.l : 0
= zhl(sLen)
= zhl(iLen)
upphl(trend) =>
var label lbl = label.new(
na
, na
, color = invcol
, textcolor = toplvl
, style = label.style_label_down
, size = size.small
)
if top
phl.stopcross := true
phl.txtup := top > phl.topy ? "HH" : "HL"
if show_lbl
topl = label.new(
b.n - swing_r_lookback
, top
, phl.txtup
, color = invcol
, textcolor = toplvl
, style = label.style_label_down
, size = size.small
)
line.delete(phl.top )
phl.top := line.new(
b.n - sLen
, top
, b.n
, top
, color = toplvl)
phl.topy := top
phl.topx := b.n - sLen
phl.tup := top
phl.tupx := b.n - sLen
if itop
phl.itopcross := true
phl.itopy := itop
phl.itopx := b.n - iLen
phl.tup := math.max(high, phl.tup)
phl.tupx := phl.tup == high ? b.n : phl.tupx
phl.uV := phl.tup != phl.tup ? b.v : phl.uV
if barstate.islast
line.set_xy1(
phl.top
, phl.tupx
, phl.tup
)
line.set_xy2(
phl.top
, b.n + 50
, phl.tup
)
label.set_x(
lbl
, b.n + 50
)
label.set_y(
lbl
, phl.tup
)
dist = math.abs(phl.uV / (phl.uV + phl.dV)) * 100
label.set_text (lbl, trend < 0
? "Strong High | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)"
: "Weak High | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)")
dnphl(trend) =>
var label lbl = label.new(
na
, na
, color = invcol
, textcolor = btmlvl
, style = label.style_label_up
, size = size.small
)
if btm
phl.sbottomcross := true
phl.txtdn := btm > phl.bottomy ? "LH" : "LL"
if show_lbl
btml = label.new(
b.n - swing_r_lookback
, btm, phl.txtdn
, color = invcol
, textcolor = btmlvl
, style = label.style_label_up
, size = size.small
)
line.delete(phl.bottom )
phl.bottom := line.new(
b.n - sLen
, btm
, b.n
, btm
, color = btmlvl
)
phl.bottomy := btm
phl.bottomx := b.n - sLen
phl.tdn := btm
phl.tdnx := b.n - sLen
if ibtm
phl.ibottomcross := true
phl.ibottomy := ibtm
phl.ibottomx := b.n - iLen
phl.tdn := math.min(low, phl.tdn)
phl.tdnx := phl.tdn == low ? b.n : phl.tdnx
phl.dV := phl.tdn != phl.tdn ? b.v : phl.dV
if barstate.islast
line.set_xy1(
phl.bottom
, phl.tdnx
, phl.tdn
)
line.set_xy2(
phl.bottom
, b.n + 50
, phl.tdn
)
label.set_x(
lbl
, b.n + 50
)
label.set_y(
lbl
, phl.tdn
)
dist = math.abs(phl.dV / (phl.uV + phl.dV)) * 100
label.set_text (lbl, trend > 0
? "Strong Low | " + str.tostring(phl.dV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)"
: "Weak Low | " + str.tostring(phl.uV, format.volume) + " (" + str.tostring(math.round(dist,0)) + "%)")
midphl() =>
avg = math.avg(phl.bottom.get_y2(), phl.top.get_y2())
var line l = line.new(
y1 = avg
, y2 = avg
, x1 = b.n - sLen
, x2 = b.n + 50
, color = midlvl
, style = line.style_solid
)
var label lbl = label.new(
x = b.n + 50
, y = avg
, text = "Equilibrium"
, style = label.style_label_left
, color = invcol
, textcolor = midlvl
, size = size.small
)
if barstate.islast
more = (phl.bottom.get_x1() + phl.bottom.get_x2()) > (phl.top.get_x1() + phl.top.get_x2()) ? phl.top.get_x1() : phl.bottom.get_x1()
line.set_xy1(l , more , avg)
line.set_xy2(l , b.n + 50, avg)
label.set_x (lbl , b.n + 50 )
label.set_y (lbl , avg )
dist = math.abs((l.get_y2() - close) / close) * 100
label.set_text (lbl, "Equilibrium (" + str.tostring(math.round(dist,0)) + "%)")
hqlzone() =>
if barstate.islast
var hqlzone dZone = hqlzone.new(
box.new(
na
, na
, na
, na
, bgcolor = color.new(toplvl, 70)
, border_color = na
)
, box.new(
na
, na
, na
, na
, bgcolor = color.new(midlvl, 70)
, border_color = na
)
, box.new(
na
, na
, na
, na
, bgcolor = color.new(btmlvl, 70)
, border_color = na
)
, label.new(na, na, text = "Premium" , color = invcol, textcolor = toplvl, style = label.style_label_down, size = size.small)
, label.new(na, na, text = "Equilibrium", color = invcol, textcolor = midlvl, style = label.style_label_left, size = size.small)
, label.new(na, na, text = "Discount" , color = invcol, textcolor = btmlvl, style = label.style_label_up , size = size.small)
)
dZone.pbx.set_lefttop(int(math.max(phl.topx, phl.bottomx)) , phl.tup)
dZone.pbx.set_rightbottom(b.n + 50 , 0.95 * phl.tup + 0.05 * phl.tdn)
dZone.ebx.set_lefttop(int(math.max(phl.topx, phl.bottomx)), 0.525 * phl.tup + 0.475 * phl.tdn)
dZone.ebx.set_rightbottom(b.n + 50 , 0.525 * phl.tdn + 0.475 * phl.tup)
dZone.lbx.set_lefttop(int(math.max(phl.topx, phl.bottomx)), 0.95 * phl.tdn + 0.05 * phl.tup)
dZone.lbx.set_rightbottom(b.n + 50 , phl.tdn)
dZone.plb.set_xy( int(math.avg(math.max(phl.topx, phl.bottomx), int(b.n + 50))) , phl.tup)
dZone.elb.set_xy( int(b.n + 50) , math.avg(phl.tup, phl.tdn))
dZone.lbl.set_xy( int(math.avg(math.max(phl.topx, phl.bottomx), int(b.n + 50))) , phl.tdn)
if show_mtb
upphl (trend)
dnphl (trend)
hqlzone()
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - Volumetric Order Block }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
method eB(box b, bool ext, color css, bool swing) =>
b.unshift(
box.new(
na
, na
, na
, na
, xloc = xloc.bar_time
, text_font_family = font.family_monospace
, extend = ext ? extend.right : extend.none
, border_color = swing ? color.new(css, 0) : color.new(color.white,100)
, bgcolor = css
, border_width = 1
)
)
method eL(line l, bool ext, bool solid, color css) =>
l.unshift(
line.new(
na
, na
, na
, na
, width = 1
, color = css
, xloc = xloc.bar_time
, extend = ext ? extend.right : extend.none
, style = solid ? line.style_solid : line.style_dashed
)
)
method drawVOB(bool cdn, bool bull, color css, int loc, bool swing) =>
= request.security(
syminfo.tickerid
, ""
,
, lookahead = barmerge.lookahead_off
)
var obC obj = obC.new(
array.new()
, array.new()
, array.new< int >()
, array.new()
, array.new()
, array.new()
, array.new< int >()
, array.new< int >()
, array.new< int >()
, array.new< int >()
, array.new()
, array.new()
, array.new< int >()
)
var obD draw = obD.new(
array.new()
, array.new()
, array.new()
, array.new()
, array.new()
)
if barstate.isfirst
for i = 0 to ob_num - 1
draw.mL .eL(false, false, use_grayscale ? color.new(color.gray, 0) : color.new(css,0))
draw.ob .eB(false, use_grayscale ? color.new(color.gray, 90) : css, swing)
draw.blB.eB(false, css_metric_up , swing)
draw.brB.eB(false, css_metric_dn , swing)
draw.eOB.eB(true , use_grayscale ? color.new(color.gray, 90) : css, swing)
float pos = ob_pos == "Full"
? (bull ? high : low)
: ob_pos == "Middle"
? ohlc4
: ob_pos == "Accurate"
? hl2
: hl2
if cdn
obj.h.clear()
obj.l.clear()
obj.n.clear()
for i = 0 to math.abs((loc - b.n)) - 1
obj.h.push(hH )
obj.l.push(lL )
obj.n.push(b.t )
// obj.h.reverse()
// obj.l.reverse()
int iU = obj.l.indexof(obj.l.min()) + 1
int iD = obj.h.indexof(obj.h.max()) + 1
obj.dir.unshift(
bull
? (b.c > b.o ? 1 : -1)
: (b.c > b.o ? 1 : -1)
)
obj.top.unshift(
bull
? pos
: obj.h.max()
)
obj.btm.unshift(
bull
? obj.l.min()
: pos
)
obj.left.unshift(
bull
? obj.n.get(obj.l.indexof(obj.l.min()))
: obj.n.get(obj.h.indexof(obj.h.max()))
)
obj.avg.unshift(
math.avg(obj.top.first(), obj.btm.first())
)
obj.cV.unshift(
bull
? b.v
: b.v
)
if ob_pos == "Precise"
switch bull
true =>
if obj.avg.get(0) < (b.c < b.o ? b.c : b.o ) and obj.top.get(0) > hlcc4
obj.top.set(0, obj.avg.get(0))
obj.avg.set(0, math.avg(obj.top.first(), obj.btm.first()))
false =>
if obj.avg.get(0) > (b.c < b.o ? b.o : b.c ) and obj.btm.get(0) < hlcc4
obj.btm.set(0, obj.avg.get(0))
obj.avg.set(0, math.avg(obj.top.first(), obj.btm.first()))
obj.blVP.unshift ( 0 )
obj.brVP.unshift ( 0 )
obj.wM .unshift ( 1 )
if use_overlap
int rmP = use_overlap_method == "Recent" ? 1 : 0
if obj.avg.size() > 1
if bull
? obj.btm.first() < obj.top.get(1)
: obj.top.first() > obj.btm.get(1)
obj.wM .remove(rmP)
obj.cV .remove(rmP)
obj.dir .remove(rmP)
obj.top .remove(rmP)
obj.avg .remove(rmP)
obj.btm .remove(rmP)
obj.left .remove(rmP)
obj.blVP .remove(rmP)
obj.brVP .remove(rmP)
if barstate.isconfirmed
for x = 0 to ob_num - 1
tg = switch ob_mitigation
"Middle" => obj.avg
"Absolute" => bull ? obj.btm : obj.top
for in tg
if (bull ? cC < pt : cC > pt)
obj.wM .remove(idx)
obj.cV .remove(idx)
obj.dir .remove(idx)
obj.top .remove(idx)
obj.avg .remove(idx)
obj.btm .remove(idx)
obj.left .remove(idx)
obj.blVP .remove(idx)
obj.brVP .remove(idx)
if barstate.islast
if obj.avg.size() > 0
// Alert
if bull
? ta.crossunder(low , obj.top.get(0))
: ta.crossover (high, obj.btm.get(0))
switch bull
true => blalert.obtouch := true
false => bralert.obtouch := true
float tV = 0
obj.dV.clear()
seq = math.min(ob_num - 1, obj.avg.size() - 1)
for j = 0 to seq
tV += obj.cV.get(j)
if j == seq
for y = 0 to seq
obj.dV.unshift(
math.floor(
(obj.cV.get(y) / tV) * 100)
)
obj.dV.reverse()
for i = 0 to math.min(ob_num - 1, obj.avg.size() - 1)
dmL = draw.mL .get(i)
dOB = draw.ob .get(i)
dblB = draw.blB.get(i)
dbrB = draw.brB.get(i)
deOB = draw.eOB.get(i)
dOB.set_lefttop (obj.left .get(i) , obj.top.get(i))
deOB.set_lefttop (b.t , obj.top.get(i))
dOB.set_rightbottom (b.t , obj.btm.get(i))
deOB.set_rightbottom(b.t + (b.t - b.t ) * 100 , obj.btm.get(i))
if use_middle_line
dmL.set_xy1(obj.left.get(i), obj.avg.get(i))
dmL.set_xy2(b.t , obj.avg.get(i))
if ob_metrics_show
dblB.set_lefttop (obj.left.get(i), obj.top.get(i))
dbrB.set_lefttop (obj.left.get(i), obj.avg.get(i))
dblB.set_rightbottom(obj.left.get(i), obj.avg.get(i))
dbrB.set_rightbottom(obj.left.get(i), obj.btm.get(i))
rpBL = dblB.get_right()
rpBR = dbrB.get_right()
dbrB.set_right(rpBR + (b.t - b.t ) * obj.brVP.get(i))
dblB.set_right(rpBL + (b.t - b.t ) * obj.blVP.get(i))
if use_show_metric
txt = switch
obj.cV.get(i) >= 1000000000 => str.tostring(math.round(obj.cV.get(i) / 1000000000,3)) + "B"
obj.cV.get(i) >= 1000000 => str.tostring(math.round(obj.cV.get(i) / 1000000,3)) + "M"
obj.cV.get(i) >= 1000 => str.tostring(math.round(obj.cV.get(i) / 1000,3)) + "K"
obj.cV.get(i) < 1000 => str.tostring(math.round(obj.cV.get(i)))
deOB.set_text(
str.tostring(
txt + " (" + str.tostring(obj.dV.get(i)) + "%)")
)
deOB.set_text_size (size.auto)
deOB.set_text_halign(text.align_left)
deOB.set_text_color (use_grayscale ? color.silver : color.new(css, 0))
if ob_metrics_show and barstate.isconfirmed
if obj.wM.size() > 0
for i = 0 to obj.avg.size() - 1
switch obj.dir.get(i)
1 =>
switch obj.wM.get(i)
1 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 2)
2 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 3)
3 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 1)
-1 =>
switch obj.wM.get(i)
1 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 2)
2 => obj.brVP.set(i, obj.brVP.get(i) + 1), obj.wM.set(i, 3)
3 => obj.blVP.set(i, obj.blVP.get(i) + 1), obj.wM.set(i, 1)
var hN = array.new(1, b.n)
var lN = array.new(1, b.n)
var hS = array.new(1, b.n)
var lS = array.new(1, b.n)
if iH
hN.pop()
hN.unshift(int(b.n ))
if iL
lN.pop()
lN.unshift(int(b.n ))
if sH
hS.pop()
hS.unshift(int(b.n ))
if sL
lS.pop()
lS.unshift(int(b.n ))
if ob_show
bull_ob.drawVOB(true , ob_bull_css, hN.first(), false)
bear_ob.drawVOB(false, ob_bear_css, lN.first(), false)
if ob_swings
s_bull_ob.drawVOB(true , css_swing_up, hS.first(), true)
s_bear_ob.drawVOB(false, css_swing_dn, lS.first(), true)
if bull_ob
blalert.ob := true
if bear_ob
bralert.ob := true
if s_bull_ob
blalert.swingob := true
if s_bear_ob
blalert.swingob := true
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - End }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{ - FVG | VI | OG }
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
//{----------------------------------------------------------------------------------------------------------------------------------------------}
ghl() => request.security(syminfo.tickerid, fvg_tf, [high , low , close , open ])
tfG() => request.security(syminfo.tickerid, fvg_tf, )
cG(bool bull) =>
= ghl()
= tfG()
var FVG draw = FVG.new(
array.new()
, array.new()
)
var FVG cords = array.new()
float pup = na
float pdn = na
bool cdn = na
int pos = 2
cc = timeframe.change(fvg_tf)
if barstate.isfirst
for i = 0 to fvg_num - 1
draw.box.unshift(box.new (na, na, na, na, border_color = color.new(color.white, 100), xloc = xloc.bar_time))
draw.ln.unshift (line.new(na, na, na, na, xloc = xloc.bar_time, width = 1, style = line.style_solid))
switch what_fvg
"FVG" =>
pup := bull ? gl : l
pdn := bull ? h : gh
cdn := bull ? gl > h and cc : gh < l and cc
pos := 2
"VI" =>
pup := bull
? (gc > go
? go
: gc)
: (gc > go
? go
: gc )
pdn := bull
? (gc > go
? gc
: go )
: (gc > go
? gc
: go)
cdn := bull
? go > gc and gh > gl and gc > gc and go > go and gh < math.min(gc, go) and cc
: go < gc and gl < gh and gc < gc and go < go and gl > math.max(gc, go) and cc
pos := 1
"OG" =>
pup := bull ? b.l : gl
pdn := bull ? gh : gh
cdn := bull ? gl > gh and cc : gh < gl and cc
pos := 1
if not na(cdn ) and cdn
cords.unshift(
FVG.new(
na
, na
, bull
? true
Algo MA💎 (V.4.3)Algo MA💎 V.4.3 - Multi-EMA System with Advanced Candle Analysis
**Algo MA💎 V.4.3** is a comprehensive trend analysis system that combines multiple EMA configurations with advanced candle coloring, support/resistance detection, and integrated trade management dashboards. This indicator provides a complete visual trading environment with sophisticated trend identification and portfolio tracking capabilities.
**Core Innovation & Originality**
This system uniquely integrates seven distinct analytical components:
1. **Dual-EMA Signal Engine** - Primary trend detection using 9/21 EMA crossovers with customizable sensitivity
2. **Advanced Candle Classification** - Multi-layer candle coloring with two sensitivity levels (violet/rose) based on ATR calculations
3. **Trend Confirmation System** - Secondary 20/50 EMA trend filter with dynamic cloud visualization
4. **Zero Lag EMA Implementation** - 144-period Zero Lag EMA with directional color coding for reduced lag trend analysis
5. **RSI Extreme Detection** - Overbought (75) and oversold (25) level identification with visual markers
6. **Dynamic Support/Resistance** - Pivot-based support and resistance level calculation with 50-bar lookback
7. **Integrated Trade Management** - Three customizable dashboard tables for real-time portfolio tracking
**System Architecture & Functionality**
**Primary Signal Generation:**
The core system uses a 9-period EMA and 21-period EMA comparison to generate directional bias. When EMA9 > EMA21, the system indicates bullish conditions; when EMA9 < EMA21, it signals bearish conditions. This creates the foundation for all visual elements and trend analysis.
**Advanced Candle Coloring Logic:**
The system employs a sophisticated three-layer candle coloring approach:
- **Green Candles**: EMA9 > EMA21 (bullish trend)
- **Red Candles**: EMA9 < EMA21 (bearish trend)
- **Violet Candles**: EMAs within sensitivity_violet * ATR(14) range (consolidation)
- **Rose Candles**: EMAs within sensitivity_rose * ATR(14) range (tight consolidation)
**Sensitivity-Based Classification:**
Two independent sensitivity parameters allow fine-tuning of consolidation detection:
- **Violet Sensitivity (0.3 default)**: Broader consolidation zones
- **Rose Sensitivity (0.1 default)**: Tighter consolidation zones
**Zero Lag EMA Implementation:**
Uses advanced calculation: `zlema = ema(src + src - src , length)` where lag = floor((length-1)/2). This reduces the inherent lag of traditional EMAs while maintaining smoothness.
**Trend Confirmation Framework:**
The 20/50 EMA system provides trend context with visual cloud fills:
- **Blue Cloud**: 20 EMA > 50 EMA (bullish trend environment)
- **Red Cloud**: 20 EMA < 50 EMA (bearish trend environment)
**Unique Visual Features**
**Multi-Layer Candle System:**
The indicator plots up to four candle layers simultaneously:
1. **Base Candles**: Primary EMA-based trend colors
2. **Violet Consolidation**: ATR-adjusted consolidation detection
3. **Rose Consolidation**: Tighter consolidation identification
4. **Bearish Overlay**: Optional bearish candle highlighting
**Support/Resistance Detection:**
Uses pivot point calculations with 50-bar left and right parameters:
- **Green Lines**: Resistance levels from pivot highs
- **Red Lines**: Support levels from pivot lows
- **Dynamic Updates**: Lines adjust based on price action
**RSI Extreme Markers:**
- **Red Triangles**: First occurrence of RSI > 75 (overbought)
- **Green Triangles**: First occurrence of RSI < 25 (oversold)
**Integrated Dashboard System**
**Trade Management Tables:**
Three independent dashboard tables provide comprehensive trade tracking:
- **Stock Information**: Ticker symbol and trade direction (BUY/SELL)
- **Order Details**: Entry price, stop loss, and take profit levels
- **Position Status**: Real-time trade monitoring with color-coded status
**Dashboard Customization:**
- **Positioning**: Bottom-right, bottom-center, bottom-left placement options
- **Color Coding**: Green for BUY positions, red for SELL positions
- **Manual Entry**: User-customizable fields for trade parameters
**Volume Analysis Integration**
**Volume Oscillator:**
Implements short (5) and long (10) EMA volume comparison:
`osc = 100 * (short_volume_ema - long_volume_ema) / long_volume_ema`
This provides additional confirmation for trend strength and potential reversals.
**Usage Instructions**
**Trend Identification:**
- **Primary Trend**: Monitor 9/21 EMA relationship and candle colors
- **Trend Strength**: Observe Zero Lag EMA color (green=bullish, red=bearish)
- **Trend Context**: Use 20/50 EMA cloud for higher timeframe bias
**Entry Signal Recognition:**
- **Bullish Setup**: Green candles + blue trend cloud + support level test
- **Bearish Setup**: Red candles + red trend cloud + resistance level test
- **Consolidation**: Violet/rose candles indicate ranging conditions
**Risk Management Application:**
- **Support/Resistance**: Use pivot levels for stop placement and targets
- **RSI Extremes**: Monitor overbought/oversold conditions for reversal potential
- **Dashboard Tracking**: Utilize tables for position management
**Advanced Analysis:**
- **Sensitivity Adjustment**: Modify violet/rose parameters for market volatility
- **Multi-Timeframe**: Apply system across different timeframes for confluence
- **Volume Confirmation**: Use volume oscillator for signal validation
**Customization Options**
**EMA Parameters:**
- **Main Flow EMAs**: Adjustable 9/21 period settings
- **Trend EMAs**: Customizable 20/50 period configuration
- **Zero Lag EMA**: Modifiable 144-period length
**Visual Settings:**
- **Candle Display**: Toggle bearish candle overlay
- **Trend Visualization**: Show/hide trend cloud and EMAs
- **Support/Resistance**: Enable/disable pivot level display
- **RSI Markers**: Control overbought/oversold triangle display
**Dashboard Configuration:**
- **Table Display**: Independent control for three dashboard tables
- **Trade Details**: Customizable entry, stop, and target fields
- **Position Status**: Manual BUY/SELL/neutral designation
**Alert System**
Built-in alert conditions for:
- **Bullish Signal**: EMA9 crosses above EMA21
- **Bearish Signal**: EMA9 crosses below EMA21
**Important Considerations**
This system works optimally in trending markets with clear directional bias. During consolidation periods, focus on violet/rose candle identification and range-bound strategies. The multiple EMA layers provide comprehensive trend analysis but may generate conflicting signals during choppy conditions.
The dashboard tables serve as trade management tools but require manual input for position tracking. The system combines established EMA techniques with original sensitivity-based consolidation detection and advanced visual presentation methods.
**Disclaimer**: This indicator is designed for educational and analytical purposes. The dashboard tables are for position tracking only and do not execute trades automatically. Past performance does not guarantee future results. Always implement proper risk management and consider multiple confirmation methods before making trading decisions.
cd_bsl_ssl_CxGeneral
This indicator is designed to show the levels where stop-loss orders from buyers and sellers are most likely clustered.
Swing levels formed on the aligned higher time frame (HTF) are displayed on the chart as Buy Side Liquidity (BSL) and Sell Side Liquidity (SSL).
________________________________________
Menu & Usage
• HTF Selection:
o In “Auto” mode, the HTF is selected automatically.
o In “Manual” mode, the user can choose the HTF themselves.
• Bar Control:
By adjusting the bar control value, the user can define the number of bars required for a valid BSL or SSL sweep.
This option helps keep the number of alerts under control.
________________________________________
I’d be happy to hear your feedback and suggestions.
Happy trading! 🎉
All Divergences (MACD, RSIOI, CVD) Multi-Divergence Suite (MACD Area, RSIOI, CVD)
Description:
This indicator is a comprehensive suite designed to identify multiple types of market divergences on your chart. Instead of using several different indicators, you can use this single script to find potential turning points and trend continuations based on momentum and volume analysis.
Key Features:
1. MACD Area Divergence:
Unlike standard MACD divergence that only compares the peaks of the histogram, this module calculates the entire area (volume) of each MACD cycle. It then compares this momentum "volume" to price action to detect both Regular Divergences (signaling potential trend reversals) and Hidden Divergences (signaling potential trend continuations).
2. RSIOI (RSI Overbought/Oversold) Divergence:
This module identifies classic RSI divergences with a specific filter: it only looks for price pivots that occur while the RSI is in overbought (e.g., >70) or oversold (e.g., <30) territory. This helps to focus on signals that appear at potential market extremes.
3. CVD (Cumulative Volume Delta) Divergence:
This powerful module shows the divergence between price and Cumulative Volume Delta, giving you a clearer view of the underlying buying and selling pressure. It features a unique "Ultra Data" mode that can aggregate volume from dozens of different brokers for a more accurate picture of the market, which is especially useful for Forex and Crypto pairs.
Customization:
Each of the three divergence modules can be enabled or disabled independently.
Filter signals to show "Longs Only," "Shorts Only," or both to match your trading bias.
Market Structure by Gemini [v1.3]HH, HL, LH, LL indicator + BoS indicator. I'm now fully immersed in extracting the essential elements. I've pinpointed three critical concepts: Break and Retest (B&R), Liquidity Sweep & Reaction, and Market Structure (MS). My current focus is on the interactions between these components and on translating them into executable Pine Script instructions, starting with the simplest implementations.
Adaptive Pivot Zones█ OVERVIEW
The "Adaptive Pivot Zones" indicator is a versatile tool designed to identify and visualize key pivot levels directly on the price chart. By detecting pivot highs and lows, the indicator calculates dynamic support and resistance zones based on user-defined levels (default: 0.382, 0.5, 0.618). These zones adapt to market volatility, providing traders with clear visual cues for potential reversal or continuation points. The indicator offers extensive customization options, such as adjusting colors, smoothing lines, and setting fill transparency, making it highly adaptable to various trading styles.
█ CONCEPTS
The "Adaptive Pivot Zones" indicator simplifies the identification of significant price levels by plotting three dynamic pivot lines, which can be smoothed to reduce market noise. The indicator dynamically changes the colors of the lines and fill zones based on price action, using bullish, bearish, or neutral colors to reflect market sentiment.
█ CALCULATIONS
The indicator relies on the following calculations:
- Pivot Detection: Pivot highs (ta.pivothigh) and pivot lows (ta.pivotlow) are identified using a user-defined pivot length (default: 10). Pivots represent significant price peaks and troughs. Higher pivot length values produce more stable levels but introduce a delay equal to the set value. For more aggressive strategies, the pivot length can be reduced.
- Pivot Levels: When both a pivot high and low are detected, the range between them is calculated (rng = drHigh - drLow). Three pivot levels are computed as:
Line 1: drLow + rng * pivotLevel1
Line 2: drLow + rng * pivotLevel2
Line 3: drLow + rng * pivotLevel3
- Smoothing: Pivot lines can be smoothed using a simple moving average (SMA) with a user-defined smoothing length (default: 1) to reduce noise and improve readability.
- Color Logic: Lines and fill zones are colored based on the price position relative to the pivot zones:
If the price is below the lowest pivot line, a bearish color is used (default: red).
If the price is above the highest pivot line, a bullish color is used (default: green).
If the price is within the pivot zones and the neutral color option is enabled, a neutral color is used (default: gray); otherwise, the previous color is retained.
- Fill Zones: The areas between pivot lines are filled with a user-defined transparency level (default: 80) to visually highlight support and resistance zones.
█ INDICATOR FEATURES
- Dynamic Pivot Lines: Three adaptive pivot lines (default levels: 0.382, 0.5, 0.618) are plotted on the price chart, adjusting to market volatility.
- Smoothing: User-defined smoothing length (default: 1) for pivot lines to reduce noise and enhance signal clarity.
- Dynamic Coloring: Lines and fill zones change color based on price action (bullish, bearish, or neutral when the price moves within the zone), reflecting market sentiment.
- Fill Zones: Transparent fills between pivot lines to visually highlight support and resistance zones.
- Customization: Options to adjust pivot length, pivot levels, smoothing, colors, transparency, and enable/disable neutral color logic.
█ HOW TO SET UP THE INDICATOR
- Add the "Adaptive Pivot Zones" indicator to your TradingView chart.
- Configure parameters in the settings, such as pivot length, pivot levels, smoothing length, and colors, to align with your trading strategy. Without smoothing, lines behave like levels; with smoothing, they act like bands. All three levels can be set to the same value to obtain a single level or a line behaving like a moving average derived from pivots.
- Enable or disable the neutral color option (for prices moving within the zone) and adjust fill transparency for optimal visualization.
- Adjust line thickness and style in the "Style" section to improve chart readability.
Example of bands – lines behave like support/resistance zones.
Example of a moving average derived from pivots – line behaves like a pivot-based MA.
█ HOW TO USE
Add the indicator to your chart, adjust the settings, and observe price interactions with the pivot lines and zones to identify potential trading opportunities. Key signals include:
- Price Interaction with Pivot Lines: When the price approaches or crosses a pivot line, it may indicate a potential support or resistance level. A bounce from a pivot line could signal a reversal, while a breakout might suggest trend continuation.
- Zone-Based Signals and Trend Line Usage: Price movement within or outside the filled zones can indicate market sentiment. Price below the lowest pivot line suggests bearish momentum, price above the highest pivot line suggests bullish momentum, and price within the zones may indicate consolidation. With higher pivot length values, the indicator can be used as a trend line, particularly during clear market movements.
- Color Changes: Shifts in line and fill colors (bullish, bearish, or neutral) provide visual cues about changing market conditions.
- Confirmation with Other Tools: Combine the indicator with tools like RSI or Bollinger Bands to validate signals and improve trade accuracy. For example, a buy signal from RSI in the oversold zone combined with a bounce from the lowest pivot line may indicate a strong entry point.
Institutional Levels (CNN) - [PhenLabs]📊Institutional Levels (Convolutional Neural Network-inspired)
Version : PineScript™v6
📌Description
The CNN-IL Institutional Levels indicator represents a breakthrough in automated zone detection technology, combining convolutional neural network principles with advanced statistical modeling. This sophisticated tool identifies high-probability institutional trading zones by analyzing pivot patterns, volume dynamics, and price behavior using machine learning algorithms.
The indicator employs a proprietary 9-factor logistic regression model that calculates real-time reaction probabilities for each detected zone. By incorporating CNN-inspired filtering techniques and dynamic zone management, it provides traders with unprecedented accuracy in identifying where institutional money is likely to react to price action.
🚀Points of Innovation
● CNN-Inspired Pivot Analysis - Advanced binning system using convolutional neural network principles for superior pattern recognition
● Real-Time Probability Engine - Live reaction probability calculations using 9-factor logistic regression model
● Dynamic Zone Intelligence - Automatic zone merging using Intersection over Union (IoU) algorithms
● Volume-Weighted Scoring - Time-of-day volume Z-score analysis for enhanced zone strength assessment
● Adaptive Decay System - Intelligent zone lifecycle management based on touch frequency and recency
● Multi-Filter Architecture - Optional gradient, smoothing, and Difference of Gaussians (DoG) convolution filters
🔧Core Components
● Pivot Detection Engine - Advanced pivot identification with configurable left/right bars and ATR-normalized strength calculations
● Neural Network Binning - Price level clustering using CNN-inspired algorithms with ATR-based bin sizing
● Logistic Regression Model - 9-factor probability calculation including distance, width, volume, VWAP deviation, and trend analysis
● Zone Management System - Intelligent creation, merging, and decay algorithms for optimal zone lifecycle control
● Visualization Layer - Dynamic line drawing with opacity-based scoring and optional zone fills
🔥Key Features
● High-Probability Zone Detection - Automatically identifies institutional levels with reaction probabilities above configurable thresholds
● Real-Time Probability Scoring - Live calculation of zone reaction likelihood using advanced statistical modeling
● Session-Aware Analysis - Optional filtering to specific trading sessions for enhanced accuracy during active market hours
● Customizable Parameters - Full control over lookback periods, zone sensitivity, merge thresholds, and probability models
● Performance Optimized - Efficient processing with controlled update frequencies and pivot processing limits
● Non-Repainting Mode - Strict mode available for backtesting accuracy and live trading reliability
🎨Visualization
● Dynamic Zone Lines - Color-coded support and resistance levels with opacity reflecting zone strength and confidence scores
● Probability Labels - Real-time display of reaction probabilities, touch counts, and historical hit rates for active zones
● Zone Fills - Optional semi-transparent zone highlighting for enhanced visual clarity and immediate pattern recognition
● Adaptive Styling - Automatic color and opacity adjustments based on zone scoring and statistical significance
📖Usage Guidelines
● Lookback Bars - Default 500, Range 100-1000, Controls the historical data window for pivot analysis and zone calculation
● Pivot Left/Right - Default 3, Range 1-10, Defines the pivot detection sensitivity and confirmation requirements
● Bin Size ATR units - Default 0.25, Range 0.1-2.0, Controls price level clustering granularity for zone creation
● Base Zone Half-Width ATR units - Default 0.25, Range 0.1-1.0, Sets the minimum zone width in ATR units for institutional level boundaries
● Zone Merge IoU Threshold - Default 0.5, Range 0.1-0.9, Intersection over Union threshold for automatic zone merging algorithms
● Max Active Zones - Default 5, Range 3-20, Maximum number of zones displayed simultaneously to prevent chart clutter
● Probability Threshold for Labels - Default 0.6, Range 0.3-0.9, Minimum reaction probability required for zone label display and alerts
● Distance Weight w1 - Controls influence of price distance from zone center on reaction probability
● Width Weight w2 - Adjusts impact of zone width on probability calculations
● Volume Weight w3 - Modifies volume Z-score influence on zone strength assessment
● VWAP Weight w4 - Controls VWAP deviation impact on institutional level significance
● Touch Count Weight w5 - Adjusts influence of historical zone interactions on probability scoring
● Hit Rate Weight w6 - Controls prior success rate impact on future reaction likelihood predictions
● Wick Penetration Weight w7 - Modifies wick penetration analysis influence on probability calculations
● Trend Weight w8 - Adjusts trend context impact using ADX analysis for directional bias assessment
✅Best Use Cases
● Swing Trading Entries - Enter positions at high-probability institutional zones with 60%+ reaction scores
● Scalping Opportunities - Quick entries and exits around frequently tested institutional levels
● Risk Management - Use zones as dynamic stop-loss and take-profit levels based on institutional behavior
● Market Structure Analysis - Identify key institutional levels that define current market structure and sentiment
● Confluence Trading - Combine with other technical indicators for high-probability trade setups
● Session-Based Strategies - Focus analysis during high-volume sessions for maximum effectiveness
⚠️Limitations
● Historical Pattern Dependency - Algorithm effectiveness relies on historical patterns that may not repeat in changing market conditions
● Computational Intensity - Complex calculations may impact chart performance on lower-end devices or with multiple indicators
● Probability Estimates - Reaction probabilities are statistical estimates and do not guarantee actual market outcomes
● Session Sensitivity - Performance may vary significantly between different market sessions and volatility regimes
● Parameter Sensitivity - Results can be highly dependent on input parameters requiring optimization for different instruments
💡What Makes This Unique
● CNN Architecture - First indicator to apply convolutional neural network principles to institutional-level detection
● Real-Time ML Scoring - Live machine learning probability calculations for each zone interaction
● Advanced Zone Management - Sophisticated algorithms for zone lifecycle management and automatic optimization
● Statistical Rigor - Comprehensive 9-factor logistic regression model with extensive backtesting validation
● Performance Optimization - Efficient processing algorithms designed for real-time trading applications
🔬How It Works
● Multi-timeframe pivot identification - Uses configurable sensitivity parameters for advanced pivot detection
● ATR-normalized strength calculations - Standardizes pivot significance across different volatility regimes
● Volume Z-score integration - Enhanced pivot weighting based on time-of-day volume patterns
● Price level clustering - Neural network binning algorithms with ATR-based sizing for zone creation
● Recency decay applications - Weights recent pivots more heavily than historical data for relevance
● Statistical filtering - Eliminates low-significance price levels and reduces market noise
● Dynamic zone generation - Creates zones from statistically significant pivot clusters with minimum support thresholds
● IoU-based merging algorithms - Combines overlapping zones while maintaining accuracy using Intersection over Union
● Adaptive decay systems - Automatic removal of outdated or low-performing zones for optimal performance
● 9-factor logistic regression - Incorporates distance, width, volume, VWAP, touch history, and trend analysis
● Real-time scoring updates - Zone interaction calculations with configurable threshold filtering
● Optional CNN filters - Gradient detection, smoothing, and Difference of Gaussians processing for enhanced accuracy
💡Note
This indicator represents advanced quantitative analysis and should be used by traders familiar with statistical modeling concepts. The probability scores are mathematical estimates based on historical patterns and should be combined with proper risk management and additional technical analysis for optimal trading decisions.
Andean Oscillator (Version 3.0 Sr.K)Andean Oscillator (Version 3.0 Sr.K)
This indicator is a momentum-based oscillator that measures the balance between bullish and bearish pressure.
🔧 How it works:
It calculates two adaptive envelopes around price and derives a "bullish" and "bearish" component.
The oscillator value is simply Bull - Bear, showing which side dominates.
A signal line (EMA of the oscillator) smooths the raw value.
Optionally, ±1σ levels are plotted to highlight statistically strong moves.
📊 What you see:
Histogram: Positive bars = bullish momentum, negative bars = bearish.
Orange Line: Signal line (EMA) used to confirm or anticipate reversals.
Zero Line: The equilibrium point. Crosses of this level signal a shift in market bias.
Green / Red Triangles: Buy and sell signals, either when crossing zero or crossing the signal line (depending on selected mode).
⚡ Early Signal Mode:
When enabled, signals trigger earlier — at the crossover between the oscillator and its signal line — allowing traders to enter potential reversals before a full zero-cross confirmation.
✅ Use cases:
Identify momentum shifts before price reversals.
Spot potential long/short setups with reduced lag.
Combine with price action or support/resistance for confirmation.
⚠️ Note: This is a tool for discretionary/manual trading. It does not open or close trades automatically. Always confirm with your own analysis and risk management.
Strong BUY/SELL with BB + RSI + MACD (with alerts)Outer Bands (same as before)
BUY when price < lower BB + RSI < 30 + MACD bullish.
SELL when price > upper BB + RSI > 70 + MACD bearish.
Middle Band (new addition)
BUY when price crosses above middle band (basis) AND RSI > 50 + MACD bullish.
SELL when price crosses below middle band (basis) AND RSI < 50 + MACD bearish.
EMP Probabilistic [CHE]Part 1 — For Traders (Practical Overview, no formulas)
What this tool does
EMP Probabilistic \ turns raw price action into a clean, probability-aware map. It builds two adaptive bands around the session open of a higher timeframe you choose (called the S-timeframe) and highlights a robust median threshold. At a glance you know:
Where price has recently tended to stay,
Whether current momentum sits above or below the median, and
A live Long vs. Short probability based on recent outcomes.
Why it improves decisions
Objective context in any regime: The nonparametric band comes straight from recent market behavior, without assuming a particular distribution.
Volatility-aware risk lens: The parametric band adapts to current volatility, helping you judge stretch and room for continuation or snap-back.
No lookahead: All stats update only after an S-bar is finished. That means the panel reflects information you truly had at that time.
How to read the chart
Orange band = empirical, distribution-free range derived from recent session returns (nonparametric).
Teal band = volatility-scaled range around the session open (parametric).
Median dots: green when close is above the median threshold, red when below.
Info panel: shows the active S-timeframe, window sizes, live coverage for both bands, the internal width parameter and volatility estimate, plus a one-line summary.
Probability label: “Long XX% • Short YY%” — a simple read on the recent balance of up vs. down S-bars.
How to use it (quick start)
1. Choose S-timeframe with Auto, Multiplier, or Manual. “Auto” scales your chart TF up to a sensible higher step.
2. Set alpha to control how tight the inner band should be. A typical value gives you a comfortable center zone without cutting off healthy trends.
3. Trade the context:
Trend-following: Prefer longs when price holds above the median; prefer shorts when it stays below.
Mean-reversion: Fade moves near the outer edges during ranges; look for reversion back toward the median.
Breakout filter: Require closes that push and hold beyond the volatility band for momentum plays; avoid noise when price chops inside the middle of the orange band.
Risk management made practical
Size positions relative to the teal band width to keep risk consistent across instruments and regimes.
For stops, many traders set them just beyond the opposite orange bound or use a fraction of the teal band.
Watch the panel’s coverage readouts and Brier score; when they deteriorate, the market may be shifting — reduce size or demand stronger confirmation.
Suggested presets
Scalping (Crypto/FX): Auto S-TF, alpha around a fifth, calibration window near two hundred, RS volatility, metrics window near two hundred.
Intraday Futures: Multiplier 3–5× your chart TF; similar alpha and window sizes; RS volatility is a solid default.
Swing/Equities: S-TF at least daily; test both RS and GK volatility modes; keep windows on the larger side for stability.
What makes it different
Two complementary lenses: a distribution-free read of recent behavior and a volatility-scaled read for risk and stretch.
Self-calibrating width: the parametric band quietly nudges its internal multiplier so actual coverage tracks your target.
Clean UX: grouped inputs, tooltips, an info panel that tells you what’s going on, and a simple median bias you can act on.
Repainting & timing
The logic updates only when the S-bar closes. On lower-timeframe charts you’ll see intrabar flips of the dot color — that’s just live price moving around. For strict signals, confirm on S-bar close.
Friendly note (not financial advice)
Use this as a context engine. It won’t predict the future, but it will keep you on the right side of probability and volatility more often, which is exactly where consistency starts.
Part 2 — Under the Hood (Conceptual, no formulas)
Data and timeframe design
The script works on a higher S-timeframe you select. It fetches the open, high, low, close, and time of that S-bar. Internally, it only updates its rolling windows after an S-bar has finished. It then pushes the previous S-bar’s statistics into its arrays. That design removes lookahead and keeps the metrics out-of-sample relative to the current S-bar.
Nonparametric band (distribution-free)
The orange band comes from the empirical distribution of recent session-level close-minus-open moves. The script keeps a rolling window, sorts a safe copy, and reads three key points: a lower bound, a median, and an upper bound. Because it’s based purely on observed outcomes, it adapts naturally to skew, fat tails, and regime shifts without assuming any particular shape. The orange range shows “where price has tended to live” lately on the chosen S-timeframe.
Parametric band (volatility-scaled)
The teal band models log-space variability around the session open using one of two well-known OHLC volatility estimators: Rogers–Satchell or Garman–Klass. Each estimator contributes a per-bar variance figure; the script averages these across the rolling window to form a current volatility scale. It then builds a symmetric band around the session open in price space. This gives you a volatility-aware notion of stretch that complements the distribution-free orange band.
Self-calibration of band width
The teal band has an internal width multiplier. After each completed S-bar the script checks whether the realized move stayed inside that band. If the band was too tight, the multiplier is nudged upward; if it was too loose, it’s eased downward. A simple learning rate governs how quickly it adapts. Over time this keeps the realized inside-coverage close to the target implied by your alpha setting, without you having to hand-tune anything.
Long/Short probability and calibration quality
The Long vs. Short probability is a transparent statistic: it’s just the recent fraction of up sessions in the rolling window. It is not a complex model — and that’s the point. You get an honest, intuitive read on directional tendency.
To monitor how well this simple probability lines up with reality, the script tracks a Brier-style score over a separate metrics window. Lower is better: it means your recent probability read has matched outcomes more closely.
Coverage tracking for both bands
The panel reports coverage for the orange band (nonparametric) and the teal band (parametric). These are rolling averages of how often recent S-bar moves landed inside each band. Watching these two numbers tells you whether market behavior still aligns with the recent distribution and with the current volatility model.
Why it doesn’t repaint
Because the arrays update only when an S-bar closes and only push the previous bar’s stats, the panel and metrics reflect information you had at the time. Intrabar visuals can change while a bar is forming — that’s expected — but the decision framework itself is anchored to completed S-bars.
Performance and practicality
The heaviest step is sorting a copy of the window for the nonparametric band. With typical window sizes this stays responsive on TradingView. The volatility estimators and rolling averages are lightweight. Inputs are grouped with clear tooltips so you can tune without hunting.
Limitations and good practice
In thin or gappy markets the bands can jump; consider a larger window or a higher S-timeframe.
During violent regime shifts, shorten the window and increase the learning rate slightly so the teal band catches up faster — but don’t overdo it, or you’ll chase noise.
The Long/Short probability is intentionally simple; it’s a context indicator, not a standalone signal factory. Combine it with structure, volume, or your execution rules.
Takeaway
Under the hood, the script blends empirical behavior and volatility scaling, then self-calibrates so the teal band’s real-world coverage stays near your target. You get clarity, consistency, and a dashboard that tells you when its own assumptions are holding up — exactly what you need to trade with confidence.
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Best regards and happy trading
Chervolino
BOCS Adaptive🚀 BOCS Adaptive - Advanced Dynamic Volatility Breakout Channel System
Enhanced version of AlgoAlpha's Smart Money Breakout Channels with adaptive ATR-based risk management for professional-grade trading signals.
📜 CREDITS & ATTRIBUTION:
This indicator is based on the original "Smart Money Breakout Channels" by AlgoAlpha (). Full credit goes to AlgoAlpha for the innovative breakout channel detection methodology. This enhanced version adds adaptive ATR-based TP/SL functionality and advanced volume analysis features.
🔬 THE BOCS METHODOLOGY EXPLAINED:
What is BOCS?
BOCS (Breakout Channel System) is AlgoAlpha's sophisticated algorithm that identifies high-probability breakout opportunities by analyzing normalized price volatility patterns. Unlike traditional support/resistance methods, BOCS uses mathematical normalization to detect when markets are consolidating before explosive moves.
📊 HOW THE CHANNEL DETECTION WORKS (Original AlgoAlpha Method):
Step 1: Price Normalization
Calculates the highest high and lowest low over a specified period (default 100 bars)
Normalizes current price position within this range: (close - lowest) / (highest - lowest)
This creates a 0-1 scale that works across all markets and timeframes
Step 2: Volatility Analysis
Applies standard deviation to the normalized price over 14 periods
Identifies volatility peaks and troughs using specialized algorithms
Tracks volatility cycles to predict consolidation phases
Step 3: Channel Formation
Detects when volatility crosses from high to low (consolidation begins)
Creates dynamic channels using the highest/lowest points during consolidation
Channels automatically expand/contract based on price action
Minimum 10-bar duration ensures meaningful consolidation patterns
Step 4: Breakout Detection
Strong Closes Mode: Requires >50% of candle body outside channel (reduces false signals from wicks)
Any Touch Mode: Triggers on any price movement outside channel boundaries
Volume confirmation analysis validates breakout strength
🆕 ENHANCED FEATURES (This Version):
⚡ Adaptive ATR Risk Management:
Revolutionary Volatility-Based TP/SL System:
Traditional fixed pip/tick stops don't account for changing market conditions. This enhanced version adds ATR (Average True Range) multipliers to create dynamic TP/SL levels that automatically adjust to current volatility.
ATR Calculation Process:
Select any timeframe for ATR source (1min, 5min, 15min, etc.)
Uses customizable period length (default 14) for smoothing
Calculates: TP Distance = ATR × Multiplier
Updates continuously as market volatility changes
Example Setup:
Chart: 5-minute NQ futures
ATR Source: 1-minute timeframe
Current 1min ATR: 4.36 points
TP1 Multiplier: 2.0 → TP1 = 8.72 points from entry
TP2 Multiplier: 3.5 → TP2 = 15.26 points from entry
SL Multiplier: 1.0 → SL = 4.36 points from entry
📈 ENHANCED VOLUME ANALYSIS SYSTEM:
Three Advanced Volume Modes (Enhanced from Original):
1. Volume Mode:
Displays total volume relative to 20-period moving average
Visual transparency indicates volume strength
Helps identify accumulation/distribution phases
2. Comparison Mode:
Separates up volume (green) vs down volume (red)
Shows buying vs selling pressure within channels
Critical for breakout direction bias
3. Delta Mode:
Calculates net volume delta (up volume - down volume)
Positive delta = buying pressure (above midline)
Negative delta = selling pressure (below midline)
Uses multi-timeframe data for granular analysis
🎯 VOLUME CONFIRMATION ALGORITHM (Enhanced):
Breakout Validation System:
Compares breakout volume to 20-period average
CONFIRMED: Volume >120% of average (strong breakout)
WEAK: Volume 80-120% of average (proceed with caution)
FAILED: Volume <80% of average (likely false breakout)
Volume Gauge Feature (New):
Real-time volume delta visualization
Color-coded pressure indicator (red to green spectrum)
Shows current positioning within high/low volume range
Updates continuously during active channels
📊 COMPREHENSIVE TRADE MONITORING (Enhanced):
Real-Time Analysis Table:
Trade status and direction
Channel formation status
Current ATR value and timeframe
Calculated TP/SL distances with multipliers
Last breakout analysis with volume confirmation
Current vs average volume comparison
Volume strength rating (Very High/High/Normal/Low)
🔔 INTELLIGENT ALERT SYSTEM (Enhanced):
Six Alert Types:
New Channel Formation - Consolidation pattern detected
Bullish Breakout - Upward channel break with entry price
Bearish Breakout - Downward channel break with entry price
Take Profit 1 Hit - First target reached (New)
Take Profit 2 Hit - Second target reached (New)
Stop Loss Hit - Risk management triggered (New)
🎨 VISUAL FEATURES (Enhanced):
Channel Visualization (Original AlgoAlpha Design):
Semi-transparent main channel box
Colored upper/lower zones (red=resistance, green=support)
Dashed center line for reference
Volume bars within channels
Real-time volume gauge (new)
TP/SL Display (New Enhancement):
White entry line with price label
Green TP lines with distance calculations
Red SL line with distance calculation
Customizable line lengths and colors
Shows both price levels AND point distances
⚙️ ADVANCED CUSTOMIZATION (Enhanced):
Original AlgoAlpha Settings:
Nested channels (multiple overlapping) or single channel mode
Strong closes only vs any touch breakouts
Normalization and detection lengths
Volume analysis timeframe selection
New ATR Risk Management Settings:
Independent ATR timeframe selection
Customizable ATR calculation period
Separate multipliers for TP1, TP2, and SL
Toggle TP2 on/off as needed
Enhanced Display Options:
Four table positions with offset controls
Three table sizes (Small/Normal/Large)
Volume text sizing and positioning
Complete color customization
Show/hide individual components
📈 OPTIMAL USE CASES:
Scalping (1-5 minute charts):
Use 1-minute ATR for responsive risk management
Enable strong closes mode for cleaner signals
Monitor volume confirmation closely
Day Trading (5-30 minute charts):
Use 5-minute ATR for balanced approach
Enable nested channels for multiple setups
Focus on volume delta for direction bias
Swing Trading (1-4 hour charts):
Use 15-30 minute ATR for stable levels
Longer detection periods for significant channels
Emphasize volume confirmation for major moves
📊 COMPATIBLE MARKETS:
✅ Forex pairs (EUR/USD, GBP/USD, USD/JPY, etc.)
✅ Stock indices (SPY, QQQ, IWM, DIA)
✅ Futures (ES, NQ, YM, RTY, CL, GC)
✅ Individual stocks (AAPL, TSLA, GOOGL, etc.)
✅ Cryptocurrencies (BTC, ETH, altcoins)
✅ Commodities (Gold, Silver, Oil, etc.)
🙏 ACKNOWLEDGMENTS:
Special thanks to AlgoAlpha for creating the original Smart Money Breakout Channels indicator and sharing it with the TradingView community. Their innovative approach to breakout detection formed the foundation for this enhanced version. Please support the original creator by checking out their other excellent indicators.
⚠️ RISK DISCLAIMER:
This indicator is designed for educational and analytical purposes only. Trading involves substantial risk of loss and is not suitable for all investors. Past performance does not guarantee future results. The BOCS Adaptive system, while sophisticated, should be used as part of a comprehensive trading strategy that includes proper risk management, position sizing, and market analysis. Always conduct your own due diligence and consider consulting with a qualified financial advisor before making trading decisions. No system can guarantee profitable trades, and users should never risk more than they can afford to lose.
Volume Candle Rings [CHE]Volume Candle Rings – Spot Volume Extremes Fast 🔍
Marks exceptionally high volume right on the candle as concentric rings. Instantly see how extreme the spike is (levels 1–10), where it happens (anchor on HL2/Close/BodyMid), and how big it is relative to volatility (ATR-scaled). No magic, no blind signals—just clean context for better decisions.
Why it helps 🎯
Catch true extremes: Positive-side Z-Score maps spikes into 10 levels. By default, only 8/9/10 show—the ones that matter.
Context over clutter: Rings sit on the candle, scale with ATR (market regime), and widen in bars (time). Read absorption, breakout thrusts, or capitulation in context.
Signal the new, not the noise: Optional OFF→ON only drawing cuts chart noise and highlights fresh events.
How it works ⚙️
Z-Score: `z = (Vol – SMA(Vol, lookback)) / StDev(Vol, lookback)` → clipped at `zScoreCap`, normalized, and binned to 1..10 (0 = none). Only z > 0 counts.
Geometry: Vertical diameter = `Level × ATR(atrLength) × atrPerLevel`; horizontal radius = `Level × xBarsPerLevel` bars; curvatureFactor controls roundness.
Anchor: Choose HL2, Close, or BodyMid for the vertical center.
Performance: Keeps up to maxStoredCircles; FIFO cleanup to stay smooth.
Typical use cases 📈
Breakout confirmation: Clusters of 8–10 at range edges → rising initiative.
Absorption / fade: Extreme ring (9–10) without follow-through → potential stall or reversal.
Blow-off / climax: Single huge ring after a long run → higher odds of mean reversion.
News filtering: Show the real outliers, not every minor bump.
Inputs (mapped 1:1) 🧩
Z-Score & Levels
Lookback (SMA/StDev) – default 200
Z-Score Clipping – default 5.0
Behavior
Draw every bar – default ON; OFF = only on OFF→ON switches
Max circles to retain – default 120
Anchoring & Geometry
Anchor on candle – HL2 / Close / BodyMid
ATR Length – default 50
ATR per Level (Y) – default 0.25
Bars per Level (X) – default 0.15
Circle curvature – default 0.70
Level Selection (1–10)
Default: 8/9/10 ON, 1–7 OFF. Colors grade from teal/green → orange → red; fill opacity separate.
Quick presets ⏱️
Intraday (1–5m): Lookback 150–250, Cap 4.0–5.0, ATR/Level 0.20–0.30, Bars/Level 0.10–0.20, Draw every bar OFF.
Swing (1H–1D): Lookback 200–300, Cap 5.0, ATR/Level 0.25–0.35, Bars/Level 0.15–0.25, keep 8–10.
Aggressive scouting: Also enable Level 7 for early accumulation.
Pro tips 💡
Control object load: Reduce maxStoredCircles or switch Draw every bar OFF on busy charts.
Seek confluence: Combine rings with S/R, range edges, VWAP, session H/L. A ring is information, not an entry by itself.
Color discipline: Reserve red (9/10) for true extremes; keep lower levels subtle.
Limits & notes 🧭
This is visualization, not alerts or auto signals.
Many polylines can slow charts—tune Behavior settings.
Works across markets/timeframes; adapt parameters to the asset’s character.
Who it’s for 🙌
Traders who read volume in price context—breakouts, fades, reversals. See when the market is truly stepping on the gas.
Volume Candle Rings \ turns raw volume into precise, scale-aware markers. Spot extremes faster, avoid confusing “loud” with “important,” and make cleaner, context-driven decisions. 🚀
Disclaimer
The content provided, including all code and materials, is strictly for educational and informational purposes only. It is not intended as, and should not be interpreted as, financial advice, a recommendation to buy or sell any financial instrument, or an offer of any financial product or service. All strategies, tools, and examples discussed are provided for illustrative purposes to demonstrate coding techniques and the functionality of Pine Script within a trading context.
Any results from strategies or tools provided are hypothetical, and past performance is not indicative of future results. Trading and investing involve high risk, including the potential loss of principal, and may not be suitable for all individuals. Before making any trading decisions, please consult with a qualified financial professional to understand the risks involved.
By using this script, you acknowledge and agree that any trading decisions are made solely at your discretion and risk.
Best regards and happy trading
Chervolino
Ultimate SAn indicator for comparing two stocks is a tool that analyzes the relative performance of one stock against another, helping traders and investors identify which asset is stronger or weaker over a given period. This is often done using a ratio chart, where the price of one stock is divided by the price of the other, creating a line that shows shifts in relative strength. If the line trends upward, the first stock is outperforming; if it trends downward, the second stock is stronger. Such indicators are useful for portfolio allocation, pairs trading, and spotting market rotation between sectors or companies. They simplify side-by-side evaluation and provide a clearer picture of relative momentum than looking at individual charts alone.
EMA Ribbon - Adjustable with Toggles📌 Script Name:
EMA Ribbon - Adjustable with Toggles
🧠 Primary Function:
This script plots a customizable Exponential Moving Average (EMA) Ribbon on Trading View charts. It allows the user to enable or disable any of the 8 EMAs individually and shows buy/sell signals based on the crossover between the fastest and slowest EMAs.
⚙️ Key Features:
✅ User Controls:
Toggle ON/OFF each of the 8 EMAs independently.
Set the length of each EMA (from 1 upward).
EMA colors vary based on their speed (green for faster, orange for slower).
📈 EMA Calculation:
Calculates 8 separate EMAs using the closing price (close).
🎨 Chart Visualization:
Plots each EMA with a unique color and transparency.
Draws a colored ribbon between the highest and lowest active EMAs to visualize trend zones.
📊 Trend Direction Logic:
The trend is determined solely based on EMA 1 (fastest) and EMA 8 (slowest).
A bullish trend is when EMA 1 > EMA 8, and bearish when EMA 1 < EMA 8.
📍 Buy/Sell Signals:
Buy Signal: When the trend shifts from bearish to bullish (EMA 1 crosses above EMA 8).
Sell Signal: When the trend shifts from bullish to bearish (EMA 1 crosses below EMA 8).
Signals are displayed as green (buy) and red (sell) triangles on the chart.
🔔 Alerts:
Built-in alert conditions for buy and sell signals.
Custom alert messages in Arabic (can be modified if needed).
🌟 Additional Highlights:
Well-structured and easy to expand.
Great for trend-following strategies using EMA ribbons.
Helps identify consolidation zones and trend confirmation.
TMA and Oracle MoveCombined view of both TMA indicator and Oracle Move indicator. This results in more reliable prediction of valuable Entry and Exit condition.