RSI সূচক দীর্ঘ স্বল্প বিচ্ছেদ ট্রেডিং কৌশল

লেখক:চাওঝাং, তারিখঃ ২০২৪-০২-২৬ ১৩ঃ৪৯ঃ২৫
ট্যাগঃ

img

সারসংক্ষেপ

এই কৌশলটি ট্রেডিং সিদ্ধান্ত নেওয়ার জন্য আরএসআই সূচকের মাধ্যমে দীর্ঘ স্বল্প বিচ্ছেদের ঘটনাগুলি সনাক্ত করে। মূল ধারণাটি হ'ল যখন দামগুলি নতুন নিম্ন স্তরে পৌঁছেছে তবে আরএসআই সূচক নতুন উচ্চতায় পৌঁছেছে, তখন একটি বুলিশ বিচ্ছেদ সংকেত উত্পন্ন হয়, যা ইঙ্গিত করে যে নীচে গঠিত হয়েছে এবং দীর্ঘ যাচ্ছে। যখন দামগুলি নতুন উচ্চতায় পৌঁছেছে তবে আরএসআই সূচক নতুন নিম্ন স্তরে পৌঁছেছে, তখন একটি হ্রাস বিচ্ছেদ সংকেত উত্পন্ন হয়, যা ইঙ্গিত করে যে শীর্ষটি গঠিত হয়েছে এবং শর্ট যাচ্ছে।

কৌশলগত নীতি

এই কৌশলটি মূলত RSI সূচক ব্যবহার করে দাম এবং RSI এর মধ্যে দীর্ঘ স্বল্প বিচ্ছেদ সনাক্ত করতে। নির্দিষ্ট পদ্ধতিটি নিম্নরূপঃ

  1. সূত্র হিসাবে RSI সূচক প্যারামিটার 13 এবং বন্ধ মূল্য ব্যবহার করুন
  2. বাউলিশ বিচ্ছেদের জন্য বাম দিকে ফিরে দেখার পরিসীমা 14 দিন এবং ডান দিকে ফিরে দেখার পরিসীমা 2 দিন হিসাবে সংজ্ঞায়িত করুন
  3. বিয়ারিশ বিচ্ছেদের জন্য বাম দিকে লুকব্যাক পরিসীমা 47 দিন এবং ডান দিকে লুকব্যাক পরিসীমা 1 দিন হিসাবে সংজ্ঞায়িত করুন
  4. যখন দাম নিম্নতম আঘাত কিন্তু RSI উচ্চতর lows আঘাত, দীর্ঘ বিচ্ছেদ শর্ত দীর্ঘ সংকেত উৎপন্ন পূরণ করা হয়
  5. যখন দামগুলি উচ্চতর উচ্চতায় আঘাত করে কিন্তু আরএসআই নিম্নতম উচ্চতায় আঘাত করে, তখন সংক্ষিপ্ত সংকেত তৈরির জন্য সংক্ষিপ্ত বিচ্ছেদের শর্ত পূরণ করা হয়

দাম এবং আরএসআই-র মধ্যে দীর্ঘ স্বল্প বিচ্ছেদ চিহ্নিত করে, এটি বাণিজ্য সিদ্ধান্ত গ্রহণের জন্য মূল্যের প্রবণতার inflection পয়েন্টগুলি আগে থেকে ক্যাপচার করতে পারে।

কৌশলটির সুবিধা

এই কৌশলটির প্রধান সুবিধাগুলো হল:

  1. মূল্য/আরএসআই বিভাজন চিহ্নিত করা ট্রেডিং সুযোগগুলি ধরার জন্য প্রবণতা প্রবণতাকে দ্রুত বিচার করতে পারে
  2. ইন্ডিকেটর বিশ্লেষণ ব্যবহার করুন যাতে আবেগের দ্বারা কম প্রভাবিত হয়
  3. পৃথকীকরণ সনাক্ত করতে স্থির লুকব্যাক সময়কাল ব্যবহার করুন, ঘন ঘন পরামিতি সুরক্ষা এড়ানো
  4. দৈনিক আরএসআই এর মতো অতিরিক্ত শর্তগুলি মিথ্যা সংকেতগুলি হ্রাস করে

ঝুঁকি এবং সমাধান

