Please convert Pure Price Action Liquidity Sweeps
Forums › ProRealTime English forum › ProBuilder support › Please convert Pure Price Action Liquidity Sweeps
- This topic has 2 replies, 2 voices, and was last updated 1 month ago by
yas.
-
-
09/18/2025 at 4:24 PM #251107
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo//@version=5
indicator(‘Pure Price Action Liquidity Sweeps [LuxAlgo]’, ‘LuxAlgo – Pure Price Action Liquidity Sweeps’, true, max_lines_count=500, max_boxes_count=500)
//———————————————————————————————————————
// Settings
//———————————————————————————————————————{
term = input.string(‘Long Term’, ‘Detection’, options = [‘Short Term’, ‘Intermediate Term’, ‘Long Term’], display = display.all – display.status_line)//Style
colBl = input.color(#089981, ‘Bullish Level’, inline=’c1′, group = ‘Style’)
colBlS = input.color(#08998180, ‘Sweep’, inline=’c1′, group = ‘Style’)colBr = input.color(#f23645, ‘Bearish Level’ , inline=’c2′, group = ‘Style’)
colBrS = input.color(#f2364580, ‘Sweep’ , inline=’c2′, group = ‘Style’)//———————————————————————————————————————}
// User Defined Types
//———————————————————————————————————————{
type piv
float prc
int bix
bool mit
bool wic
line lintype boxBr
box bx
int drtype swing
float y = na
int x = natype vector
array<swing> v//———————————————————————————————————————}
// Variables
//———————————————————————————————————————{
n = bar_indexdepth = switch term
‘Short Term’ => 1
‘Intermediate Term’ => 2
‘Long Term’ => 3//———————————————————————————————————————}
// Functions / Methods
//———————————————————————————————————————{
method l(piv get, color c) =>
line.new(get.bix, get.prc, n, get.prc, color=c, style = line.style_solid)method br(piv get, color c, int d) =>
y1 = d == 1 ? high : get.prc
y2 = d == 1 ? get.prc : low
boxBr.new(box.new(n -1, y1, n +1, y2, border_color = color(na), bgcolor=c), d)method detect(array<vector> id, mode, depth)=>
var swing swingLevel = swing.new(na, na)
for i = 0 to depth-1
get_v = id.get(i).vif get_v.size() == 3
pivot = switch mode
‘bull’ => math.max(get_v.get(0).y, get_v.get(1).y, get_v.get(2).y)
‘bear’ => math.min(get_v.get(0).y, get_v.get(1).y, get_v.get(2).y)if pivot == get_v.get(1).y
if i < depth-1
id.get(i+1).v.unshift(get_v.get(1))if id.get(i+1).v.size() > 3
id.get(i+1).v.pop()
else
swingLevel := swing.new(get_v.get(1).y, get_v.get(1).x)get_v.pop()
get_v.pop()
swingLevel//———————————————————————————————————————}
// Calculations
//———————————————————————————————————————{
var fh = array.new<vector>(0)
var fl = array.new<vector>(0)//Detect swings
if barstate.isfirst
for i = 0 to depth-1
fh.push(vector.new(array.new<swing>(0)))
fl.push(vector.new(array.new<swing>(0)))fh.get(0).v.unshift(swing.new(high, n))
fl.get(0).v.unshift(swing.new(low, n))if fh.get(0).v.size() > 3
fh.get(0).v.pop()if fl.get(0).v.size() > 3
fl.get(0).v.pop()top = fh.detect(‘bull’, depth)
btm = fl.detect(‘bear’, depth)ph = top.y
pl = btm.y//Handle swing levels
var array<piv> aPivH = array.new<piv>(1, piv.new())
var array<piv> aPivL = array.new<piv>(1, piv.new())
var array<boxBr> aBoxBr = array.new<boxBr>(1, boxBr.new())if ph > 0 and ph != ph[1]
aPivH.unshift(piv.new(ph, top.x, false, false))if pl > 0 and pl != pl[1]
aPivL.unshift(piv.new(pl, btm.x, false, false))//Test for bearish sweeps/detect breaks
for i = aPivH.size() -1 to 0
get = aPivH.get(i)
if not get.mit
if close > get.prc
get.mit := true
if not get.wic
if high > get.prc and close < get.prc
aBoxBr.unshift(get.br(colBrS, 1))
get.l(colBr)
get.wic := true//Remove old levels
if n – get.bix > 2000 or get.mit
aPivH.remove(i).lin.delete()//Test for bullish sweeps/detect breaks
for i = aPivL.size() -1 to 0
get = aPivL.get(i)
if not get.mit
if close < get.prc
get.mit := true
if not get.wic
if low < get.prc and close > get.prc
aBoxBr.unshift(get.br(colBlS, -1))
get.l(colBl)
get.wic := true//Remove old levels
if n – get.bix > 2000 or get.mit
aPivL.remove(i).lin.delete()//———————————————————————————————————————}
09/23/2025 at 9:49 AM #251635voici!
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150//---------------------------------------------------////PRC_Pure Price Action Liquidity Sweeps (by LuxAlgo)//version = 0//23.09.25//Iván González @ www.prorealcode.com//---------------------------------------------------//// --- Configuración (Variables personalizables) --- ////---------------------------------------------------//// Detección: 1 = Corto Plazo, 2 = Plazo Intermedio, 3 = Largo Plazoprofundidad = 1// Límite de líneas de liquidez (máximos y mínimos) a mostrar en el gráficomaxLineas = 40// Límite de barras para mantener un nivel de pivote activo en el gráficolimiteBarras = 2000// Colores (formato RGB: Rojo, Verde, Azul, Opacidad)RedAlcista = 8GreenAlcista = 153BlueAlcista = 129AlphaAlcista = 255AlphaBarridoAlcista = 80RedBajista = 242GreenBajista = 54BlueBajista = 69AlphaBajista = 255AlphaBarridoBajista = 80//---------------------------------------------------//// -------------- Lógica de Pivotes ---------------- ////---------------------------------------------------//IF profundidad = 1 THEN // (Short Term)periodoPivote = 5offset = 2ELSIF profundidad = 2 THEN // (Mid Term)periodoPivote = 13offset = 6ELSE // profundidad = 3 (Long Term)periodoPivote = 21offset = 10ENDIF//---------------------------------------------------//// ----- Inicialización y Detección de Pivotes ----- ////---------------------------------------------------//ONCE pivHCount = 0ONCE pivLCount = 0ph = 0pl = 0// Detectar pivote de máximo (Pivot High)IF high[offset] = HIGHEST[periodoPivote](high) THENph = high[offset]ENDIF// Detectar pivote de mínimo (Pivot Low)IF low[offset] = LOWEST[periodoPivote](low) THENpl = low[offset]ENDIF// Almacenar nuevo pivote de máximoIF ph > 0 AND (pivHCount = 0 OR ph <> $pivHPrc[max(0,pivHCount - 1)]) THEN$pivHPrc[pivHCount] = ph$pivHBix[pivHCount] = barindex - offsetpivHCount = pivHCount + 1ENDIF// Almacenar nuevo pivote de mínimoIF pl > 0 AND (pivLCount = 0 OR pl <> $pivLPrc[max(0,pivLCount - 1)]) THEN$pivLPrc[pivLCount] = pl$pivLBix[pivLCount] = barindex - offsetpivLCount = pivLCount + 1ENDIF//---------------------------------------------------//// ------- Lógica de Procesamiento y Dibujo -------- ////---------------------------------------------------//IF ISLASTBARUPDATE THEN// --- PROCESAMIENTO DE PIVOTES DE MÁXIMOS (BARRIDOS BAJISTAS)lineasDibujadasH = 0FOR i = pivHCount - 1 DOWNTO 0IF lineasDibujadasH >= maxLineas THENBREAKENDIFIF barindex - $pivHBix[i] < limiteBarras THENesMitigado = 0esBarrido = 0indiceBarrido = -1maximoBarrido = 0FOR j = $pivHBix[i] + 1 TO barindexIF close[barindex-j] > $pivHPrc[i] THENesMitigado = 1BREAKENDIFIF high[barindex-j] > $pivHPrc[i] AND close[barindex-j] < $pivHPrc[i] THENesBarrido = 1indiceBarrido = jmaximoBarrido = high[barindex-j]BREAKENDIFNEXTIF esMitigado = 0 THENlineasDibujadasH = lineasDibujadasH + 1IF esBarrido THENDRAWSEGMENT($pivHBix[i], $pivHPrc[i], indiceBarrido, $pivHPrc[i]) STYLE(Line, 1) COLOURED(RedBajista,GreenBajista,BlueBajista,AlphaBajista)DRAWRECTANGLE(indiceBarrido - 1, maximoBarrido, indiceBarrido + 1, $pivHPrc[i]) COLOURED(RedBajista,GreenBajista,BlueBajista,AlphaBarridoBajista)ELSEDRAWSEGMENT($pivHBix[i], $pivHPrc[i], barindex, $pivHPrc[i]) STYLE(dottedLine, 1) COLOURED(RedBajista,GreenBajista,BlueBajista,AlphaBarridoBajista)ENDIFENDIFENDIFNEXT// --- PROCESAMIENTO DE PIVOTES DE MÍNIMOS (BARRIDOS ALCISTAS)lineasDibujadasL = 0FOR i = pivLCount - 1 DOWNTO 0IF lineasDibujadasL >= maxLineas THENBREAKENDIFIF barindex - $pivLBix[i] < limiteBarras THENesMitigado = 0esBarrido = 0indiceBarrido = -1minimoBarrido = 0FOR j = $pivLBix[i] + 1 TO barindexIF close[barindex-j] < $pivLPrc[i] THENesMitigado = 1BREAKENDIFIF low[barindex-j] < $pivLPrc[i] AND close[barindex-j] > $pivLPrc[i] THENesBarrido = 1indiceBarrido = jminimoBarrido = low[barindex-j]BREAKENDIFNEXTIF esMitigado = 0 THENlineasDibujadasL = lineasDibujadasL + 1IF esBarrido THENDRAWSEGMENT($pivLBix[i], $pivLPrc[i], indiceBarrido, $pivLPrc[i]) STYLE(Line, 1) COLOURED(RedAlcista,GreenAlcista,BlueAlcista,AlphaAlcista)DRAWRECTANGLE(indiceBarrido - 1, $pivLPrc[i], indiceBarrido + 1, minimoBarrido) COLOURED(RedAlcista,GreenAlcista,BlueAlcista,AlphaBarridoAlcista)ELSEDRAWSEGMENT($pivLBix[i], $pivLPrc[i], barindex, $pivLPrc[i]) STYLE(dottedLine, 1) COLOURED(RedAlcista,GreenAlcista,BlueAlcista,AlphaBarridoAlcista)ENDIFENDIFENDIFNEXTENDIF//---------------------------------------------------//RETURN09/23/2025 at 10:09 AM #251639 -
AuthorPosts
Find exclusive trading pro-tools on 