OPEN-SOURCE SCRIPT

Falsos Quiebres (15 Minutos)

//version=5
indicator("Falsos Quiebres en Soportes/Resistencias a Favor de la Tendencia (15 Minutos)", overlay=true)

// Parámetros
volMultiplier = input(1.5, title="Multiplicador del volumen para detectar falso quiebre")
pivotPeriod = input(5, title="Periodo de pivote para soportes y resistencias")
emaLength = 200 // Longitud de la EMA

// Cálculo de la EMA
ema200 = ta.ema(close, emaLength)

// Cálculo de soportes y resistencias
pHigh = ta.pivothigh(high, pivotPeriod, pivotPeriod)
pLow = ta.pivotlow(low, pivotPeriod, pivotPeriod)

// Cálculo del volumen promedio
volAvg = ta.sma(volume, 20)

// Variables para los niveles de soporte y resistencia
var float lastSupport = na
var float lastResistance = na

// Actualizar los niveles de soporte y resistencia
if not na(pLow)
lastSupport := pLow
if not na(pHigh)
lastResistance := pHigh

// Detectar falso quiebre en soporte (solo si la tendencia es alcista)
bullishTrap = (not na(lastSupport) and close < lastSupport and close[1] > lastSupport and volume > volAvg * volMultiplier and close > ema200 and (hour >= 8 and hour < 17))

// Detectar falso quiebre en resistencia (solo si la tendencia es bajista)
bearishTrap = (not na(lastResistance) and close > lastResistance and close[1] < lastResistance and volume > volAvg * volMultiplier and close < ema200 and (hour >= 8 and hour < 17))

// Marcar trampas en el gráfico con triángulos
plotshape(bullishTrap, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Falso Quiebre Alcista")
plotshape(bearishTrap, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Falso Quiebre Bajista")

// Alertas sonoras y visuales
if (bullishTrap)
alert("Falso quiebre alcista detectado en soporte durante horario de Londres", alert.freq_once_per_bar_close)
if (bearishTrap)
alert("Falso quiebre bajista detectado en resistencia durante horario de Londres", alert.freq_once_per_bar_close)

// Mensaje para los gráficos que no son de 15 minutos
var label warningLabel = na
if not (timeframe.isintraday and timeframe.multiplier == 15)
if na(warningLabel)
warningLabel := label.new(bar_index, high, text="Este indicador solo funciona en gráficos de 15 minutos", style=label.style_label_down, color=color.red, size=size.normal)
else
label.set_xy(warningLabel, bar_index, high) // Actualiza la posición de la etiqueta

// Dibujar la EMA en el gráfico
plot(ema200, color=color.blue, title="EMA 200")
Bands and Channels

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?

คำจำกัดสิทธิ์ความรับผิดชอบ