এখনো কিছু ঝুঁকি আছে:

  1. আরএসআই বিভক্তির অর্থ অবিলম্বে বিপরীতমুখী নয়, সময় বিলম্ব থাকতে পারে যা স্টপ লস ঝুঁকির দিকে পরিচালিত করে। সমাধানটি হ'ল বিভক্তি সংকেতের নিশ্চিতকরণের জন্য সময় দেওয়ার জন্য বৃহত্তর স্টপগুলিকে অনুমতি দেওয়া।

  2. দীর্ঘমেয়াদী বিচ্ছেদও ঝুঁকি বাড়ায়। সমাধানটি ফিল্টার শর্ত হিসাবে দীর্ঘমেয়াদী দৈনিক বা সাপ্তাহিক আরএসআই যুক্ত করা।

  3. সামান্য বিভক্তি প্রবণতা বিপরীত হতে পারে না, আরো উল্লেখযোগ্য RSI বিভক্তি খুঁজে পেতে পুনর্বিবেচনা সময়কাল প্রসারিত করতে হবে।

অপ্টিমাইজেশান নির্দেশাবলী

কৌশলটি নিম্নলিখিত দিকগুলিতে উন্নত করা যেতে পারেঃ

  1. সর্বোত্তম প্যারামিটার সমন্বয় খুঁজে পেতে RSI পরামিতি অপ্টিমাইজ করুন

  2. বিচ্ছেদ সনাক্ত করতে MACD, KD এর মত অন্যান্য প্রযুক্তিগত সূচক চেষ্টা করুন

  3. অস্থির সময়ে মিথ্যা সংকেত কমাতে দোলন ফিল্টার যোগ করুন

  4. সেরা সংমিশ্রণ সংকেত খুঁজে পেতে একাধিক টাইমফ্রেম থেকে RSI একত্রিত করুন

সিদ্ধান্ত

আরএসআই লং শর্ট সেপারেশন ট্রেডিং কৌশলটি ট্রেডিং সিগন্যাল তৈরির জন্য মূল্য এবং আরএসআই এর মধ্যে পার্থক্য চিহ্নিত করে প্রবণতা প্রবণতা বিচার করে। কৌশলটি সহজ এবং ব্যবহারিক। পরামিতিগুলি আরও উন্নত করা এবং ফিল্টার যুক্ত করা লাভজনকতা বাড়িয়ে তুলতে পারে। সামগ্রিকভাবে একটি কার্যকর পরিমাণগত ট্রেডিং কৌশল।


/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Nextep

//@version=4
strategy(title="RSI top&bottom destroy ", overlay=false, pyramiding=4, default_qty_value=2, default_qty_type=strategy.fixed, initial_capital=10000, currency=currency.USD)







// INPUT Settings --------------------------------------------------------------------------------------------------------------------------------------------------
len = input(title="RSI Period", minval=1, defval=13)
src = input(title="RSI Source", defval=close)





// defining the lookback range for shorts
lbRshort = input(title="Short Lookback Right", defval=1)
lbLshort = input(title="Short Lookback Left", defval=47)

// defining the lookback range for longs
lbRlong = input(title="Long Lookback Right", defval=2)
lbLlong = input(title="Long Lookback Left", defval=14)


rangeUpper = input(title="Max of Lookback Range", defval=400)
rangeLower = input(title="Min of Lookback Range", defval=1)

// take profit levels
takeProfitLongRSILevel = input(title="Take Profit at RSI Level", minval=0, defval=75)
takeProfitShortRSILevel = input(title="Take Profit for Short at RSI Level", minval=0, defval=25)




// Stop loss settings
longStopLossType = input("PERC", title="Long Stop Loss Type", options=['ATR','PERC', 'FIB', 'NONE'])
shortStopLossType = input("PERC", title="Short Stop Loss Type", options=['ATR','PERC', 'FIB', 'NONE'])
longStopLossValue = input(title="Long Stop Loss Value", defval=14, minval=0)
shortStopLossValue = input(title="Short Stop Loss Value", defval=5, minval=-10)








// PLOTTING THE CHARTS --------------------------------------------------------------------------------------------------------------------------------------------------
// Plotting the Divergence
plotBull = input(title="Plot Bullish", defval=true)
plotBear = input(title="Plot Bearish", defval=true)
bearColor = color.orange
bullColor = color.green
textColor = color.white
noneColor = color.new(color.white, 100)

