टर्निंग पॉइंट पर आधारित आरएसआई डायवर्जेंस रणनीति


निर्माण तिथि: 2023-11-28 13:43:05 अंत में संशोधित करें: 2023-11-28 13:43:05
कॉपी: 1 क्लिक्स: 977
1
ध्यान केंद्रित करना
1617
समर्थक

टर्निंग पॉइंट पर आधारित आरएसआई डायवर्जेंस रणनीति

अवलोकन

इस रणनीति को पिवट-आधारित आरएसआई विचलन रणनीति कहा जाता है। यह खरीद और बिक्री के बिंदुओं को निर्धारित करने के लिए आरएसआई सूचकांक का उपयोग करता है, और इस आधार पर, लंबी लाइन आरएसआई को फ़िल्टर शर्त के रूप में जोड़ता है, जिससे रणनीति की स्थिरता बढ़ जाती है।

रणनीति सिद्धांत

यह रणनीति मुख्य रूप से शॉर्ट आरएसआई (जैसे 5 दिन का आरएसआई) को खरीदने के अवसरों के साथ खरीदती है, जब कीमत में छिपा हुआ बहु-सिर पीछे हट जाता है या सामान्य बहु-सिर पीछे हट जाता है; जब छिपा हुआ बहु-सिर पीछे हट जाता है या सामान्य बहु-सिर पीछे हट जाता है, तो इसे बेच दिया जाता है।

एक नियमित बहुहेड रिवर्स रिवर्स को संदर्भित करता है जब कीमत कम होती है और आरएसआई कम नहीं होता है; एक छिपी हुई बहुहेड रिवर्स रिवर्स को संदर्भित करता है जब कीमत कम होती है और आरएसआई कम होता है। दोनों को रिवर्स कम और रिवर्स उच्च के रूप में परिभाषित किया गया है, जो एक निश्चित रोलिंग विंडो के ऐतिहासिक चरम के सापेक्ष है।

इसके अलावा, रणनीति एक लंबी लाइन आरएसआई (जैसे 50 दिन आरएसआई) को फ़िल्टर करने की आवश्यकता के रूप में पेश करती है। केवल एक खरीद संकेत पर विचार किया जाता है जब लंबी आरएसआई 50 से अधिक है; एक स्टॉप-लॉस या स्टॉप-आउट पर विचार करें जब लंबी आरएसआई 30 से कम है।

रणनीतिक लाभ

इस रणनीति का सबसे बड़ा लाभ यह है कि यह शॉर्ट लाइन आरएसआई के विचलन सिग्नल और लंबी लाइन आरएसआई के फ़िल्टरिंग का उपयोग करता है, जिससे कुछ हद तक फिसलन और चूक से बचा जा सकता है। विशेष रूप से, मुख्य रूप से निम्नलिखित लाभ हैंः

  1. शॉर्ट लाइन आरएसआई सिग्नल से दूर है, जो मूल्य में बदलाव की संभावनाओं को पहले से निर्धारित करता है और समय पर टर्निंग पॉइंट्स को पकड़ता है;
  2. लंबी लाइन आरएसआई फ़िल्टर शर्तें अनिश्चितता के दौरान अंधाधुंध रूप से अधिक करने से बचती हैं;
  3. विभिन्न प्रकार के रोकथाम के तरीके, जो जोखिम को कम करने के लिए रोकथाम के बैचों का उपयोग करते हैं;
  4. पिरामिडिंग के कारण, निवेशकों को अधिक लाभ कमाने की अनुमति मिलती है।

रणनीतिक जोखिम

इस रणनीति के कुछ जोखिम भी हैं, जिनके बारे में ध्यान देने की आवश्यकता हैः

  1. RSI विचलन हमेशा काम नहीं करता है और झूठे संकेतों का कारण बन सकता है;
  2. यदि आप गलत निर्णय लेते हैं, तो नुकसान तेजी से बढ़ सकता है;
  3. गलत स्टॉप सेटिंग भी समय से पहले स्टॉप या कम मुनाफे का कारण बन सकती है।

