Binance Square

pinescript

7 visualizações
4 a discutir
chamod wenushka
--
Ver original
//@version=5 indicator("Comprar na queda (Qualquer moeda)", overlay=true) // === ENTRADAS === stochKLen = input.int(14, "Comprimento %K Estocástico") stochDLen = input.int(3, "Comprimento %D Estocástico") stochSmooth = input.int(3, "Suavização Estocástica") buyZone = input.float(0.98, "Zona de Compra % (ex: 0.98 = 2% abaixo)", step=0.01) tpMultiplier = input.float(1.05, "Lucro % (ex: 1.05 = 5% acima)", step=0.01) slMultiplier = input.float(0.97, "Perda % (ex: 0.97 = 3% abaixo)", step=0.01) // === OSCILADOR ESTOCÁSTICO === k = ta.sma(ta.stoch(close, high, low, stochKLen), stochSmooth) d = ta.sma(k, stochDLen) // === NÍVEIS DINÂMICOS === var float entryPrice = na var bool inTrade = false // === CONDIÇÕES DE COMPRA === buyCondition = ta.crossover(k, d) and k < 80 if (buyCondition and not inTrade) entryPrice := close inTrade := true // === NÍVEIS DE TP e SL === takeProfitPrice = entryPrice * tpMultiplier stopLossPrice = entryPrice * slMultiplier // === CONDIÇÕES DE SAÍDA === exitConditionTP = inTrade and close >= takeProfitPrice exitConditionSL = inTrade and close <= stopLossPrice if (exitConditionTP or exitConditionSL) inTrade := false entryPrice := na // === PLOTS === plotshape(buyCondition and not inTrade, title="Sinal de Compra", location=location.belowbar, color=color.green, style=shape.labelup, text="COMPRAR") plotshape(exitConditionTP, title="Lucro", location=location.abovebar, color=color.red, style=shape.labeldown, text="TP") plotshape(exitConditionSL, title="Perda", location=location.abovebar, color=color.orange, style=shape.labeldown, text="SL") plot(entryPrice, title="Preço de Entrada", color=color.new(color.green, 60)) plot(inTrade ? takeProfitPrice : na, title="Nível de Lucro", color=color.new(color.red, 60), style=plot.style_line) plot(inTrade ? stopLossPrice : na, title="Nível de Perda", color=color.new(color.orange, 60), style=plot.style_line) #pinescript #Write2Earn
//@version=5
indicator("Comprar na queda (Qualquer moeda)", overlay=true)

// === ENTRADAS ===
stochKLen = input.int(14, "Comprimento %K Estocástico")
stochDLen = input.int(3, "Comprimento %D Estocástico")
stochSmooth = input.int(3, "Suavização Estocástica")

buyZone = input.float(0.98, "Zona de Compra % (ex: 0.98 = 2% abaixo)", step=0.01)
tpMultiplier = input.float(1.05, "Lucro % (ex: 1.05 = 5% acima)", step=0.01)
slMultiplier = input.float(0.97, "Perda % (ex: 0.97 = 3% abaixo)", step=0.01)

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

// === NÍVEIS DINÂMICOS ===
var float entryPrice = na
var bool inTrade = false

// === CONDIÇÕES DE COMPRA ===
buyCondition = ta.crossover(k, d) and k < 80

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

// === NÍVEIS DE TP e SL ===
takeProfitPrice = entryPrice * tpMultiplier
stopLossPrice = entryPrice * slMultiplier

// === CONDIÇÕES DE SAÍDA ===
exitConditionTP = inTrade and close >= takeProfitPrice
exitConditionSL = inTrade and close <= stopLossPrice

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

// === PLOTS ===
plotshape(buyCondition and not inTrade, title="Sinal de Compra", location=location.belowbar, color=color.green, style=shape.labelup, text="COMPRAR")
plotshape(exitConditionTP, title="Lucro", location=location.abovebar, color=color.red, style=shape.labeldown, text="TP")
plotshape(exitConditionSL, title="Perda", location=location.abovebar, color=color.orange, style=shape.labeldown, text="SL")

plot(entryPrice, title="Preço de Entrada", color=color.new(color.green, 60))
plot(inTrade ? takeProfitPrice : na, title="Nível de Lucro", color=color.new(color.red, 60), style=plot.style_line)
plot(inTrade ? stopLossPrice : na, title="Nível de Perda", color=color.new(color.orange, 60), style=plot.style_line)
#pinescript #Write2Earn
Inicia sessão para explorares mais conteúdos
Fica a saber as últimas notícias sobre criptomoedas
⚡️ Participa nas mais recentes discussões sobre criptomoedas
💬 Interage com os teus criadores preferidos
👍 Desfruta de conteúdos que sejam do teu interesse
E-mail/Número de telefone