// Adding the RSI oscillator
osc = rsi(src, len)
ma_len = 14 // Length for the moving average
rsi_ma = sma(osc, ma_len) // Calculate the moving average of RSI
plot(osc, title="RSI", linewidth=1, color=color.purple)
plot(rsi_ma, color=color.blue, title="RSI MA") // Plot the RSI MA

// Adding the lines of the RSI oscillator
plot(osc, title="RSI", linewidth=1, color=color.purple)
hline(50, title="Middle Line", linestyle=hline.style_dotted)
obLevel = hline(75, title="Overbought", linestyle=hline.style_dotted)
osLevel = hline(25, title="Oversold", linestyle=hline.style_dotted)
fill(obLevel, osLevel, title="Background", color=color.purple, transp=80)


atrLength = input(14, title="ATR Length (for Trailing stop loss)")
atrMultiplier = input(3.5, title="ATR Multiplier (for Trailing stop loss)")







// RSI PIVOTS --------------------------------------------------------------------------------------------------------------------------------------------------
// Define a condition for RSI pivot low
isFirstPivotLowlong = not na(pivotlow(osc, lbLlong, lbRlong))
// Define a condition for RSI pivot high
isFirstPivotHighlong = not na(pivothigh(osc, lbLlong, lbRlong))
// Define a condition for the first RSI value
firstPivotRSIValuelong = isFirstPivotLowlong ? osc[lbRlong] : na
// Define a condition for the second RSI value
secondPivotRSIValuelong = isFirstPivotLowlong ? valuewhen(isFirstPivotLowlong, osc[lbRlong], 1) : na


// Define a condition for RSI pivot low
isFirstPivotLowshort = not na(pivotlow(osc, lbLshort, lbRshort))
// Define a condition for RSI pivot high
isFirstPivotHighshort = not na(pivothigh(osc, lbLshort, lbRshort))
// Define a condition for the first RSI value
firstPivotRSIValueshort = isFirstPivotLowshort ? osc[lbRshort] : na
// Define a condition for the second RSI value
secondPivotRSIValueshort = isFirstPivotLowshort ? valuewhen(isFirstPivotLowshort, osc[lbRshort], 1) : na

_inRange(cond) =>
    bars = barssince(cond == true)
    rangeLower <= bars and bars <= rangeUpper









// ADDITIONAL ENTRY CRITERIA --------------------------------------------------------------------------------------------------------------------------------------------------
// RSI crosses RSI MA up by more than 2 points and subsequently down
rsiUpCross = crossover(osc, rsi_ma + 1)
rsiDownCross = crossunder(osc, rsi_ma - 1)

// Calculate the daily RSI
rsiDaily = security(syminfo.ticker, "D", rsi(src, 14))





// BULLISH CONDITIONS --------------------------------------------------------------------------------------------------------------------------------------------------

// LOWER LOW PRICE & HIGHER LOW OSC

// Price: Lower Low
priceLL = na(isFirstPivotLowlong[1]) ? false : (low[lbRlong] < valuewhen(isFirstPivotLowlong, low[lbRlong], 1))
// Osc: Higher Low
oscHL = na(isFirstPivotLowlong[1]) ? false : (osc[lbRlong] > valuewhen(isFirstPivotLowlong, osc[lbRlong], 1) and _inRange(isFirstPivotLowlong[1]))



// BULLISH PLOT
bullCond = plotBull and priceLL and oscHL and isFirstPivotLowlong
plot(
     isFirstPivotLowlong ? osc[lbRlong] : na,
     offset=-lbRlong,
     title="Regular Bullish",
     linewidth=2,
     color=(bullCond ? bullColor : noneColor),
     transp=0
     )

plotshape(
     bullCond ? osc[lbRlong] : na,
     offset=-lbRlong,
     title="Regular Bullish Label",
     text=" Bull ",
     style=shape.labelup,
     location=location.absolute,
     color=bullColor,
     textcolor=textColor,
     transp=0
     )









// BEARISH CONDITIONS --------------------------------------------------------------------------------------------------------------------------------------------------

