Indicator · Pine Script v6 · On the chart

Surgical Deep Engine PRO

by h33rnan

Surgical Deep Engine PRO is an overlay indicator that marks bullish and bearish order-block boxes from a two-candle displacement pattern, optionally only when volume exceeds the 20-period average by 20 percent.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code207
Settings10inputs
LicenceMIT
Last update6 months ago11 Apr 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

207 lines of Pine Script v6 from Surgical-Deep-Engine-PRO.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

Surgical-Deep-Engine-PRO.pine
//@version=6
indicator("Surgical Deep Engine PRO", overlay=true, max_labels_count=500, max_lines_count=500, max_boxes_count=500)

// ═══════════════════════════════════════════════════════════════════════════════
// 1. TEMAS & UI ADAPTATIVA (STANDARD "SURGICAL")
// ═══════════════════════════════════════════════════════════════════════════════
string G_THEME = "Estética Quirúrgica & UI"
string themeChoice = input.string("Artic", "Tema Visual", options = ["Artic", "Mono"], group=G_THEME)
bool isLight = input.bool(false, "Modo Claro (Fondo Blanco)", group=G_THEME)
string hudSizeInput = input.string("Small", "Tamaño del HUD", options=["Tiny", "Small", "Normal", "Large"], group=G_THEME)

string hudSize = hudSizeInput == "Tiny" ? size.tiny : hudSizeInput == "Small" ? size.small : hudSizeInput == "Normal" ? size.normal : size.large