इसके लिए जोखिम प्रबंधन उपायों में शामिल हैंः उचित स्टॉप-लॉस और स्टॉप-ऑफ स्थितियों को स्थापित करना, प्रत्येक स्थिति के आकार को नियंत्रित करना, स्टॉप-लॉस और स्टॉप-लॉस वक्र को चिकना करने के लिए स्टॉप-ऑफ को कम करना आदि।

अनुकूलन दिशा

इस रणनीति को और भी बेहतर बनाने के लिए जगह हैः

  1. आरएसआई पैरामीटर को और अधिक अनुकूलित किया जा सकता है, जो कि सर्वोत्तम पैरामीटर संयोजन को खोजने के लिए है;
  2. अन्य संकेतकों के विचलन संकेतों का परीक्षण किया जा सकता है, जैसे कि MACD, KD, आदि;
  3. विशेष रूप से अनुकूलित किया जा सकता है (जैसे कच्चे तेल, कीमती धातु, आदि) विशेष रूप से अनुकूलित करने के लिए, अनुकूलनशीलता में सुधार।

संक्षेप

इस रणनीति में लघु और दीर्घ रेखा RSI के बहु-अवरोध संकेतों का व्यापक उपयोग किया गया है, जिससे जोखिम को नियंत्रित करते हुए लाभप्रदता में सुधार किया जा सकता है। यह एक मात्रात्मक ट्रेडिंग रणनीति के डिजाइन के कई सिद्धांतों को दर्शाता है, जिसमें कब प्रवेश करना है, कब बाहर जाना है, बैचों को कम करना है, स्टॉप-लॉस सेट करना है। यह एक आरएसआई-अवरोध रणनीति का उदाहरण है जिसका उपयोग संदर्भ के लिए किया जा सकता है।

