Binance Square

pinescript

7 vistas
4 están debatiendo
chamod wenushka
--
Ver original
//@version=5 indicator("Estrategia de Comprar en la Caída (Cualquier Moneda)", overlay=true) // === ENTRADAS === stochKLen = input.int(14, "Longitud Estocástica %K") stochDLen = input.int(3, "Longitud Estocástica %D") stochSmooth = input.int(3, "Suavizado Estocástico") buyZone = input.float(0.98, "Zona de Compra % (por ejemplo, 0.98 = 2% por debajo)", step=0.01) tpMultiplier = input.float(1.05, "Toma de Ganancias % (por ejemplo, 1.05 = 5% por encima)", step=0.01) slMultiplier = input.float(0.97, "Stop Loss % (por ejemplo, 0.97 = 3% por debajo)", step=0.01) // === OSCILADOR ESTOCÁSTICO === k = ta.sma(ta.stoch(close, high, low, stochKLen), stochSmooth) d = ta.sma(k, stochDLen) // === NIVELES DINÁMICOS === var float entryPrice = na var bool inTrade = false // === CONDICIONES DE COMPRA === buyCondition = ta.crossover(k, d) and k < 80 if (buyCondition and not inTrade) entryPrice := close inTrade := true // === NIVELES DE TP y SL === takeProfitPrice = entryPrice * tpMultiplier stopLossPrice = entryPrice * slMultiplier // === CONDICIONES DE SALIDA === exitConditionTP = inTrade and close >= takeProfitPrice exitConditionSL = inTrade and close <= stopLossPrice if (exitConditionTP or exitConditionSL) inTrade := false entryPrice := na // === GRÁFICOS === plotshape(buyCondition and not inTrade, title="Señal de Compra", location=location.belowbar, color=color.green, style=shape.labelup, text="COMPRAR") plotshape(exitConditionTP, title="Toma de Ganancias", location=location.abovebar, color=color.red, style=shape.labeldown, text="TP") plotshape(exitConditionSL, title="Stop Loss", location=location.abovebar, color=color.orange, style=shape.labeldown, text="SL") plot(entryPrice, title="Precio de Entrada", color=color.new(color.green, 60)) plot(inTrade ? takeProfitPrice : na, title="Nivel de Toma de Ganancias", color=color.new(color.red, 60), style=plot.style_line) plot(inTrade ? stopLossPrice : na, title="Nivel de Stop Loss", color=color.new(color.orange, 60), style=plot.style_line) #pinescript #Write2Earn
//@version=5
indicator("Estrategia de Comprar en la Caída (Cualquier Moneda)", overlay=true)

// === ENTRADAS ===
stochKLen = input.int(14, "Longitud Estocástica %K")
stochDLen = input.int(3, "Longitud Estocástica %D")
stochSmooth = input.int(3, "Suavizado Estocástico")

buyZone = input.float(0.98, "Zona de Compra % (por ejemplo, 0.98 = 2% por debajo)", step=0.01)
tpMultiplier = input.float(1.05, "Toma de Ganancias % (por ejemplo, 1.05 = 5% por encima)", step=0.01)
slMultiplier = input.float(0.97, "Stop Loss % (por ejemplo, 0.97 = 3% por debajo)", step=0.01)

// === OSCILADOR ESTOCÁSTICO ===
k = ta.sma(ta.stoch(close, high, low, stochKLen), stochSmooth)
d = ta.sma(k, stochDLen)

// === NIVELES DINÁMICOS ===
var float entryPrice = na
var bool inTrade = false

// === CONDICIONES DE COMPRA ===
buyCondition = ta.crossover(k, d) and k < 80

if (buyCondition and not inTrade)
entryPrice := close
inTrade := true

// === NIVELES DE TP y SL ===
takeProfitPrice = entryPrice * tpMultiplier
stopLossPrice = entryPrice * slMultiplier

// === CONDICIONES DE SALIDA ===
exitConditionTP = inTrade and close >= takeProfitPrice
exitConditionSL = inTrade and close <= stopLossPrice

if (exitConditionTP or exitConditionSL)
inTrade := false
entryPrice := na

// === GRÁFICOS ===
plotshape(buyCondition and not inTrade, title="Señal de Compra", location=location.belowbar, color=color.green, style=shape.labelup, text="COMPRAR")
plotshape(exitConditionTP, title="Toma de Ganancias", location=location.abovebar, color=color.red, style=shape.labeldown, text="TP")
plotshape(exitConditionSL, title="Stop Loss", location=location.abovebar, color=color.orange, style=shape.labeldown, text="SL")

plot(entryPrice, title="Precio de Entrada", color=color.new(color.green, 60))
plot(inTrade ? takeProfitPrice : na, title="Nivel de Toma de Ganancias", color=color.new(color.red, 60), style=plot.style_line)
plot(inTrade ? stopLossPrice : na, title="Nivel de Stop Loss", color=color.new(color.orange, 60), style=plot.style_line)
#pinescript #Write2Earn
Inicia sesión para explorar más contenidos
Conoce las noticias más recientes del sector
⚡️ Participa en los últimos debates del mundo cripto
💬 Interactúa con tus creadores favoritos
👍 Disfruta contenido de tu interés
Email/número de teléfono