//@version=5
indicator("Double Bottom Detector for MUBARAK", overlay=true)
// ورودیها
length = input(5, title="Length for Low Detection")
volumeThreshold = input(2.5, title="Volume Threshold (Million)")
// محاسبات
lowPrice = ta.lowest(low, length)
currentPrice = close
currentVolume = volume / 1000000 // تبدیل حجم به میلیون
// تشخیص دو دره
isDoubleBottom = ta.lowest(lowPrice , 2) == lowPrice and lowPrice < lowPrice and currentPrice > lowPrice and currentVolume > volumeThreshold
// رسم خطوط حمایت و مقاومت
plotshape(isDoubleBottom and currentPrice > lowPrice * 1.02, title="Double Bottom Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plot(0.0295, "Neck Line", color=color.red, style=plot.style_dashed)
// سیگنال
if isDoubleBottom and currentPrice > 0.0295
label.new(bar_index, low, "صعودی: تارگت 0.0310-0.0320", color=color.green, textcolor=color.white, style=label.style_label_down)
else if currentPrice < 0.0270
label.new(bar_index, low, "هشدار: استاپ لاس فعال", color=color.red, textcolor=color.white, style=label.style_label_down)
// شرایط هشدار
alertcondition(isDoubleBottom and currentPrice > 0.0295, title="Double Bottom Confirmed", message="الگوی دو دره تأیید شد! تارگت: 0.0310-0.0320")