// HIGHER HIGH PRICE & LOWER LOW OSC
// Osc: Lower High
oscLH = na(isFirstPivotHighshort[1]) ? false : (osc[lbRshort] < valuewhen(isFirstPivotHighshort, osc[lbRshort], 1) and _inRange(isFirstPivotHighshort[1]))
// Price: Higher High
priceHH = na(isFirstPivotHighshort[1]) ? false : (high[lbRshort] > valuewhen(isFirstPivotHighshort, high[lbRshort], 1))


// BEARISH PLOT
bearCond = plotBear and priceHH and oscLH and isFirstPivotHighshort

plot(
     isFirstPivotHighshort ? osc[lbRshort] : na,
     offset=-lbRshort,
     title="Regular Bearish",
     linewidth=2,
     color=(bearCond ? bearColor : noneColor),
     transp=0
     )

plotshape(
     bearCond ? osc[lbRshort] : na,
     offset=-lbRshort,
     title="Regular Bearish Label",
     text=" Bear ",
     style=shape.labeldown,
     location=location.absolute,
     color=bearColor,
     textcolor=textColor,
     transp=0
     )




// ENTRY CONDITIONS --------------------------------------------------------------------------------------------------------------------------------------------------

longCondition = false
shortCondition = false

// Entry Conditions
longCondition := bullCond
shortCondition := bearCond

// Conditions to prevent entering trades based on daily RSI
longCondition := longCondition and rsiDaily >= 23
shortCondition := shortCondition and rsiDaily <= 80




// STOPLOSS CONDITIONS --------------------------------------------------------------------------------------------------------------------------------------------------
// Stoploss Conditions
long_sl_val = 
      longStopLossType == "ATR" ? longStopLossValue * atr(atrLength) 
      : longStopLossType == "PERC" ? close * longStopLossValue / 100 : 0.00
long_trailing_sl = 0.0
long_trailing_sl := strategy.position_size >= 1 ? max(low - long_sl_val, nz(long_trailing_sl[1])) : na

// Calculate Trailing Stop Loss for Short Entries
short_sl_val = 
      shortStopLossType == "ATR" ? 1 - shortStopLossValue * atr(atrLength) 
      : shortStopLossType == "PERC" ? close * (shortStopLossValue / 100) : 0.00 //PERC = shortstoplossvalue = -21300 * 5 / 100 = -1065
short_trailing_sl = 0.0
short_trailing_sl := strategy.position_size <= -1 ? max(high + short_sl_val, nz(short_trailing_sl[1])) : na






// RSI STOP CONDITION
 
rsiStopShort = (strategy.position_avg_price != 0.0 and close <= strategy.position_avg_price * 0.90) or (strategy.position_avg_price != 0.0 and rsi(src, 14) >= 75)
 
rsiStopLong = (strategy.position_avg_price != 0.0 and close >= strategy.position_avg_price * 1.10) or (strategy.position_avg_price != 0.0 and rsi(src, 14) <= 25)


// LONG CONDITIONS --------------------------------------------------------------------------------------------------------------------------------------------------
strategy.entry(id="RSIDivLELong", long=true, when=longCondition)

strategy.entry(id="RSIDivLEShort", long=false, when=shortCondition)







// Close Conditions
shortCloseCondition = bullCond // or cross(osc, takeProfitShortRSILevel)
strategy.close(id="RSIDivLEShort", comment="Close All="+tostring(-close + strategy.position_avg_price, "####.##"), when=abs(strategy.position_size) <= -1 and shortStopLossType == "NONE" and shortCloseCondition )
strategy.close(id="RSIDivLEShort", comment="TSL="+tostring(-close + strategy.position_avg_price, "####.##"), when=abs(strategy.position_size) >= -1 and ((shortStopLossType == "PERC" or shortStopLossType == "ATR") and cross(short_trailing_sl,high))) // or rsiStopShort)// or rsiStopShort)


longCloseCondition = bearCond
strategy.close(id="RSIDivLELong", comment="Close All="+tostring(close - strategy.position_avg_price, "####.##"), when=abs(strategy.position_size) >= 1 and longStopLossType == "NONE" and longCloseCondition)
strategy.close(id="RSIDivLELong", comment="TSL="+tostring(close - strategy.position_avg_price, "####.##"), when=abs(strategy.position_size) >= 1 and ((longStopLossType == "PERC" or longStopLossType == "ATR") and cross(long_trailing_sl,low)))  //or rsiStopLong


আরো