
এই কৌশলটি সমর্থন/প্রতিরোধ (S/R) বিরতি/বিপরীতমুখী, ট্রেডিং ভলিউম ফিল্টার এবং সতর্কতা সিস্টেমের সাথে সংযুক্ত, যা বাজারের গুরুত্বপূর্ণ টার্নপয়েন্টগুলিকে ক্যাপচার করে। এই কৌশলটি মূল্যের বিরতি বা বিপরীতমুখী সংকেত সনাক্ত করে এবং ট্রেডিং সিগন্যালের নির্ভরযোগ্যতা বাড়ানোর জন্য অস্বাভাবিক ট্রেডিং ভলিউম নিশ্চিতকরণের সাথে সংযুক্ত। কৌশলটি ঝুঁকি পরিচালনার জন্য একটি স্থির 2% স্টপ লস এবং একটি নিয়মিত স্টপ লস অনুপাত (ডিফল্ট 3%) ব্যবহার করে।
ta.pivothigh()এবংta.pivotlow()ফাংশনটি একটি নির্দিষ্ট সময়ের মধ্যে একটি গুরুত্বপূর্ণ মূল্য স্তর চিহ্নিত করে। যখন মূল্য প্রতিরোধের স্তর অতিক্রম করে (১%) বা সমর্থন থেকে বিপর্যস্ত হয় (নিম্ন অনুসন্ধানের পরে প্রত্যাহার করা হয়) তখন একটি সংকেত ট্রিগার করে।strategy.exit()সম্পন্ন করাএই কৌশলটি একটি উচ্চ-সম্ভাব্যতা ট্রেডিং ফ্রেমওয়ার্ক ডিজাইন করেছে যা বিশেষত প্রবণতার প্রথম দিকে ধরা যায়। মূল সুবিধা হল লজিক্যাল স্বচ্ছতা, ঝুঁকি নিয়ন্ত্রণযোগ্য, তবে অস্থির বাজারে এর সীমাবদ্ধতা সম্পর্কে সতর্কতা অবলম্বন করা উচিত। ভবিষ্যতের অপ্টিমাইজেশনটি আরও স্থিতিশীলতা বাড়ানোর জন্য প্যারামিটার স্ব-অনুকূলিতকরণ এবং প্রবণতা ফিল্টারিংয়ে মনোনিবেশ করতে পারে।
/*backtest
start: 2024-04-24 00:00:00
end: 2024-12-31 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"DOGE_USDT"}]
*/
//@version=5
strategy("S/R Breakout/Reversal + Volume + Alerts", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === INPUTS ===
pivotLen = input.int(10, "Pivot Lookback for S/R")
volSmaLength = input.int(20, "Volume SMA Length")
volMultiplier = input.float(1.5, "Volume Multiplier")
tpPerc = input.float(3.0, "Take Profit %", step=0.1)
slPerc = 2.0 // Stop Loss fixed at 2%
// === S/R ZONES ===
pivotHigh = ta.pivothigh(high, pivotLen, pivotLen)
pivotLow = ta.pivotlow(low, pivotLen, pivotLen)
var float resZone = na
var float supZone = na
if not na(pivotHigh)
resZone := pivotHigh
if not na(pivotLow)
supZone := pivotLow
plot(supZone, title="Support", color=color.green, linewidth=2, style=plot.style_linebr)
plot(resZone, title="Resistance", color=color.red, linewidth=2, style=plot.style_linebr)
// === VOLUME FILTER ===
volSma = ta.sma(volume, volSmaLength)
highVolume = volume > volSma * volMultiplier
// === LONG LOGIC ===
priceAboveRes = close > resZone * 1.01
nearSupport = close >= supZone * 0.99 and close <= supZone * 1.01
rejectSupport = low <= supZone and close > supZone
longBreakoutCond = priceAboveRes and highVolume
longReversalCond = nearSupport and rejectSupport and highVolume
longCondition = longBreakoutCond or longReversalCond
// === SHORT LOGIC ===
priceBelowSup = close < supZone * 0.99
nearResistance = close >= resZone * 0.99 and close <= resZone * 1.01
rejectResistance = high >= resZone and close < resZone
shortBreakoutCond = priceBelowSup and highVolume
shortReversalCond = nearResistance and rejectResistance and highVolume
shortCondition = shortBreakoutCond or shortReversalCond
// === ENTRIES WITH LABELS ===
if (longCondition)
strategy.entry("Long", strategy.long)
label.new(bar_index, low * 0.995, "BUY", style=label.style_label_up, color=color.green, textcolor=color.white)
if (shortCondition)
strategy.entry("Short", strategy.short)
label.new(bar_index, high * 1.005, "SELL", style=label.style_label_down, color=color.red, textcolor=color.white)
// === TP/SL ===
longTP = close * (1 + tpPerc / 100)
longSL = close * (1 - slPerc / 100)
shortTP = close * (1 - tpPerc / 100)
shortSL = close * (1 + slPerc / 100)
strategy.exit("Long TP/SL", from_entry="Long", limit=longTP, stop=longSL)
strategy.exit("Short TP/SL", from_entry="Short", limit=shortTP, stop=shortSL)
// === ALERT CONDITIONS ===
alertcondition(longCondition, title="Buy Alert", message="🔔 BUY signal: S/R + Volume breakout/reversal")
alertcondition(shortCondition, title="Sell Alert", message="🔔 SELL signal: S/R + Volume breakout/reversal")