پییوٹ پر مبنی آر ایس آئی ڈائیورجنسی حکمت عملی

مصنف:چاؤ ژانگ، تاریخ: 2023-11-28 13:43:05
ٹیگز:

img

جائزہ

اس حکمت عملی کو Pivot پر مبنی RSI Divergence Strategy کہا جاتا ہے۔ یہ مختلف سائیکلوں پر RSI اشارے کے مابین اختلاف کا استعمال داخلہ اور باہر نکلنے کے مقامات کا تعین کرنے کے لئے کرتا ہے ، اور حکمت عملی کے استحکام کو بہتر بنانے کے لئے فلٹر کی حالت کے طور پر طویل مدتی RSI شامل کرتا ہے۔

حکمت عملی منطق

حکمت عملی بنیادی طور پر خریدنے کے موقع کا جائزہ لیتی ہے جب قلیل مدتی آر ایس آئی (جیسے 5 دن کے آر ایس آئی) اور قیمت کے مابین پوشیدہ تیزی سے انحراف یا بھاری انحراف ہوتا ہے؛ اور جب پوشیدہ bearish انحراف یا بھاری انحراف ہوتا ہے تو فروخت کرنا۔

باقاعدگی سے تیزی سے تغیر کا مطلب یہ ہے کہ قیمت ایک نئی کم ہوتی ہے جبکہ آر ایس آئی نئی کم نہیں کرتا ہے۔ پوشیدہ تیزی سے تغیر اس کے برعکس ہے ، قیمت نئی کم نہیں ہوتی ہے جبکہ آر ایس آئی نئی کم ہوتی ہے۔ دونوں تعریفوں میں حوالہ دیئے گئے نئی کمیں اور نئی اونچائییں ایک خاص رولنگ ونڈو پر تاریخی انتہا پسندی سے متعلق ہیں۔

اس کے علاوہ ، حکمت عملی میں فلٹر کی شرط کے طور پر طویل مدتی آر ایس آئی (جیسے 50 دن کا آر ایس آئی) بھی متعارف کرایا گیا ہے۔ یہ صرف اس وقت خرید سگنل پر غور کرتا ہے جب طویل آر ایس آئی 50 سے زیادہ ہو؛ اور جب طویل آر ایس آئی 30 سے کم ہو تو اسٹاپ نقصان یا منافع نکالنے پر غور کرتا ہے۔

فوائد

اس حکمت عملی کا سب سے بڑا فائدہ یہ ہے کہ یہ قلیل مدتی پر RSI اختلاف سگنل اور طویل مدتی RSI کے فلٹر دونوں کا استعمال کرتا ہے ، جو کسی حد تک پھنس جانے اور رجحانات کو یاد کرنے سے بچ سکتا ہے۔ خاص طور پر اس کے مندرجہ ذیل اہم فوائد ہیں:

  1. قلیل مدتی آر ایس آئی انحراف سگنل قیمتوں کے الٹ جانے کے مواقع کا ابتدائی فیصلہ دے سکتا ہے اور بروقت موڑ کے مقامات کو پکڑ سکتا ہے۔
  2. طویل مدتی آر ایس آئی فلٹر جب رجحان غیر یقینی ہے تو طویل عرصے سے اندھے طور پر جانے سے بچتا ہے.
  3. متعدد قسم کے منافع لینے کے طریقے اور جزوی منافع لینے سے خطرے کو کم کرنے میں مدد ملتی ہے۔
  4. اہرام سازی کا طریقہ کار پوزیشنوں کو شامل کرنے کی اجازت دیتا ہے اور منافع کی صلاحیت کو مزید بڑھا دیتا ہے۔

خطرات

اس حکمت عملی میں کچھ خطرات بھی ہیں:

  1. RSI اختلافات ہمیشہ درست نہیں ہوتے اور غلط سگنل بھی ہو سکتے ہیں۔
  2. پیرامائڈنگ کے بعد خطرات میں اضافہ ہوتا ہے۔ اگر فیصلہ غلط ہے تو نقصانات تیز ہو سکتے ہیں۔
  3. غیر مناسب منافع لینے کی ترتیبات بھی قبل از وقت منافع لینے یا ناکافی منافع کا باعث بن سکتی ہیں۔

اسی طرح کے رسک مینجمنٹ کے اقدامات میں شامل ہیں: سٹاپ نقصان / منافع حاصل کرنے کی مناسب شرائط کا تعین کرنا ، پوزیشن سائزنگ کو کنٹرول کرنا ، ایکویٹی وکر کو ہموار کرنے کے لئے جزوی منافع حاصل کرنا ، وغیرہ۔

اصلاح کی ہدایات

حکمت عملی کو مزید بہتر بنانے کی گنجائش ہے:

  1. RSI پیرامیٹرز کو بہترین مجموعہ تلاش کرنے کے لئے مزید بہتر بنایا جا سکتا ہے؛
  2. دیگر اشارے جیسے MACD اور KD کے انحراف کے سگنل کی جانچ کی جا سکتی ہے۔
  3. پیرامیٹرز کو خاص طور پر کچھ مصنوعات (جیسے خام تیل ، قیمتی دھاتیں ، وغیرہ) پر بہتر بنایا جاسکتا ہے تاکہ موافقت کو بہتر بنایا جاسکے۔

خلاصہ

یہ حکمت عملی قلیل مدتی اور طویل مدتی کے طویل / مختصر آر ایس آئی تغیراتی سگنلز کو یکجا کرتی ہے تاکہ خطرات پر قابو پانے کے ساتھ منافع میں اضافہ کیا جاسکے۔ اس میں مقداری حکمت عملی کے ڈیزائن میں متعدد اصولوں کی عکاسی ہوتی ہے ، بشمول کب داخل ہونا ، کب باہر نکلنا ، جزوی منافع اٹھانا ، نقصان کو روکنا / منافع حاصل کرنا وغیرہ۔ یہ حوالہ کے لئے ایک مثالی آر ایس آئی تغیراتی حکمت عملی ہے۔


/*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)



مزید