रणनीति स्रोत कोड
/*backtest
start: 2023-11-20 00:00:00
end: 2023-11-27 00:00:00
period: 5m
basePeriod: 1m
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/
// © mohanee

//@version=4

//GOOGL setting  5 ,50 close, 3 , 1  profitLevel at 75 and No stop Loss shows win rate 99.03 % profit factor 5830.152

strategy(title="RSI5_50 with Divergence", overlay=false,pyramiding=2, default_qty_type=strategy.fixed, default_qty_value=3,    initial_capital=10000, currency=currency.USD)

len = input(title="RSI Period", minval=1, defval=5)
longRSILen = input(title="Long RSI Period", minval=10, defval=50)
src = input(title="RSI Source", defval=close)
lbR = input(title="Pivot Lookback Right", defval=3)
lbL = input(title="Pivot Lookback Left", defval=1)
takeProfitRSILevel = input(title="Take Profit at RSI Level", minval=50, defval=75)
stopLoss = input(title="Stop Loss%(if checked 8% rule applied)", defval=false)

shortTermRSI = rsi(close,len)
longTermRSI = rsi(close,longRSILen)

rangeUpper = input(title="Max of Lookback Range", defval=60)
rangeLower = input(title="Min of Lookback Range", defval=5)
plotBull = input(title="Plot Bullish", defval=true)
plotHiddenBull = input(title="Plot Hidden Bullish", defval=true)
plotBear = input(title="Plot Bearish", defval=true)
plotHiddenBear = input(title="Plot Hidden Bearish", defval=false)


bearColor = color.purple
bullColor = color.green
hiddenBullColor = color.new(color.green, 80)
hiddenBearColor = color.new(color.red, 80)
textColor = color.white
noneColor = color.new(color.white, 100)



plot(shortTermRSI, title="RSI", linewidth=2, color=#8D1699)
plot(longTermRSI, title="longTermRSI", linewidth=2, color=color.orange)

hline(50, title="Middle Line", linestyle=hline.style_dotted)
obLevel = hline(70, title="Overbought", linestyle=hline.style_dotted)
osLevel = hline(30, title="Oversold", linestyle=hline.style_dotted)
fill(obLevel, osLevel, title="Background", color=longTermRSI >=50 ? color.green:color.purple, transp=65)  // longTermRSI >=50

plFound = na(pivotlow(shortTermRSI, lbL, lbR)) ? false : true
phFound = na(pivothigh(shortTermRSI, lbL, lbR)) ? false : true

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

//------------------------------------------------------------------------------
// Regular Bullish

// shortTermRSI: Higher Low
oscHL = shortTermRSI[lbR] > valuewhen(plFound, shortTermRSI[lbR], 1) and _inRange(plFound[1])

// Price: Lower Low
priceLL = low[lbR] < valuewhen(plFound, low[lbR], 1)

bullCond = plotBull and priceLL and oscHL and plFound

plot(
	 plFound ? shortTermRSI[lbR] : na,
	 offset=-lbR,
	 title="Regular Bullish",
	 linewidth=2,
	 color=(bullCond ? bullColor : noneColor),
	 transp=0
	 )


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

//------------------------------------------------------------------------------
// Hidden Bullish

// shortTermRSI: Lower Low
oscLL = shortTermRSI[lbR] < valuewhen(plFound, shortTermRSI[lbR], 1) and _inRange(plFound[1])

// Price: Higher Low
priceHL = low[lbR] > valuewhen(plFound, low[lbR], 1)

hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound

plot(
	 plFound ? shortTermRSI[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bullish",
	 linewidth=2,
	 color=(hiddenBullCond ? hiddenBullColor : noneColor),
	 transp=0
	 )

plotshape(
	 hiddenBullCond ? shortTermRSI[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bullish Label",
	 text=" H Bull ",
	 style=shape.labelup,
	 location=location.absolute,
	 color=bullColor,
	 textcolor=textColor,
	 transp=0
	 )

longCondition= longTermRSI >=50  and ( (bullCond or hiddenBullCond ) )  or  (strategy.position_size>0 and crossover(shortTermRSI,20) )
//last condition above is to leg in if you are already in the Long trade, 


strategy.entry(id="RSIDivLE", long=true,  when=longCondition)


//------------------------------------------------------------------------------
// Regular Bearish

// shortTermRSI: Lower High
oscLH = shortTermRSI[lbR] < valuewhen(phFound, shortTermRSI[lbR], 1) and _inRange(phFound[1])

// Price: Higher High
priceHH = high[lbR] > valuewhen(phFound, high[lbR], 1)

bearCond = plotBear and priceHH and oscLH and phFound

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

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

//------------------------------------------------------------------------------
// Hidden Bearish

// shortTermRSI: Higher High
oscHH = shortTermRSI[lbR] > valuewhen(phFound, shortTermRSI[lbR], 1) and _inRange(phFound[1])

// Price: Lower High
priceLH = high[lbR] < valuewhen(phFound, high[lbR], 1)

hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound

plot(
	 phFound ? shortTermRSI[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bearish",
	 linewidth=2,
	 color=(hiddenBearCond ? hiddenBearColor : noneColor),
	 transp=0
	 )

plotshape(
	 hiddenBearCond ? shortTermRSI[lbR] : na,
	 offset=-lbR,
	 title="Hidden Bearish Label",
	 text=" H Bear ",
	 style=shape.labeldown,
	 location=location.absolute,
	 color=bearColor,
	 textcolor=textColor,
	 transp=0
	 )
	 
	 
//calculate stop Loss
stopLossVal = stopLoss==true ? ( strategy.position_avg_price -  (strategy.position_avg_price*0.08) ) : 0

//partial profit
strategy.close(id="RSIDivLE", comment="TP1", qty=strategy.position_size*3/4, when=strategy.position_size>0 and (longTermRSI>=takeProfitRSILevel or crossover(longTermRSI,90)))
strategy.close(id="RSIDivLE",comment="TP2",   qty=strategy.position_size*3/4 , when=crossover(longTermRSI,70))
strategy.close(id="RSIDivLE",comment="TP3",   qty=strategy.position_size/2, when=crossover(longTermRSI,65))
strategy.close(id="RSIDivLE",comment="TP4",   qty=strategy.position_size/2 , when=crossover(longTermRSI,60))

//close the whole position when stoploss hits or longTermRSI goes below 30
strategy.close(id="RSIDivLE",comment="Exit",    when=crossunder(longTermRSI,30) or close<stopLossVal)