//@version=5
indicator("Alı Düşkən Strategiyası (İstənilən Coin)", overlay=true)
// === GİRİŞLƏR ===
stochKLen = input.int(14, "Stoxastik %K Uzunluğu")
stochDLen = input.int(3, "Stoxastik %D Uzunluğu")
stochSmooth = input.int(3, "Stoxastik Yaxşılaşdırma")
buyZone = input.float(0.98, "Alı Zone % (məsələn, 0.98 = 2% aşağıda)", step=0.01)
tpMultiplier = input.float(1.05, "Gəlir Alınma % (məsələn, 1.05 = 5% yuxarıda)", step=0.01)
slMultiplier = input.float(0.97, "Xərc Alınma % (məsələn, 0.97 = 3% aşağıda)", step=0.01)
// === STOXASTİK OSİLLYATOR ===
k = ta.sma(ta.stoch(close, high, low, stochKLen), stochSmooth)
d = ta.sma(k, stochDLen)
// === DİNAMİK SƏVİYYƏLƏR ===
var float entryPrice = na
var bool inTrade = false
// === ALI ŞƏRTLƏRİ ===
buyCondition = ta.crossover(k, d) and k < 80
if (buyCondition and not inTrade)
entryPrice := close
inTrade := true
// === GƏLİR ALINMA və XƏRC ALINMA SƏVİYYƏLƏRİ ===
takeProfitPrice = entryPrice * tpMultiplier
stopLossPrice = entryPrice * slMultiplier
// === ÇIXIŞ ŞƏRTLƏRİ ===
exitConditionTP = inTrade and close >= takeProfitPrice
exitConditionSL = inTrade and close <= stopLossPrice
if (exitConditionTP or exitConditionSL)
inTrade := false
entryPrice := na
// === GRAFİK GÖSTƏRİMİ ===
plotshape(buyCondition and not inTrade, title="Alı Sinyali", location=location.belowbar, color=color.green, style=shape.labelup, text="ALI")
plotshape(exitConditionTP, title="Gəlir Alınma", location=location.abovebar, color=color.red, style=shape.labeldown, text="GƏLİR")
plotshape(exitConditionSL, title="Xərc Alınma", location=location.abovebar, color=color.orange, style=shape.labeldown, text="XƏRC")
plot(entryPrice, title="Daxil Olunma Qiyməti", color=color.new(color.green, 60))
plot(inTrade ? takeProfitPrice : na, title="Gəlir Alınma Səviyyəsi", color=color.new(color.red, 60), style=plot.style_line)
plot(inTrade ? stopLossPrice : na, title="Xərc Alınma Səviyyəsi", color=color.new(color.orange, 60), style=plot.style_line)
#pinescript #Write2Earn