
এটি একটি প্রবণতা বিপরীত ট্রেডিং কৌশল যা তুলনামূলকভাবে দুর্বল সূচক ((আরএসআই) এবং এলোমেলো তুলনামূলকভাবে দুর্বল সূচক ((স্টোক্যাস্টিক আরএসআই) এর সাথে মিলিত হয়। এই কৌশলটি বাজারের ওভারব্রেড ওভারসোলের অবস্থা এবং গতিশীলতার পরিবর্তনগুলি সনাক্ত করে সম্ভাব্য বিপরীত পয়েন্টগুলিকে ক্যাপচার করে, যার ফলে ট্রেডিং করা যায়। কৌশলটির মূলটি হল আরএসআইকে একটি মৌলিক গতিশীলতার সূচক হিসাবে ব্যবহার করা এবং তার ভিত্তিতে স্টোক্যাস্টিক আরএসআই গণনা করা যাতে দামের গতিশীলতার পরিবর্তনের দিকটি আরও নিশ্চিত করা যায়।
কৌশলটির মূল যুক্তি নিম্নলিখিত মূল পদক্ষেপগুলি নিয়ে গঠিতঃ
এটি একটি সমন্বিত কৌশল যা গতিশীলতা এবং প্রবণতা বিপরীতকরণের সমন্বয় করে, আরএসআই এবং স্টোক্যাস্টিক আরএসআইয়ের সমন্বয়মূলক কার্যকারিতার মাধ্যমে সম্ভাব্য ব্যবসায়ের সুযোগগুলি সনাক্ত করে। কৌশলটি যুক্তিসঙ্গতভাবে ডিজাইন করা হয়েছে, ভাল সামঞ্জস্যযোগ্যতা এবং অভিযোজনযোগ্যতা রয়েছে। তবে বাস্তব প্রয়োগে বাজারের পরিবেশের পছন্দ এবং ঝুঁকি নিয়ন্ত্রণের দিকে মনোযোগ দেওয়া দরকার, রিয়েল-টাইম ট্রেডিংয়ের আগে পর্যাপ্ত ফিডব্যাক এবং প্যারামিটার অপ্টিমাইজেশন করার পরামর্শ দেওয়া হয়।
/*backtest
start: 2024-06-15 00:00:00
end: 2025-02-19 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
//@version=5
strategy("RSI + Stochastic RSI Strategy", overlay=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// INPUTS
// RSI settings
rsiLength = input.int(14, "RSI Length", minval=1)
rsiOverbought = input.int(70, "RSI Overbought Level")
rsiOversold = input.int(30, "RSI Oversold Level")
// Stochastic RSI settings
stochLength = input.int(14, "Stoch RSI Length", minval=1)
smoothK = input.int(3, "Stoch %K Smoothing", minval=1)
smoothD = input.int(3, "Stoch %D Smoothing", minval=1)
stochOverbought = input.int(80, "Stoch Overbought Level")
stochOversold = input.int(20, "Stoch Oversold Level")
// CALCULATIONS
// Compute RSI value on the closing price
rsiValue = ta.rsi(close, rsiLength)
// Calculate Stochastic RSI using the RSI value as source
rsiStoch = ta.stoch(rsiValue, rsiValue, rsiValue, stochLength)
kValue = ta.sma(rsiStoch, smoothK)
dValue = ta.sma(kValue, smoothD)
// PLOTTING
// Plot RSI and reference lines
plot(rsiValue, title="RSI", color=color.blue)
hline(rsiOverbought, "RSI Overbought", color=color.red)
hline(rsiOversold, "RSI Oversold", color=color.green)
// Plot Stochastic RSI %K and %D along with overbought/oversold levels
plot(kValue, title="Stoch %K", color=color.orange)
plot(dValue, title="Stoch %D", color=color.purple)
hline(stochOverbought, "Stoch Overbought", color=color.red, linestyle=hline.style_dotted)
hline(stochOversold, "Stoch Oversold", color=color.green, linestyle=hline.style_dotted)
// STRATEGY CONDITIONS
// Long Condition: RSI below oversold and Stoch RSI crosses upward while in oversold territory
longCondition = (rsiValue < rsiOversold) and (kValue < stochOversold) and ta.crossover(kValue, dValue)
// Long Exit: When RSI goes above overbought or a downward cross occurs on the Stoch RSI
longExit = (rsiValue > rsiOverbought) or ta.crossunder(kValue, dValue)
// Short Condition: RSI above overbought and Stoch RSI crosses downward while in overbought territory
shortCondition = (rsiValue > rsiOverbought) and (kValue > stochOverbought) and ta.crossunder(kValue, dValue)
// Short Exit: When RSI goes below oversold or an upward cross occurs on the Stoch RSI
shortExit = (rsiValue < rsiOversold) or ta.crossover(kValue, dValue)
// EXECUTE TRADES
if (longCondition)
strategy.entry("Long", strategy.long)
if (longExit)
strategy.close("Long")
if (shortCondition)
strategy.entry("Short", strategy.short)
if (shortExit)
strategy.close("Short")