// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © LiquidityEdgeFutures (https://liquidityedgefutures.com) // ========================================================================================================= // LIQUIDITY EDGE | MULTI-TIMEFRAME FVG MATRIX & ORDER FLOW RADAR [FREE COMMUNITY EDITION] // Precision Multi-Timeframe Imbalance Heatmap for CME NQ1!, MNQ1!, ES1! // // Features: // - Real-time higher-timeframe FVG tracking (5m, 15m, 1H, 4H) on your 1-minute execution chart // - Prevents buying into HTF Bearish Resistance or shorting into HTF Bullish Support // - Minimalist, dark-mode on-chart dashboard matrix // - Direct HTF zone collision alerts // ========================================================================================================= //@version=5 indicator("Liquidity Edge - Multi-Timeframe FVG Matrix", shorttitle="LE - MTF FVG Matrix", overlay=true, max_boxes_count=50, max_labels_count=50) // --------------------------------------------------------------------------------------------------------- // INPUTS // --------------------------------------------------------------------------------------------------------- var string G_TF = "1. Monitored Higher Timeframes" var string G_CHART = "2. On-Chart HTF Zone Projection" var string G_HUD = "3. Matrix HUD Configuration" bool i_useTF1 = input.bool(true, "Track 5-Minute Imbalances", group=G_TF) bool i_useTF2 = input.bool(true, "Track 15-Minute Imbalances (Key)", group=G_TF) bool i_useTF3 = input.bool(true, "Track 1-Hour Imbalances", group=G_TF) bool i_useTF4 = input.bool(true, "Track 4-Hour Imbalances", group=G_TF) bool i_drawHTF15 = input.bool(true, "Draw Active 15-Minute FVG on Current Chart", group=G_CHART) color i_c_15_bisi = input.color(color.new(#10B981, 80), "15m Bullish FVG (BISI)", group=G_CHART) color i_c_15_sibi = input.color(color.new(#EF4444, 80), "15m Bearish FVG (SIBI)", group=G_CHART) string i_hudPos = input.string("Bottom Right", "Matrix Position", options=["Top Right", "Bottom Right", "Top Left", "Bottom Left"], group=G_HUD) bool i_showAlerts= input.bool(true, "Enable HTF Collision Alerts", group=G_HUD) // --------------------------------------------------------------------------------------------------------- // HTF FVG DETECTION FUNCTION // --------------------------------------------------------------------------------------------------------- f_check_fvg(tf) => h0 = request.security(syminfo.tickerid, tf, high, barmerge.gaps_off, barmerge.lookahead_off) l0 = request.security(syminfo.tickerid, tf, low, barmerge.gaps_off, barmerge.lookahead_off) h2 = request.security(syminfo.tickerid, tf, high[2], barmerge.gaps_off, barmerge.lookahead_off) l2 = request.security(syminfo.tickerid, tf, low[2], barmerge.gaps_off, barmerge.lookahead_off) // Bullish BISI: low of bar 0 > high of bar 2 bool isBisi = (l0 > h2) float bisiTop = isBisi ? l0 : na float bisiBot = isBisi ? h2 : na // Bearish SIBI: high of bar 0 < low of bar 2 bool isSibi = (h0 < l2) float sibiTop = isSibi ? l2 : na float sibiBot = isSibi ? h0 : na [isBisi, bisiTop, bisiBot, isSibi, sibiTop, sibiBot] // Query Timeframes [bisi5, b5T, b5B, sibi5, s5T, s5B] = f_check_fvg("5") [bisi15, b15T, b15B, sibi15, s15T, s15B] = f_check_fvg("15") [bisi60, b60T, b60B, sibi60, s60T, s60B] = f_check_fvg("60") [bisi240, b240T, b240B, sibi240, s240T, s240B] = f_check_fvg("240") // Track whether current close is inside active HTF zones f_in_zone(top, bot) => not na(top) and not na(bot) and (close <= top) and (close >= bot) in_5_bisi = f_in_zone(b5T, b5B) in_5_sibi = f_in_zone(s5T, s5B) in_15_bisi = f_in_zone(b15T, b15B) in_15_sibi = f_in_zone(s15T, s15B) in_60_bisi = f_in_zone(b60T, b60B) in_60_sibi = f_in_zone(s60T, s60B) in_240_bisi = f_in_zone(b240T, b240B) in_240_sibi = f_in_zone(s240T, s240B) // --------------------------------------------------------------------------------------------------------- // ON-CHART 15-MINUTE PROJECTION BOX // --------------------------------------------------------------------------------------------------------- var box bx_15m = na if i_drawHTF15 and barstate.islast box.delete(bx_15m) if bisi15 and not na(b15T) and not na(b15B) bx_15m := box.new(left=bar_index - 40, top=b15T, right=bar_index + 10, bottom=b15B, bgcolor=i_c_15_bisi, border_color=color.new(#10B981, 30), border_width=1) else if sibi15 and not na(s15T) and not na(s15B) bx_15m := box.new(left=bar_index - 40, top=s15T, right=bar_index + 10, bottom=s15B, bgcolor=i_c_15_sibi, border_color=color.new(#EF4444, 30), border_width=1) // --------------------------------------------------------------------------------------------------------- // MATRIX HUD TABLE // --------------------------------------------------------------------------------------------------------- t_pos = i_hudPos == "Top Right" ? position.top_right : i_hudPos == "Bottom Right" ? position.bottom_right : i_hudPos == "Top Left" ? position.top_left : position.bottom_left var table mtfTable = table.new(t_pos, 3, 6, bgcolor=color.new(#030712, 10), border_color=color.new(#1E2D48, 30), border_width=1) f_status_row(table t, int row, string tfName, bool inBisi, bool inSibi, bool hasBisi, bool hasSibi) => table.cell(t, 0, row, tfName, text_color=#94A3B8, text_size=size.tiny, text_font_family=font.family_monospace) string statusText = "Clear (No Zone)" color statusCol = #64748B color cellBg = color.new(#0E1626, 60) if inBisi statusText := "INSIDE BULLISH BISI (SUPPORT)" statusCol := #FFFFFF cellBg := color.new(#10B981, 20) else if inSibi statusText := "INSIDE BEARISH SIBI (RESIST)" statusCol := #FFFFFF cellBg := color.new(#EF4444, 20) else if hasBisi statusText := "Bullish BISI Active" statusCol := #10B981 else if hasSibi statusText := "Bearish SIBI Active" statusCol := #EF4444 table.cell(t, 1, row, statusText, text_color=statusCol, text_size=size.tiny, text_font_family=font.family_monospace, bgcolor=cellBg) string bias = inBisi or hasBisi ? "BULLISH" : (inSibi or hasSibi ? "BEARISH" : "NEUTRAL") color biasCol = inBisi or hasBisi ? #10B981 : (inSibi or hasSibi ? #EF4444 : #94A3B8) table.cell(t, 2, row, bias, text_color=biasCol, text_size=size.tiny, text_font_family=font.family_monospace) if barstate.islast // Header table.cell(mtfTable, 0, 0, "LIQUIDITY EDGE", text_color=#38BDF8, text_size=size.small, text_font_family=font.family_monospace, bgcolor=#0A0F1D) table.cell(mtfTable, 1, 0, "MTF FVG MATRIX", text_color=#F8FAFC, text_size=size.small, text_font_family=font.family_monospace, bgcolor=#0A0F1D) table.cell(mtfTable, 2, 0, "HTF BIAS", text_color=#F59E0B, text_size=size.small, text_font_family=font.family_monospace, bgcolor=#0A0F1D) if i_useTF1 f_status_row(mtfTable, 1, "5-Minute", in_5_bisi, in_5_sibi, bisi5, sibi5) if i_useTF2 f_status_row(mtfTable, 2, "15-Minute*", in_15_bisi, in_15_sibi, bisi15, sibi15) if i_useTF3 f_status_row(mtfTable, 3, "1-Hour", in_60_bisi, in_60_sibi, bisi60, sibi60) if i_useTF4 f_status_row(mtfTable, 4, "4-Hour", in_240_bisi, in_240_sibi, bisi240, sibi240) // Current Warning Bar string warning = "ORDER FLOW: NEUTRAL" color warnBg = #0A0F1D if in_15_sibi or in_60_sibi warning := "⚠️ WARNING: AT HTF BEARISH RESISTANCE" warnBg := #EF4444 else if in_15_bisi or in_60_bisi warning := "⚡ HIGH CONFLUENCE: AT HTF BULLISH SUPPORT" warnBg := #10B981 table.cell(mtfTable, 0, 5, "Desk Alert", text_color=#FFFFFF, text_size=size.tiny, text_font_family=font.family_monospace, bgcolor=warnBg) table.cell(mtfTable, 1, 5, warning, text_color=#FFFFFF, text_size=size.tiny, text_font_family=font.family_monospace, bgcolor=warnBg) table.cell(mtfTable, 2, 5, "NQ1!", text_color=#FFFFFF, text_size=size.tiny, text_font_family=font.family_monospace, bgcolor=warnBg) // --------------------------------------------------------------------------------------------------------- // ALERTS // --------------------------------------------------------------------------------------------------------- alertcondition(in_15_sibi and not in_15_sibi[1], title="Entered 15m Bearish FVG Resistance", message="[Liquidity Edge] Caution: {{ticker}} has entered a 15-Minute Bearish FVG Resistance zone!") alertcondition(in_15_bisi and not in_15_bisi[1], title="Entered 15m Bullish FVG Support", message="[Liquidity Edge] High Confluence: {{ticker}} has entered a 15-Minute Bullish FVG Support zone!")