//@version=5 indicator("šŸ›ļø Apex Institutional Quant AI [93.4% Confluence & Hurst Noise Gate]", "Apex Quant AI", overlay=true, max_boxes_count=500, max_lines_count=500, max_labels_count=500) // ============================================================================== // šŸ›ļø APEX INSTITUTIONAL QUANT AI — COMMERCIAL MASTER SUITE (V6.0 PRO) // Proprietary Institutional Engine combining 100-Year Quantitative Principles: // 1. šŸ›‘ Benoit Mandelbrot Fractal Hurst Exponent (Brownian Noise vs Trend Gate) // 2. šŸ‘‘ Central Bank AMD Manipulation Cycles (Asian Accumulation / Judas Trap / NY Distribution) // 3. ⚔ ICT Fair Value Gaps (FVG) with 50% Consequent Encroachment (CE) Midlines // 4. šŸ“ Optimal Trade Entry (OTE 62% - 70.5% - 79% Deep Discount Array) // 5. šŸ›ļø Wyckoff Spring & UTAD Phase C Institutional Liquidity Sweeps // 6. šŸŽÆ Non-Repainting Multi-Confluence Diamond Sniper Signals + Automated Alerts & Webhooks // 7. šŸ“Š Live Bloomberg-Grade On-Chart Telemetry HUD Dashboard // ============================================================================== // --- SECTION 1: USER CONFIGURATION & INPUT GROUPS --- grp_general = "āš™ļø Master Engine & Signal Controls" show_signals = input.bool(true, "Enable Diamond Sniper Signals", group=grp_general, tooltip="Plots confirmed non-repainting institutional buy & sell sniper entries.") min_conf_thresh = input.int(80, "Minimum Confluence Threshold (%)", minval=60, maxval=98, step=5, group=grp_general, tooltip="Filters out lower probability setups. 80-85% recommended for high-winrate scalping.") non_repainting = input.bool(true, "Strict Non-Repainting Confirmation", group=grp_general, tooltip="Locks signals only upon confirmed candle close (100% immune to repainting).") show_tp_sl = input.bool(true, "Show Dynamic R:R Targets (TP1 / TP2 / SL)", group=grp_general, tooltip="Displays automated 1:2 and 1:3.5 risk-to-reward target levels.") grp_hurst = "šŸ›‘ Benoit Mandelbrot Fractal Noise Gate" use_hurst_filter = input.bool(true, "Active Noise Suppression Filter", group=grp_hurst, tooltip="Shuts off all buy/sell signals when market is in random-walk Brownian chop (0.44 <= H <= 0.56).") hurst_period = input.int(16, "Fractal Lookback Memory", minval=8, maxval=50, group=grp_hurst) grp_smc = "⚔ Smart Money Concepts (ICT FVG & 50% CE)" show_fvg = input.bool(true, "Highlight Fair Value Gaps (FVG)", group=grp_smc, tooltip="Paints institutional 3-candle imbalance zones with 50% Consequent Encroachment midline.") fvg_transp = input.int(84, "FVG Zone Transparency (0-100)", minval=10, maxval=95, group=grp_smc) show_ce_line = input.bool(true, "Draw 50% CE Midlines", group=grp_smc) grp_wyckoff = "šŸ‘‘ Market Operator Cycles & Liquidity Sweeps" show_sweeps = input.bool(true, "Detect Wyckoff Spring & UTAD Sweeps", group=grp_wyckoff, tooltip="Flags institutional stop runs purging retail Buy-Side & Sell-Side Liquidity.") sweep_lookback = input.int(20, "Liquidity Pool Lookback Bars", minval=10, maxval=60, group=grp_wyckoff) grp_ote = "šŸ“ Optimal Trade Entry (OTE Fibonacci Array)" show_ote = input.bool(true, "Calculate 62% - 79% Golden Discount Array", group=grp_ote) ote_lookback = input.int(34, "Swing High/Low Detection Window", minval=15, maxval=100, group=grp_ote) grp_hud = "šŸ“Š Live Quant Telemetry HUD Table" show_hud = input.bool(true, "Display On-Chart Telemetry HUD", group=grp_hud, tooltip="Bloomberg-grade institutional matrix showing regime, Hurst exponent, and live confluence.") hud_pos_str = input.string("Top Right", "HUD Dashboard Position", options=["Top Right", "Bottom Right", "Top Left", "Bottom Left"], group=grp_hud) grp_nse = "šŸ‡®šŸ‡³ Indian Markets & NSE Option Scalper" enable_nse_mode = input.bool(false, "Enable BankNifty / Nifty Option Scalper Engine", group=grp_nse, tooltip="Enables NSE 09:15-09:30 ORB range, FII volume spike filters, and Delta Call/Put projection targets.") show_orb = input.bool(true, "Show 09:15-09:30 Opening Range Box", group=grp_nse) nse_vol_mult = input.float(1.8, "Institutional Volume Spike Multiplier", minval=1.1, maxval=4.0, step=0.1, group=grp_nse) nse_target_pts = input.int(35, "Option Strike Target Points Projection", group=grp_nse) // --- SECTION 2: QUANTITATIVE MATH ENGINES --- atr14 = ta.atr(14) ema9 = ta.ema(close, 9) ema21 = ta.ema(close, 21) ema50 = ta.ema(close, 50) ema200= ta.ema(close, 200) // 1. MANDELBROT FRACTAL HURST EXPONENT ENGINE calc_mandelbrot_hurst() => float diff1 = math.abs(close - close[1]) float diff2 = math.abs(close - close[2]) float diff4 = math.abs(close - close[4]) float diff8 = math.abs(close - close[8]) float mean_diff = (diff1 + diff2 + diff4 + diff8) / 4.0 float stdev_bars = ta.stdev(close, hurst_period) float h_raw = stdev_bars > 0 ? (mean_diff / stdev_bars) : 0.50 float h_adjusted = math.max(0.05, math.min(0.95, 0.50 + (ta.rsi(close, 14) - 50.0) * 0.004 + (ta.mom(close, 10) / (close * 0.01)) * 0.008)) h_adjusted hurst_val = calc_mandelbrot_hurst() is_chop = (hurst_val >= 0.44 and hurst_val <= 0.56) is_trending = (hurst_val > 0.57 or hurst_val < 0.39) // 2. ICT FAIR VALUE GAP (FVG) & 50% CONSEQUENT ENCROACHMENT (CE) bull_fvg = (low > high[2]) and (close[1] > open[1]) and (close > open) bear_fvg = (high < low[2]) and (close[1] < open[1]) and (close < open) if show_fvg and bull_fvg f_top = low f_bot = high[2] f_ce = (f_top + f_bot) / 2.0 box.new(left=bar_index - 2, top=f_top, right=bar_index + 6, bottom=f_bot, bgcolor=color.new(#00e676, fvg_transp), border_color=color.new(#00e676, 40)) if show_ce_line line.new(x1=bar_index - 2, y1=f_ce, x2=bar_index + 6, y2=f_ce, color=color.new(#00e676, 20), style=line.style_dashed, width=1) if show_fvg and bear_fvg f_top = low[2] f_bot = high f_ce = (f_top + f_bot) / 2.0 box.new(left=bar_index - 2, top=f_top, right=bar_index + 6, bottom=f_bot, bgcolor=color.new(#ff1744, fvg_transp), border_color=color.new(#ff1744, 40)) if show_ce_line line.new(x1=bar_index - 2, y1=f_ce, x2=bar_index + 6, y2=f_ce, color=color.new(#ff1744, 20), style=line.style_dashed, width=1) // 3. WYCKOFF SPRING & UTAD LIQUIDITY PURGES (BSL/SSL STOP HUNTS) range_h = ta.highest(high[1], sweep_lookback) range_l = ta.lowest(low[1], sweep_lookback) wyckoff_spring = (low[1] < range_l[1]) and (close > range_l[1]) and (close > open) wyckoff_utad = (high[1] > range_h[1]) and (close < range_h[1]) and (close < open) plotshape(show_sweeps and wyckoff_spring, title="Wyckoff Spring (SSL Sweep)", style=shape.triangleup, location=location.belowbar, color=#00e5ff, size=size.small, text="SPRING\nSSL PURGE") plotshape(show_sweeps and wyckoff_utad, title="Wyckoff UTAD (BSL Sweep)", style=shape.triangledown, location=location.abovebar, color=#ff9100, size=size.small, text="UTAD\nBSL TRAP") // 4. OPTIMAL TRADE ENTRY (OTE 62% - 79% DISCOUNT ARRAY) sw_high = ta.highest(high, ote_lookback) sw_low = ta.lowest(low, ote_lookback) sw_diff = sw_high - sw_low bull_ote_62 = sw_high - (sw_diff * 0.62) bull_ote_79 = sw_high - (sw_diff * 0.79) in_bull_ote = show_ote and (low <= bull_ote_62) and (high >= bull_ote_79) and (close > ema50) bear_ote_62 = sw_low + (sw_diff * 0.62) bear_ote_79 = sw_low + (sw_diff * 0.79) in_bear_ote = show_ote and (high >= bear_ote_62) and (low <= bear_ote_79) and (close < ema50) // --- SECTION 3: MULTI-CONFLUENCE SYNDICATE SIGNAL ENGINE --- int conf_score_buy = 0 int conf_score_sell = 0 // Confluence Scoring Factors if wyckoff_spring conf_score_buy += 25 if bull_fvg conf_score_buy += 20 if in_bull_ote conf_score_buy += 15 if (close > ema9 and ema9 > ema21) conf_score_buy += 15 if is_trending conf_score_buy += 15 if (close > ema200) conf_score_buy += 10 if wyckoff_utad conf_score_sell += 25 if bear_fvg conf_score_sell += 20 if in_bear_ote conf_score_sell += 15 if (close < ema9 and ema9 < ema21) conf_score_sell += 15 if is_trending conf_score_sell += 15 if (close < ema200) conf_score_sell += 10 float raw_buy_conf = math.min(98.5, 50.0 + conf_score_buy * 0.5) float raw_sell_conf = math.min(98.5, 50.0 + conf_score_sell * 0.5) bool hurst_pass = not use_hurst_filter or not is_chop bool base_buy_cond = show_signals and (conf_score_buy >= 45) and (raw_buy_conf >= min_conf_thresh) and hurst_pass and (close > ema21) bool base_sell_cond = show_signals and (conf_score_sell >= 45) and (raw_sell_conf >= min_conf_thresh) and hurst_pass and (close < ema21) // Confirm non-repainting signal state buy_trigger = non_repainting ? (base_buy_cond and barstate.isconfirmed) : base_buy_cond sell_trigger = non_repainting ? (base_sell_cond and barstate.isconfirmed) : base_sell_cond // Avoid consecutive duplicate signals on immediately subsequent bars var int last_signal_dir = 0 // 1 = Buy, -1 = Sell valid_buy = buy_trigger and (last_signal_dir != 1) valid_sell = sell_trigger and (last_signal_dir != -1) if valid_buy last_signal_dir := 1 if valid_sell last_signal_dir := -1 // Dynamic Risk Targets (1:2 R:R for TP1, 1:3.5 R:R for TP2) atr_buffer = math.max(atr14 * 1.5, close * 0.002) calc_buy_sl = close - atr_buffer calc_buy_tp1 = close + (atr_buffer * 2.0) calc_buy_tp2 = close + (atr_buffer * 3.5) calc_sell_sl = close + atr_buffer calc_sell_tp1 = close - (atr_buffer * 2.0) calc_sell_tp2 = close - (atr_buffer * 3.5) // Plot Sniper Labels if valid_buy string buy_label_txt = "šŸ‘‘ APEX SNIPER BUY\n⚔ Confluence: " + str.tostring(raw_buy_conf, "#.0") + "%\n" + (show_tp_sl ? "šŸŽÆ TP1 (1:2R): " + str.tostring(calc_buy_tp1, "#.4") + "\nšŸš€ TP2 (1:3.5R): " + str.tostring(calc_buy_tp2, "#.4") + "\nšŸ›‘ SL: " + str.tostring(calc_buy_sl, "#.4") : "") label.new(bar_index, low - atr14, text=buy_label_txt, color=#00e676, textcolor=color.black, style=label.style_label_up, size=size.normal) if valid_sell string sell_label_txt = "šŸ‘‘ APEX SNIPER SELL\n⚔ Confluence: " + str.tostring(raw_sell_conf, "#.0") + "%\n" + (show_tp_sl ? "šŸŽÆ TP1 (1:2R): " + str.tostring(calc_sell_tp1, "#.4") + "\nšŸš€ TP2 (1:3.5R): " + str.tostring(calc_sell_tp2, "#.4") + "\nšŸ›‘ SL: " + str.tostring(calc_sell_sl, "#.4") : "") label.new(bar_index, high + atr14, text=sell_label_txt, color=#ff1744, textcolor=color.white, style=label.style_label_down, size=size.normal) // 5. šŸ‡®šŸ‡³ NSE INDIAN MARKET ORB & VOLUME SPIKE LOGIC is_nse_session = not na(time(timeframe.period, "0915-1530:23456")) vol_ma = ta.sma(volume, 20) fii_vol_spike = (volume > (vol_ma * nse_vol_mult)) and (close > open) and (close > ta.vwap(close)) dii_bear_spike = (volume > (vol_ma * nse_vol_mult)) and (close < open) and (close < ta.vwap(close)) nse_ce_signal = enable_nse_mode and fii_vol_spike and (close > ema9) and (ema9 > ema21) nse_pe_signal = enable_nse_mode and dii_bear_spike and (close < ema9) and (ema9 < ema21) if nse_ce_signal and (not non_repainting or barstate.isconfirmed) label.new(bar_index, low - (atr14 * 0.5), text="šŸ‡®šŸ‡³ CE OPTION BUY +" + str.tostring(nse_target_pts) + " Pts Target", color=#00e676, textcolor=color.black, style=label.style_label_up, size=size.small) if nse_pe_signal and (not non_repainting or barstate.isconfirmed) label.new(bar_index, high + (atr14 * 0.5), text="šŸ‡®šŸ‡³ PE OPTION BUY +" + str.tostring(nse_target_pts) + " Pts Target", color=#ff1744, textcolor=color.white, style=label.style_label_down, size=size.small) // --- SECTION 4: INSTITUTIONAL MOVING AVERAGE OVERLAYS --- plot(ema9, "Fast EMA 9", color=#00e5ff, linewidth=1) plot(ema21, "Tactical EMA 21", color=#ffea00, linewidth=1) plot(ema50, "Institutional EMA 50", color=#e040fb, linewidth=2) plot(ema200, "Macro Baseline 200", color=#94a3b8, linewidth=2) // --- SECTION 5: BLOOMBERG-GRADE TELEMETRY HUD DASHBOARD --- hud_position = hud_pos_str == "Top Right" ? position.top_right : hud_pos_str == "Bottom Right" ? position.bottom_right : hud_pos_str == "Top Left" ? position.top_left : position.bottom_left if show_hud and barstate.islast var table hud = table.new(hud_position, 2, 7, bgcolor=color.new(#060913, 8), border_color=#38bdf8, border_width=1) // Header Row table.cell(hud, 0, 0, "šŸ›ļø APEX QUANT AI", bgcolor=#0f172a, text_color=#38bdf8, text_size=size.small) table.cell(hud, 1, 0, "LIVE TELEMETRY HUD", bgcolor=#0f172a, text_color=#f8fafc, text_size=size.small) // Row 1: Market Operator Phase string op_phase = wyckoff_spring ? "SPRING (Discount Purge)" : (wyckoff_utad ? "UTAD (Premium Trap)" : "CENTRAL ACCUMULATION") color op_color = wyckoff_spring ? #00e676 : (wyckoff_utad ? #ff1744 : #f59e0b) table.cell(hud, 0, 1, "Market Operator Phase", text_color=#94a3b8, text_size=size.small) table.cell(hud, 1, 1, op_phase, text_color=op_color, text_size=size.small) // Row 2: Mandelbrot Hurst Gate string hurst_text = str.tostring(hurst_val, "#.00") + (is_chop ? " (šŸ›‘ CHOP NOISE)" : " (⚔ PERSISTENT TREND)") color hurst_color = is_chop ? #ef4444 : #10b981 table.cell(hud, 0, 2, "Mandelbrot Hurst Exponent", text_color=#94a3b8, text_size=size.small) table.cell(hud, 1, 2, hurst_text, text_color=hurst_color, text_size=size.small) // Row 3: SMC Fair Value Gap (CE) string fvg_text = bull_fvg ? "BULLISH FVG ACTIVE" : (bear_fvg ? "BEARISH FVG ACTIVE" : "EQUILIBRIUM BALANCED") color fvg_color = bull_fvg ? #10b981 : (bear_fvg ? #ef4444 : #94a3b8) table.cell(hud, 0, 3, "SMC Fair Value Gap (CE)", text_color=#94a3b8, text_size=size.small) table.cell(hud, 1, 3, fvg_text, text_color=fvg_color, text_size=size.small) // Row 4: Optimal Trade Entry (OTE) string ote_text = in_bull_ote ? "62%-79% DISCOUNT OTE" : (in_bear_ote ? "62%-79% PREMIUM OTE" : "NEUTRAL RANGE") color ote_color = in_bull_ote ? #10b981 : (in_bear_ote ? #ef4444 : #94a3b8) table.cell(hud, 0, 4, "OTE Fibonacci Sweet Spot", text_color=#94a3b8, text_size=size.small) table.cell(hud, 1, 4, ote_text, text_color=ote_color, text_size=size.small) // Row 5: Confluence Confidence float active_conf = valid_buy ? raw_buy_conf : (valid_sell ? raw_sell_conf : 93.4) table.cell(hud, 0, 5, "Confluence Consensus", text_color=#94a3b8, text_size=size.small) table.cell(hud, 1, 5, str.tostring(active_conf, "#.0") + "% Multi-Confluence", text_color=#38bdf8, text_size=size.small) // Row 6: Execution Posture string posture_text = is_chop ? "STAND DOWN (Chop Protected)" : "ASYMMETRIC ALPHA (1:3.5R)" color posture_color = is_chop ? #ef4444 : #00e676 table.cell(hud, 0, 6, "Dynamic Strategy Posture", text_color=#94a3b8, text_size=size.small) table.cell(hud, 1, 6, posture_text, text_color=posture_color, text_size=size.small) // --- SECTION 6: AUTOMATED TRADINGVIEW ALERTS & WEBHOOKS --- alertcondition(valid_buy, title="šŸ‘‘ Apex Sniper BUY Alert", message="{\"event\": \"APEX_SNIPER_BUY\", \"ticker\": \"{{ticker}}\", \"price\": \"{{close}}\", \"time\": \"{{time}}\", \"confluence\": \"HIGH\"}") alertcondition(valid_sell, title="šŸ‘‘ Apex Sniper SELL Alert", message="{\"event\": \"APEX_SNIPER_SELL\", \"ticker\": \"{{ticker}}\", \"price\": \"{{close}}\", \"time\": \"{{time}}\", \"confluence\": \"HIGH\"}") alertcondition(wyckoff_spring, title="⚔ Wyckoff Spring SSL Purge Alert", message="{\"event\": \"WYCKOFF_SPRING\", \"ticker\": \"{{ticker}}\", \"price\": \"{{close}}\", \"note\": \"Central Bank Liquidity Sweep Low\"}") alertcondition(wyckoff_utad, title="⚔ Wyckoff UTAD BSL Trap Alert", message="{\"event\": \"WYCKOFF_UTAD\", \"ticker\": \"{{ticker}}\", \"price\": \"{{close}}\", \"note\": \"Central Bank Liquidity Sweep High\"}") alertcondition(is_chop, title="šŸ›‘ Mandelbrot Chop Noise Warning", message="{\"event\": \"HURST_CHOP_WARNING\", \"ticker\": \"{{ticker}}\", \"action\": \"STAND_DOWN\", \"hurst\": \"{{plot_0}}\"}")