color thBull = themeChoice == "Mono" ? (isLight ? #616161 : #9e9e9e) : (isLight ? #0288d1 : #4fc3f7) 
color thBear = themeChoice == "Mono" ? (isLight ? #212121 : #424242) : (isLight ? #512da8 : #b39ddb) 
color thSweep = themeChoice == "Mono" ? (isLight ? #000000 : #ffffff) : (isLight ? #0097a7 : #00e5ff) 

color bgHud = isLight ? color.new(color.white, 20) : color.new(color.black, 90)
color borderHud = isLight ? color.new(color.gray, 60) : color.new(color.gray, 85)
color txtMain = isLight ? color.black : color.white
color txtSub = isLight ? color.new(color.black, 30) : color.gray

// ═══════════════════════════════════════════════════════════════════════════════
// 2. PARÁMETROS: ORDER BLOCKS & BREAKERS (MODO LETAL)
// ═══════════════════════════════════════════════════════════════════════════════
string G_OB = "Motor de Bloques & Contrataque"
int extendBars = input.int(20, "Extensión Máxima (Velas)", minval=10, group=G_OB) // <-- AJUSTE A 20 VELAS
bool useVolFilter = input.bool(true, "Filtro de Volumen Institucional (+20%)", group=G_OB)
bool onlyOnClose = input.bool(true, "Confirmar solo al cierre", group=G_OB)

var box[] obBoxes = array.new_box()
var int[] obTypes = array.new_int() 

isBull(float o, float c) => c > o
isBear(float o, float c) => c < o

float o1 = open[2]
float c1 = close[2]
float h1 = high[2]
float l1 = low[2]

float o2 = open[1]
float c2 = close[1]
float h2 = high[1]
float l2 = low[1]

float h3 = high
float l3 = low

float volSma = ta.sma(volume, 20)
bool volSpike = useVolFilter ? (volume[1] > (volSma[1] * 1.2)) : true

bool bullishSetup = isBear(o1, c1) and isBull(o2, c2) and (l2 >= l1) and (l3 > h1) and volSpike
bool bearishSetup = isBull(o1, c1) and isBear(o2, c2) and (h2 <= h1) and (h3 < l1) and volSpike

bool canPlot = onlyOnClose ? barstate.isconfirmed : true

if bullishSetup and canPlot
    array.push(obBoxes, box.new(bar_index[2], h1, bar_index + extendBars, l1, border_color=na, bgcolor=color.new(thBull, isLight ? 80 : 85)))
    array.push(obTypes, 1)

if bearishSetup and canPlot
    array.push(obBoxes, box.new(bar_index[2], h1, bar_index + extendBars, l1, border_color=na, bgcolor=color.new(thBear, isLight ? 80 : 85)))
    array.push(obTypes, -1)

if array.size(obBoxes) > 0
    for i = array.size(obBoxes) - 1 to 0
        box b = array.get(obBoxes, i)
        int typ = array.get(obTypes, i)
        float top = box.get_top(b)
        float bot = box.get_bottom(b)
        
        if barstate.isnew
            box.set_right(b, bar_index + extendBars)
            
        bool bullObBroken = (typ == 1) and (close <= bot)
        bool bearObBroken = (typ == -1) and (close >= top)
        bool bullBreakerBroken = (typ == 2) and (close <= bot)
        bool bearBreakerBroken = (typ == -2) and (close >= top)
        
        if bullObBroken
            box.set_bgcolor(b, color.new(thBear, isLight ? 85 : 90)) 
            box.set_border_color(b, color.new(thBear, 40))
            box.set_border_style(b, line.style_solid) 
            box.set_text(b, "BRK")
            box.set_text_color(b, color.new(thBear, 20))
            box.set_text_size(b, size.tiny)
            box.set_text_halign(b, text.align_right)
            array.set(obTypes, i, -2) 
            
        else if bearObBroken
            box.set_bgcolor(b, color.new(thBull, isLight ? 85 : 90)) 
            box.set_border_color(b, color.new(thBull, 40))
            box.set_border_style(b, line.style_solid) 
            box.set_text(b, "BRK")
            box.set_text_color(b, color.new(thBull, 20))
            box.set_text_size(b, size.tiny)
            box.set_text_halign(b, text.align_right)
            array.set(obTypes, i, 2) 
            
        else if bullBreakerBroken or bearBreakerBroken
            box.delete(b)
            array.remove(obBoxes, i)
            array.remove(obTypes, i)

// ═══════════════════════════════════════════════════════════════════════════════
// 3. MOTORES DE EQUILIBRIO (MIDPOINTS & VWAP)
// ═══════════════════════════════════════════════════════════════════════════════
string G_MID = "Líneas de Gravedad (Midpoints)"
int priceMidLen = input.int(21, "Price Midpoint Lookback", group=G_MID)
int fibMidLen = input.int(55, "Fib Midpoint Smoothing", group=G_MID)
int vwapLookback = input.int(21, "Rolling VWAP Lookback", group=G_MID)

float priceMid = (ta.highest(high, priceMidLen) + ta.lowest(low, priceMidLen)) / 2

float ph = ta.pivothigh(close, 21, 5)
float pl = ta.pivotlow(close, 21, 5)
var float swingHigh = na, var float swingLow = na
var int hiIndex = na, var int loIndex = na

if not na(ph)
    swingHigh := ph, hiIndex := bar_index
if not na(pl)
    swingLow := pl, loIndex := bar_index

bool isDown = (not na(swingHigh) and not na(swingLow)) and (hiIndex > loIndex)
float base = isDown ? swingHigh : swingLow
float fibrange = math.abs(swingHigh - swingLow)
float fibMid = ta.sma(isDown ? base - fibrange * 0.5 : base + fibrange * 0.5, fibMidLen)

float typicalPrice = (high + low + close) / 3
float rollingVWAP = math.sum(typicalPrice * volume, vwapLookback) / math.sum(volume, vwapLookback)

plot(priceMid, "Price Midpoint", color=color.new(thBull, 50), linewidth=1, style=plot.style_cross)
plot(fibMid, "Fib Midpoint", color=color.new(thBear, 50), linewidth=1, style=plot.style_cross)
plot(rollingVWAP, "Rolling VWAP", color=color.new(thSweep, 10), linewidth=2)

// ═══════════════════════════════════════════════════════════════════════════════
// 4. BAR COLORING (CONFLUENCIA INTELIGENTE)
// ═══════════════════════════════════════════════════════════════════════════════
bool showBarColor = input.bool(true, "Colorear Velas por Confluencia", group=G_MID)

color barCol = color.new(color.gray, 50) 
if close > priceMid and close > fibMid and close > rollingVWAP
    barCol := thBull 
else if close < priceMid and close < fibMid and close < rollingVWAP
    barCol := thBear 
else if close > rollingVWAP
    barCol := color.new(thBull, 40) 
else if close < rollingVWAP
    barCol := color.new(thBear, 40) 

barcolor(showBarColor ? barCol : na, title="Confluence Bar Color")

// ═══════════════════════════════════════════════════════════════════════════════
// 5. MOTOR PREDICTIVO & SURGICAL HUD (DASHBOARD)
// ═══════════════════════════════════════════════════════════════════════════════
string vwapState = close > rollingVWAP ? "BULL" : "BEAR"
color vwapCol = close > rollingVWAP ? thBull : thBear

float rvol = volume / ta.sma(volume, 20) 
float atr = ta.atr(14)
float momentumForce = math.abs(close - open) / atr 

string threatLevel = "NONE (AWAY)"
color threatColor = txtSub
bool isNearOB = false

if array.size(obBoxes) > 0
    for i = 0 to array.size(obBoxes) - 1
        box b = array.get(obBoxes, i)
        float top = box.get_top(b)
        float bot = box.get_bottom(b)
        
        if close <= (top + atr) and close >= (bot - atr)
            isNearOB := true
            if rvol > 1.5 and momentumForce > 1.2
                threatLevel := "CRITICAL (BREACH IMMINENT)"
                threatColor := color.red
            else if rvol > 1.0 or momentumForce > 0.8
                threatLevel := "UNDER PRESSURE"
                threatColor := color.orange
            else
                threatLevel := "DEFENDED (LOW VOL)"
                threatColor := thSweep
            break 

var table dash = table.new(position.top_right, 2, 7, border_width=1, bgcolor=bgHud, border_color=borderHud)
if barstate.islast
    table.cell(dash, 0, 0, "DEEP ENGINE", text_color=txtMain, text_size=hudSize, text_font_family=font.family_monospace)
    table.merge_cells(dash, 0, 0, 1, 0)
    
    table.cell(dash, 0, 1, "VWAP Bias:", text_color=txtSub, text_size=hudSize)
    table.cell(dash, 1, 1, vwapState, text_color=vwapCol, text_size=hudSize, text_font_family=font.family_monospace)
    
    table.cell(dash, 0, 2, "Price vs Fib:", text_color=txtSub, text_size=hudSize)
    table.cell(dash, 1, 2, priceMid > fibMid ? "PREMIUM" : "DISCOUNT", text_color=priceMid > fibMid ? thBear : thBull, text_size=hudSize, text_font_family=font.family_monospace)
    
    table.cell(dash, 0, 3, "Active Blocks:", text_color=txtSub, text_size=hudSize)
    table.cell(dash, 1, 3, str.tostring(array.size(obBoxes)), text_color=array.size(obBoxes) > 0 ? txtMain : txtSub, text_size=hudSize, text_font_family=font.family_monospace)
    
    table.cell(dash, 0, 4, "OB Threat:", text_color=txtSub, text_size=hudSize)
    table.cell(dash, 1, 4, threatLevel, text_color=threatColor, text_size=hudSize, text_font_family=font.family_monospace)
    
    table.merge_cells(dash, 0, 6, 1, 6)
    color sigBg = isLight ? color.new(color.black, 90) : color.new(color.black, 70)
    table.cell(dash, 0, 6, "Created by H33RNAN", text_color=thSweep, bgcolor=sigBg, text_size=hudSize, text_font_family=font.family_monospace, text_halign=text.align_center)

Overview

Surgical Deep Engine PRO extends those zones and, according to its documentation, converts failed blocks into bordered breaker zones while a HUD tracks relative volume and momentum. Users can change theme, HUD size, zone length, volume filtering, and close confirmation, and color bars by confluence with rolling VWAP and price and Fibonacci midpoints. No entry, exit, or stop rules are included.

Details

Published by

h33rnan on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Tema VisualstringArticthemeChoice
Modo Claro (Fondo Blanco)boolfalseisLight
Tamaño del HUDstringSmallhudSizeInput
Extensión Máxima (Velas)int20extendBars
Filtro de Volumen Institucional (+20%)booltrueuseVolFilter
Confirmar solo al cierrebooltrueonlyOnClose
Price Midpoint Lookbackint21priceMidLen
Fib Midpoint Smoothingint55fibMidLen
Rolling VWAP Lookbackint21vwapLookback
Colorear Velas por ConfluenciabooltrueshowBarColor
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Nexural Transform

by JasonTeixeira
9 stars

Nexural Transform is an oscillator indicator calculated in a separate pane that combines Fisher Transform mechanics with Cumulative Volume Delta momentum. It integrates volume-weighted price transforms, CVD acceleration, and order flow features like absorption

Indicator v6 Oscillators & momentumVolume
Updated 2 weeks ago · Custom licence GitHub repository of Nexural Transform

This overlay indicator screens a pasted list of up to forty symbols and draws a table on the price chart. It classifies bullish or bearish setups from the percent change between the current candle and the candle 250 bars back, then shows RSI with a simple movi

Indicator v5 Oscillators & momentumVolume
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - Ankush Bajaj Momentum Investing Setup

This overlay indicator builds a horizontal momentum profile over a chosen lookback. It splits price into rows and plots the average WaveTrend of each zone as a bar colored by direction, plus an optional MFI reference band that stays gray when real trade volume

Indicator v6 Oscillators & momentumVolume
Updated 3 days ago · MIT GitHub repository of Momentum Profile [WavesUnchained]
7 stars

The 7M Multi-Factor Momentum Scoreboard evaluates real-time market momentum across multiple criteria and displays the results in an overlay dashboard panel on the price chart. It tracks anchored percentage price moves based on pre-market, regular open, or post

Indicator v6 Oscillators & momentumVolume
Updated 3 months ago · None stated GitHub repository of 7M Multi-Factor Momentum Scoreboard
6 stars

Capital41 Confluence Core plots an EMA or SMA on the price chart and combines its direction with RSI, Williams %R, and a liquidity-sweep check into long and short confluence signals. Signal strictness is Strict, Standard, or Loose, which changes how far the os

Indicator v6 Oscillators & momentumMoving averages
Updated 2 months ago · MIT GitHub repository of Capital41 Confluence Core

CRT State Engine

by alboogycOdR
6 stars

This overlay indicator runs a CRT state engine on the price chart. It can analyze draw-on-liquidity pivots, a session state machine, and optional 1AM, 5AM, and 9AM CRT models. Optional modules track market structure, liquidity pools, volume-profile levels, and

Indicator v5 SMC / ICT / price actionSessions & time
Updated 7 months ago · None stated GitHub repository of CRT State Engine

More SMC / ICT scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers