RSI قیمت کے فرق کی مقداری حکمت عملی کے اشارے متحرک نگرانی اور انکولی اصلاح کا نظام

RSI TP SL
تخلیق کی تاریخ: 2025-01-10 16:20:25 آخر میں ترمیم کریں: 2025-01-10 16:20:25
کاپی: 5 کلکس کی تعداد: 421
1
پر توجہ دیں
1617
پیروکار

RSI قیمت کے فرق کی مقداری حکمت عملی کے اشارے متحرک نگرانی اور انکولی اصلاح کا نظام

جائزہ

یہ حکمت عملی RSI اور قیمت کے انحراف پر مبنی ایک ذہین تجارتی نظام ہے جو RSI اشارے اور قیمت کے رجحانات کے درمیان فرق کے تعلق کو متحرک طور پر مانیٹر کر کے مارکیٹ کے الٹ جانے والے اشاروں کو حاصل کرتی ہے۔ یہ حکمت عملی فریکٹلز کو معاون تصدیق کے طور پر مربوط کرتی ہے اور مکمل طور پر خودکار لین دین کے عمل کو حاصل کرنے کے لیے ایک انکولی سٹاپ-پرافٹ اور سٹاپ-لاس میکانزم سے لیس ہے۔ یہ نظام ملٹی ورائٹی اور ملٹی سائیکل ایپلی کیشنز کو سپورٹ کرتا ہے اور اس میں مضبوط لچک اور عملیتا ہے۔

حکمت عملی کا اصول

حکمت عملی کی بنیادی منطق درج ذیل کلیدی عناصر پر مبنی ہے:

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

اسٹریٹجک فوائد

  1. اعلی سگنل کی وشوسنییتا: RSI ڈائیورجن اور فریکٹل تھیوری کا دوہرا تصدیقی طریقہ کار تجارتی سگنلز کی درستگی کو بہت بہتر بناتا ہے۔
  2. مضبوط موافقت: حکمت عملی مختلف مارکیٹ کے حالات کے مطابق پیرامیٹرز کو لچکدار طریقے سے ایڈجسٹ کر سکتی ہے اور اچھی ماحولیاتی موافقت رکھتی ہے۔
  3. پرفیکٹ رسک مینجمنٹ: یہ ہر ٹرانزیکشن کے خطرے کی نمائش کو مؤثر طریقے سے کنٹرول کرنے کے لیے متحرک سٹاپ-پرافٹ اور سٹاپ-لاس میکانزم کو مربوط کرتا ہے۔
  4. آٹومیشن کی اعلیٰ ڈگری: سگنل کی شناخت سے لے کر لین دین کے عمل تک کا پورا عمل خودکار ہے، جس سے انسانی مداخلت کے جذباتی اثرات کم ہوتے ہیں۔
  5. اچھی اسکیل ایبلٹی: حکمت عملی کا فریم ورک پورٹ فولیو سرمایہ کاری میں سہولت فراہم کرتے ہوئے ملٹی ورائٹی اور ملٹی سائیکل ایپلی کیشنز کو سپورٹ کرتا ہے۔

اسٹریٹجک رسک

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

حکمت عملی کی اصلاح کی سمت

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

خلاصہ کریں۔

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

حکمت عملی کا ماخذ کوڈ
/*backtest
start: 2025-01-02 00:00:00
end: 2025-01-09 00:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/

//FRACTALS
//@version=5

//last : 30m 70 68 22 25 0 0 4.7 11.5

//init
capital=1000
percent=100
fees=0//in percent for each entry and exit

//Inputs
start = input(timestamp("1 Feb 2002"), "Start Time", group = "Date")
end = input(timestamp("1 Feb 2052"), "End Time", group = "Date")

//Strategy
strategy("Divergence Finder (RSI/Price) Strategy with Options", overlay = true, initial_capital=capital, default_qty_value=percent, default_qty_type=strategy.percent_of_equity, commission_type=strategy.commission.percent, calc_on_order_fills=false,process_orders_on_close=true , commission_value=fees, currency=currency.EUR, calc_on_every_tick=true, use_bar_magnifier=false)
//indicator("Divergence Finder (RSI/Price) with Options", overlay=true, max_boxes_count=200, max_bars_back=500,max_labels_count=500)


srcUp=input.source(close, "Source for Price Buy Div", group="sources")
srcDn=input.source(close, "Source for Price Sell Div", group="sources")
srcRsi=input.source(close, "Source for RSI Div", group="sources")


HighRSILimit=input.int(70, "Min RSI for Sell divergence (p1:pre last)", group="signals", inline="1", step=1)
HighRSILimit2=input.int(68, "Min RSI for Sell divergence (p2):last", group="signals", inline="1", step=1)
LowRSILimit=input.int(22, "Min RSI for Buy divergence (p1:pre last)", group="signals", inline="2", step=1)
LowRSILimit2=input.int(25, "Min RSI for Buy divergence (p2:last)", group="signals", inline="2", step=1)


minMarginP=input.float(0, "Min margin between price for displaying divergence (%)", group="signals", step=0.01)
minMarginR=input.float(0, "Min margin between RSI for displaying divergence (%)", group="signals", step=1)

nb=input.int(2, "Sensivity: Determine how many candle will be used to determine last top or bot (too high cause lag, too low cause repaint)", group="Sensivity", inline="3", step=1)


stopPer= input.float(4.7, title='Stop %', group = "Per", inline="3", step=0.01)
tpPer = input.float(11.5, title='TP %', group = "Per", inline="4", step=0.01)

//nb=2
leftBars = nb
rightBars=nb


labels=input.bool(true, "Display Divergence labels", group="Display")
draw=input.bool(true, "Display tops/bottoms")



dnFractal = (close[nb-2] < close[nb]) and (close[nb-1] < close[nb]) and (close[nb+1] < close[nb]) and (close[nb+2] < close[nb])
upFractal = (close[nb-2] > close[nb]) and (close[nb-1] > close[nb]) and (close[nb+1] > close[nb]) and (close[nb+2] > close[nb])
ph=dnFractal
pl=upFractal

plot(dnFractal and draw ? close[nb] : na, style=plot.style_line,offset=-2, color=color.lime, title="tops")
plot(upFractal and draw ? close[nb] : na,  style=plot.style_line, offset=-2, color=color.red, title="botts")

plotchar(dnFractal ? high[nb] : na, char='⮝',location=location.absolute,offset=-2, color=color.rgb(236, 255, 63), title="Down Fractal")
plotchar(upFractal ? low[nb] : na, char='⮟', location=location.absolute, offset=-2, color=color.rgb(67, 227, 255), title="Up Fractal")


float myRSI=ta.rsi(srcRsi, 14)

bool divUp=false
bool divDn=false

//compare lasts bots
p2=ta.valuewhen( ph,srcDn[nb], 0 ) //last price
p1=ta.valuewhen( ph,srcDn[nb], 1 ) //pre last price

r2=ta.valuewhen( ph,myRSI[nb], 0 )  //last rsi
r1=ta.valuewhen( ph,myRSI[nb], 1 )  //pre last rsi


if ph
    if p1 < p2// - (p2 * minMarginP)/100
        if r1 > HighRSILimit and r2 > HighRSILimit2
            if r1 > r2 + (r2 * minMarginR)/100
                divDn:=true

plot(divDn ? close:na, style=plot.style_cross, linewidth=3, color= color.red, offset=-rightBars, title="Sell Div")
if labels and divDn and strategy.position_size >= 0
    label.new(bar_index-nb,high, "Sell Divergence "+str.tostring(p1)+"   "+str.tostring(math.round(r1, 2))+"  "+str.tostring(p2)+"   "+str.tostring(math.round(r2, 2)),xloc=xloc.bar_index,yloc=yloc.abovebar, color = color.red, style = label.style_label_down)
else if divDn and strategy.position_size >= 0
    label.new(bar_index-nb,high, "Sell Divergence",xloc=xloc.bar_index,yloc=yloc.abovebar, color = color.red, style = label.style_label_down)



p2:=ta.valuewhen( pl,srcUp[nb], 0 )
p1:=ta.valuewhen( pl,srcUp[nb], 1 )

r2:=ta.valuewhen( pl,myRSI[nb], 0 )
r1:=ta.valuewhen( pl,myRSI[nb], 1 )


if pl
    if p1 > p2 + (p2 * minMarginP)/100
        if r1 < LowRSILimit and r2 < LowRSILimit2
            if r1 < r2 - (r2 * minMarginR)/100
                divUp:=true
               
plot(divUp ? close:na, style=plot.style_cross, linewidth=3, color= color.green, offset=-rightBars, title="Buy Div")
if labels and divUp and strategy.position_size <= 0
    label.new(bar_index-nb,high, "Buy Divergence "+str.tostring(p1)+"   "+str.tostring(math.round(r1, 2))+"  "+str.tostring(p2)+"   "+str.tostring(math.round(r2, 2)),xloc=xloc.bar_index,yloc=yloc.belowbar, color = color.green, style = label.style_label_up)
else if divUp and strategy.position_size <= 0
    label.new(bar_index-nb,high, "Buy Divergence",xloc=xloc.bar_index,yloc=yloc.belowbar, color = color.green, style = label.style_label_up)


//strat LONG
longEntry = divUp//  and strategy.position_size == 0
longExit = divDn//  and strategy.position_size == 0

//strat SHORT
shortEntry = divDn
shortExit = divUp

LongActive=input(true, title='Activate Long', group = "Directions", inline="2")
ShortActive=input(true, title='Activate Short', group = "Directions", inline="2")
//StopActive=input(false, title='Activate Stop', group = "Directions", inline="2")


//tpActive =  input(false, title='Activate Take Profit', group = "TP", inline="4")
//RR=input(0.5, title='Risk Reward Multiplier', group = "TP")
//QuantityTP = input(100.0, title='Trade Ammount %', group = "TP")


//calc stop
//longStop = strategy.position_avg_price * (1 - stopPer)
//shortStop = strategy.position_avg_price * (1 + stopPer)

longStop = strategy.position_avg_price - (strategy.position_avg_price * stopPer/100)
shortStop = strategy.position_avg_price + (strategy.position_avg_price * stopPer/100)

longTP = strategy.position_avg_price + (strategy.position_avg_price * tpPer/100)
shortTP = strategy.position_avg_price - (strategy.position_avg_price * tpPer/100)

//Calc TP
//longTP = ((strategy.position_avg_price-longStop)*RR+strategy.position_avg_price)
//shortTP = (strategy.position_avg_price-((shortStop-strategy.position_avg_price)*RR))


//display stops
plot(strategy.position_size > 0 ? longStop : na, style=plot.style_linebr, color=color.red, linewidth=1, title="Long Fixed SL")
plot(strategy.position_size < 0 ? shortStop : na, style=plot.style_linebr, color=color.purple, linewidth=1, title="Short Fixed SL")


//display TP
plot(strategy.position_size > 0 ? longTP : na, style=plot.style_linebr, color=color.green, linewidth=1, title="Long Fixed TP")
plot(strategy.position_size < 0 ? shortTP : na, style=plot.style_linebr, color=color.green, linewidth=1, title="Short Fixed TP")

//do
if true
    //check money available
    if strategy.equity > 0
        //if tpActive //Need to put TP before Other exit
        strategy.exit("Close Long", from_entry="Long", limit=longTP,stop=longStop, comment="Close Long with : "+ str.tostring(math.round(strategy.equity)) +" $ ", qty_percent=100)
        strategy.exit("Close Short", from_entry="Short", limit=shortTP,stop=shortStop, comment="Close Short with : "+ str.tostring(math.round(strategy.equity)) +" $ ", qty_percent=100)
        //Set Stops
        //if StopActive
        //    strategy.exit("Stop Long", from_entry="Long", stop=longStop, comment="Stop Long with : "+ str.tostring(math.round(strategy.equity)) +" $ ")
        //    strategy.exit("Stop Short", from_entry="Short", stop=shortStop, comment="Stop Short with : "+ str.tostring(math.round(strategy.equity)) +" $ ")
        if longEntry
            if ShortActive
                strategy.close("Short",comment="Close Short with : "+ str.tostring(math.round(strategy.equity)) +" $ ")
                alert("Close Short")
            if LongActive
                strategy.entry("Long", strategy.long, comment="Open Long with : "+ str.tostring(math.round(strategy.equity)) +" $ ")
                alert("Open Long")
        if longExit
            if LongActive
                strategy.close("Long",comment="Close Long with : "+ str.tostring(math.round(strategy.equity)) +" $ ")
                alert("Close Long")
            if ShortActive
                strategy.entry("Short", strategy.short, comment="Open Short with : "+ str.tostring(math.round(strategy.equity)) +" $ ")
                alert("Open Short")


//alertcondition(longEntry and LongActive, title="Buy Divergence Open", message="Buy Divergence Long Opened!")
//alertcondition(longExit and ShortActive, title="Sell Divergence Open", message="Buy Divergence Short Opened!")

//alertcondition(longExit and LongActive, title="Buy Divergence Closed", message="Buy Divergence Long Closed!")
//alertcondition(longEntry and ShortActive, title="Sell Divergence Closed", message="Buy Divergence Short Closed!")