
یہ حکمت عملی ایک خودکار تجارتی حکمت عملی ہے جس میں رجحانات کی شناخت کے لئے آر ایس آئی اشارے کا استعمال کیا جاتا ہے اور اس کے ساتھ ساتھ ایک حرکت پذیر اوسط کے ساتھ رجحانات کی تصدیق کی جاتی ہے۔ جب آر ایس آئی 68 سے زیادہ ہو اور موجودہ حرکت پذیر اوسط سے تجاوز کرنے سے پہلے حرکت پذیر اوسط سے تجاوز کرے تو ، زیادہ کام کریں۔ جب آر ایس آئی 28 سے کم ہو اور موجودہ حرکت پذیر اوسط سے تجاوز کرنے سے پہلے حرکت پذیر اوسط سے تجاوز کرے تو ، خالی ہو۔
یہ حکمت عملی بنیادی طور پر آر ایس آئی کے اشارے کا استعمال کرتی ہے تاکہ اوور بیئر اور اوور سیل رجحانات کی نشاندہی کی جاسکے۔ جب آر ایس آئی 70 سے زیادہ ہو تو یہ اوور خرید زون ہے ، اور 30 سے کم ہونے پر یہ اوور سیل زون ہے۔ حرکت پذیر اوسط کے ساتھ مل کر سنہری کراس اور موت کے کراس کے ساتھ رجحانات کی تصدیق کریں۔ مخصوص تجارتی سگنل یہ ہیں:
ملٹی ہیڈ سگنل: آر ایس آئی 68 سے زیادہ ہے اور اس سے پہلے کہ وہ موجودہ اوسط اوسط سے تجاوز کرے ، اس سے زیادہ کریں۔ خالی سر سگنل: آر ایس آئی 28 سے کم ہے اور موجودہ اوسط اوسط سے نیچے ٹوٹنے سے پہلے اوسط اوسط سے نیچے ٹوٹ جاتا ہے۔
سٹاپ نقصان بندش کی ترتیب ہر نقطہ کے لئے مختلف سٹاپ نقصان بندش تناسب، زیادہ نرمی سے زیادہ سخت، خاص طور پر:
ملٹی ہیڈ اسٹاپ: اعلی مقام پر 1.4٪ اسٹاپ آدھی پوزیشن ، اعلی مقام پر 0.8٪ اسٹاپ پوری پوزیشن کو صاف کریں۔ کثیر اسٹاپ نقصان: داخلہ قیمت کا 2٪ سیٹ اسٹاپ نقصان۔
خالی سر اسٹاپ: کم سے کم 0.4٪ اسٹاپ آدھی پوزیشن ، کم سے کم 0.8٪ اسٹاپ پوری پوزیشن صاف کریں۔
خالی سر اسٹاپ: داخلہ قیمت کا 2٪ سیٹ اسٹاپ۔
اسی وقت جب رجحان الٹ جاتا ہے ، مثال کے طور پر جب RSI 30 سے زیادہ ہو تو مارکیٹ کی قیمت مکمل طور پر برابر ہوجاتی ہے۔ جب RSI 60 سے زیادہ ہو تو مارکیٹ کی قیمت مکمل طور پر برابر ہوجاتی ہے۔
مذکورہ بالا خطرات کے ل the ، پیرامیٹرز کو متعدد بار جانچنے کی ضرورت ہے۔ سٹاپ نقصان کی روک تھام کی ترتیب مناسب ، ایک خاص حد تک نرمی ، اور پیرامیٹرز کو مارکیٹ میں اتار چڑھاؤ کے مطابق ایڈجسٹ کریں۔ صفائی کی حکمت عملی کو محتاط رہنا چاہئے ، تاکہ اشارے کے غلط فیصلے سے نقصان سے بچ سکے۔
اس کے علاوہ، یہ مندرجہ ذیل پہلوؤں میں مزید بہتر بنایا جا سکتا ہے:
یہ حکمت عملی مجموعی طور پر ایک زیادہ پختہ اور قابل اعتماد رجحان کی پیروی کرنے والی حکمت عملی ہے۔ RSI کا استعمال کرتے ہوئے اوور بیئر اوور سیل کے رجحان کو طے کرنے کے لئے تجارت کی سمت کا تعین کریں۔ حرکت پذیر اوسط کا استعمال کرتے ہوئے ہلچل کی تصدیق کریں۔ جبکہ مناسب اسٹاپ نقصان اور بڑھتے ہوئے اسٹاپس کا تعین کریں۔ رجحان میں بہتر منافع حاصل کرنے کے قابل ہو۔ اگر پیرامیٹرز کو بہتر بنایا جائے تو ، رجحان کی صورتحال میں بہترین کارکردگی کا مظاہرہ کریں۔ مزید اصلاح کے بعد بہتر کارکردگی کا مظاہرہ کیا جاسکتا ہے۔
// © CRabbit
//@version=5
// Starting with $100 and using 10% of the account per trade
strategy("RSI Template", shorttitle="RSI", overlay=false, initial_capital=100, default_qty_value=10, default_qty_type=strategy.percent_of_equity)
// RSI Indicator
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"Bollinger Bands" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
rsiLengthInput = input.int(4, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="MA Settings")
maLengthInput = input.int(23, title="MA Length", group="MA Settings")
bbMultInput = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings")
up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput)
down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiMA = ma(rsi, maLengthInput, maTypeInput)
isBB = maTypeInput == "Bollinger Bands"
plot(rsi, "RSI", color=#7E57C2)
plot(rsiMA, "RSI-based MA", color=color.green)
rsiUpperBand = hline(70, "RSI Upper Band", color=#787B86)
hline(50, "RSI Middle Band", color=color.new(#787B86, 50))
rsiLowerBand = hline(30, "RSI Lower Band", color=#787B86)
fill(rsiUpperBand, rsiLowerBand, color=color.rgb(126, 87, 194, 90), title="RSI Background Fill")
// Configure backtest start date with inputs
startDate = input.int(title="Start Date", defval=1, minval=1, maxval=31)
startMonth = input.int(title="Start Month", defval=6, minval=1, maxval=12)
startYear = input.int(title="Start Year", defval=2022, minval=1800, maxval=2100)
// See if this bar's time happened on/after start date
afterStartDate = (time >= timestamp(syminfo.timezone,
startYear, startMonth, startDate, 0, 0))
// Long and Short buy strategy
// Submit a market open/ close Long order, but only on/after start date
if (afterStartDate)
if rsi > 68 and (rsiMA > rsiMA[1])
strategy.entry("Long Order", strategy.long, comment="ENTER-LONG")
if rsi < 30
strategy.close("Long Order", alert_message="L-CL")
strategy.exit("L-TP1", from_entry="Long Order", limit=high * 1.004, qty_percent=50, alert_message="L-TP1" + str.tostring(high * 1.004))
strategy.exit("L-TP2", from_entry="Long Order", limit=high * 1.008, qty_percent=100, alert_message="L-TP2" + str.tostring(high * 1.008))
strategy.exit("Exit Long", from_entry="Long Order", stop=low * 0.98, alert_message="L-SL" + str.tostring(low * 0.98))
// Submit a market Open/ Close Short order, but only on/after start date
if (afterStartDate)
if rsi < 28 and (rsiMA < rsiMA[1])
strategy.entry("Short Order", strategy.short, comment="ENTER-SHORT")
if rsi > 60
strategy.close("Short Order", alert_message="S-CL")
strategy.exit("S-TP1", from_entry="Short Order", limit=low * 0.996, qty_percent=50, alert_message="S-TP1" + str.tostring(low * 0.996))
strategy.exit("S-TP2", from_entry="Short Order", limit=low * 0.992, qty_percent=100, alert_message="S-TP2" + str.tostring(low * 0.992))
strategy.exit("Exit Short", from_entry="Short Order", stop=high * 1.02, alert_message="S-SL" + str.tostring(high * 1.02))
// MONTHLY TABLE //
prec = input(2, title = "Return Precision")
new_month = month(time) != month(time[1])
new_year = year(time) != year(time[1])
eq = strategy.equity
bar_pnl = eq / eq[1] - 1
cur_month_pnl = 0.0
cur_year_pnl = 0.0
// Current Monthly P&L
cur_month_pnl := new_month ? 0.0 :
(1 + cur_month_pnl[1]) * (1 + bar_pnl) - 1
// Current Yearly P&L
cur_year_pnl := new_year ? 0.0 :
(1 + cur_year_pnl[1]) * (1 + bar_pnl) - 1
// Arrays to store Yearly and Monthly P&Ls
var month_pnl = array.new_float(0)
var month_time = array.new_int(0)
var year_pnl = array.new_float(0)
var year_time = array.new_int(0)
if (not na(cur_month_pnl[1]) and (new_month or barstate.islast))
array.push(month_pnl , cur_month_pnl[1])
array.push(month_time, time[1])
if (not na(cur_year_pnl[1]) and (new_year or barstate.islast))
array.push(year_pnl , cur_year_pnl[1])
array.push(year_time, time[1])
// Monthly P&L Table
var monthly_table = table(na)
if (barstate.islast)
monthly_table := table.new(position.bottom_right, columns = 14, rows = array.size(year_pnl) + 1, border_width = 1)
table.cell(monthly_table, 0, 0, "", bgcolor = #cccccc)
table.cell(monthly_table, 1, 0, "Jan", bgcolor = #cccccc)
table.cell(monthly_table, 2, 0, "Feb", bgcolor = #cccccc)
table.cell(monthly_table, 3, 0, "Mar", bgcolor = #cccccc)
table.cell(monthly_table, 4, 0, "Apr", bgcolor = #cccccc)
table.cell(monthly_table, 5, 0, "May", bgcolor = #cccccc)
table.cell(monthly_table, 6, 0, "Jun", bgcolor = #cccccc)
table.cell(monthly_table, 7, 0, "Jul", bgcolor = #cccccc)
table.cell(monthly_table, 8, 0, "Aug", bgcolor = #cccccc)
table.cell(monthly_table, 9, 0, "Sep", bgcolor = #cccccc)
table.cell(monthly_table, 10, 0, "Oct", bgcolor = #cccccc)
table.cell(monthly_table, 11, 0, "Nov", bgcolor = #cccccc)
table.cell(monthly_table, 12, 0, "Dec", bgcolor = #cccccc)
table.cell(monthly_table, 13, 0, "Year", bgcolor = #999999)
for yi = 0 to array.size(year_pnl) - 1
table.cell(monthly_table, 0, yi + 1, str.tostring(year(array.get(year_time, yi))), bgcolor = #cccccc)
y_color = array.get(year_pnl, yi) > 0 ? color.new(color.green, transp = 50) : color.new(color.red, transp = 50)
table.cell(monthly_table, 13, yi + 1, str.tostring(math.round(array.get(year_pnl, yi) * 100, prec)), bgcolor = y_color)
for mi = 0 to array.size(month_time) - 1
m_row = year(array.get(month_time, mi)) - year(array.get(year_time, 0)) + 1
m_col = month(array.get(month_time, mi))
m_color = array.get(month_pnl, mi) > 0 ? color.new(color.green, transp = 70) : color.new(color.red, transp = 70)
table.cell(monthly_table, m_col, m_row, str.tostring(math.round(array.get(month_pnl, mi) * 100, prec)), bgcolor = m_color)