Binance Square

pinescript

7 lượt xem
4 đang thảo luận
chamod wenushka
--
Xem bản gốc
//@version=5 indicator("Chiến Lược Mua Khi Giảm Giá (Bất Kỳ Đồng Coin)", overlay=true) // === INPUTS === stochKLen = input.int(14, "Độ Dài Stochastic %K") stochDLen = input.int(3, "Độ Dài Stochastic %D") stochSmooth = input.int(3, "Làm Mượt Stochastic") buyZone = input.float(0.98, "Khu Vực Mua % (ví dụ: 0.98 = 2% dưới)", step=0.01) tpMultiplier = input.float(1.05, "Lợi Nhuận % (ví dụ: 1.05 = 5% trên)", step=0.01) slMultiplier = input.float(0.97, "Dừng Lỗ % (ví dụ: 0.97 = 3% dưới)", step=0.01) // === STOCHASTIC OSCILLATOR === k = ta.sma(ta.stoch(close, high, low, stochKLen), stochSmooth) d = ta.sma(k, stochDLen) // === CÁC MỨC ĐỘ ĐỘNG === var float entryPrice = na var bool inTrade = false // === CÁC ĐIỀU KIỆN MUA === buyCondition = ta.crossover(k, d) and k < 80 if (buyCondition and not inTrade) entryPrice := close inTrade := true // === CÁC MỨC TP VÀ SL === takeProfitPrice = entryPrice * tpMultiplier stopLossPrice = entryPrice * slMultiplier // === CÁC ĐIỀU KIỆN THOÁT === exitConditionTP = inTrade and close >= takeProfitPrice exitConditionSL = inTrade and close <= stopLossPrice if (exitConditionTP or exitConditionSL) inTrade := false entryPrice := na // === ĐỒ THỊ === plotshape(buyCondition and not inTrade, title="Tín Hiệu Mua", location=location.belowbar, color=color.green, style=shape.labelup, text="MUA") plotshape(exitConditionTP, title="Lấy Lợi Nhuận", location=location.abovebar, color=color.red, style=shape.labeldown, text="TP") plotshape(exitConditionSL, title="Dừng Lỗ", location=location.abovebar, color=color.orange, style=shape.labeldown, text="SL") plot(entryPrice, title="Giá Nhập", color=color.new(color.green, 60)) plot(inTrade ? takeProfitPrice : na, title="Mức Lợi Nhuận", color=color.new(color.red, 60), style=plot.style_line) plot(inTrade ? stopLossPrice : na, title="Mức Dừng Lỗ", color=color.new(color.orange, 60), style=plot.style_line) #pinescript #Write2Earn
//@version=5
indicator("Chiến Lược Mua Khi Giảm Giá (Bất Kỳ Đồng Coin)", overlay=true)

// === INPUTS ===
stochKLen = input.int(14, "Độ Dài Stochastic %K")
stochDLen = input.int(3, "Độ Dài Stochastic %D")
stochSmooth = input.int(3, "Làm Mượt Stochastic")

buyZone = input.float(0.98, "Khu Vực Mua % (ví dụ: 0.98 = 2% dưới)", step=0.01)
tpMultiplier = input.float(1.05, "Lợi Nhuận % (ví dụ: 1.05 = 5% trên)", step=0.01)
slMultiplier = input.float(0.97, "Dừng Lỗ % (ví dụ: 0.97 = 3% dưới)", step=0.01)

// === STOCHASTIC OSCILLATOR ===
k = ta.sma(ta.stoch(close, high, low, stochKLen), stochSmooth)
d = ta.sma(k, stochDLen)

// === CÁC MỨC ĐỘ ĐỘNG ===
var float entryPrice = na
var bool inTrade = false

// === CÁC ĐIỀU KIỆN MUA ===
buyCondition = ta.crossover(k, d) and k < 80

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

// === CÁC MỨC TP VÀ SL ===
takeProfitPrice = entryPrice * tpMultiplier
stopLossPrice = entryPrice * slMultiplier

// === CÁC ĐIỀU KIỆN THOÁT ===
exitConditionTP = inTrade and close >= takeProfitPrice
exitConditionSL = inTrade and close <= stopLossPrice

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

// === ĐỒ THỊ ===
plotshape(buyCondition and not inTrade, title="Tín Hiệu Mua", location=location.belowbar, color=color.green, style=shape.labelup, text="MUA")
plotshape(exitConditionTP, title="Lấy Lợi Nhuận", location=location.abovebar, color=color.red, style=shape.labeldown, text="TP")
plotshape(exitConditionSL, title="Dừng Lỗ", location=location.abovebar, color=color.orange, style=shape.labeldown, text="SL")

plot(entryPrice, title="Giá Nhập", color=color.new(color.green, 60))
plot(inTrade ? takeProfitPrice : na, title="Mức Lợi Nhuận", color=color.new(color.red, 60), style=plot.style_line)
plot(inTrade ? stopLossPrice : na, title="Mức Dừng Lỗ", color=color.new(color.orange, 60), style=plot.style_line)
#pinescript #Write2Earn
Đăng nhập để khám phá thêm nội dung
Tìm hiểu tin tức mới nhất về tiền mã hóa
⚡️ Hãy tham gia những cuộc thảo luận mới nhất về tiền mã hóa
💬 Tương tác với những nhà sáng tạo mà bạn yêu thích
👍 Thưởng thức nội dung mà bạn quan tâm
Email / Số điện thoại