ڈائنامک پوزیشن ٹریلنگ اسٹاپ نقصان SMA کراس اوور ریٹیسمنٹ حکمت عملی

SMA MA RRR TP SL
تخلیق کی تاریخ: 2025-02-21 13:51:50 آخر میں ترمیم کریں: 2025-02-21 13:51:50
کاپی: 0 کلکس کی تعداد: 338
2
پر توجہ دیں
319
پیروکار

ڈائنامک پوزیشن ٹریلنگ اسٹاپ نقصان SMA کراس اوور ریٹیسمنٹ حکمت عملی ڈائنامک پوزیشن ٹریلنگ اسٹاپ نقصان SMA کراس اوور ریٹیسمنٹ حکمت عملی

جائزہ

یہ حکمت عملی ایک خودکار تجارتی نظام ہے جو مساوی لائن کراسنگ اور متحرک پوزیشن مینجمنٹ پر مبنی ہے۔ اس میں 50 دن اور 200 دن کی سادہ حرکت پذیر اوسط ((SMA) کو بطور اہم اشارے استعمال کیا جاتا ہے ، متحرک پوزیشن ایڈجسٹمنٹ اور ٹریکنگ اسٹاپ نقصان کے میکانزم کے ساتھ مل کر ، مارکیٹ کے رجحانات میں تجارت کے مواقع کی تلاش کی جاتی ہے۔ حکمت عملی کا مرکز قیمتوں اور مساوی لائنوں کے مابین تعلقات کے ذریعہ مارکیٹ کی سمت کا فیصلہ کرنا ہے ، جبکہ فنڈ مینجمنٹ اور رسک کنٹرول کا استعمال کرتے ہوئے تجارت کی استحکام کو یقینی بنانا ہے۔

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

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

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

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

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

اسٹریٹجک رسک

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

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

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

خلاصہ کریں۔

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

حکمت عملی کا ماخذ کوڈ
/*backtest
start: 2024-02-22 00:00:00
end: 2025-02-19 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/

//@version=5
strategy("15m - Rebound 50SMA with Dynamic Lots & Trailing Stop, RRR 2:1, Date Filter (Closed Bars Only)", 
     overlay=true, 
     initial_capital=50000, 
     default_qty_type=strategy.fixed, 
     default_qty_value=1, 
     pyramiding=0, 
     calc_on_order_fills=true)

// ===== INPUTS =====
sma50Period  = input.int(50, "50 SMA Period", minval=1)
sma200Period = input.int(200, "200 SMA Period", minval=1)

// ===== CALCULATE SMAs =====
sma50  = ta.sma(close, sma50Period)
sma200 = ta.sma(close, sma200Period)

// ===== PLOT SMAs =====
plot(sma50, color=color.red, title="50 SMA")
plot(sma200, color=color.blue, title="200 SMA")

// ===== DEFINE TRADING SESSIONS =====
// Trading is allowed 15 minutes after market open:
//   - New York: 09:45–16:00 (America/New_York)
//   - London:   08:15–16:00 (Europe/London)
nySession     = not na(time("15", "0945-1600", "America/New_York"))
londonSession = not na(time("15", "0815-1600", "Europe/London"))
inSession     = nySession or londonSession

// ===== DEFINE DATE RANGE =====
// Only allow orders on or after January 1, 2024.
// (We include seconds in the timestamp for proper parsing.)
startDate   = timestamp("UTC", 2024, 1, 1, 0, 0, 0)
inDateRange = time >= startDate

// ===== DEFINE ENTRY CONDITIONS =====
// ----- LONG ENTRY CONDITION -----
// A long entry is triggered when:
//   - The previous candle closed below the 50 SMA and the current candle closes above it,
//   - And the 50 SMA is above the 200 SMA.
longCondition = (close[1] < sma50[1]) and (close > sma50) and (sma50 > sma200)

// ----- SHORT ENTRY CONDITION -----
// A short entry is triggered when:
//   - The previous candle closed above the 50 SMA and the current candle closes below it,
//   - And the 50 SMA is below the 200 SMA.
shortCondition = (close[1] > sma50[1]) and (close < sma50) and (sma50 < sma200)

// ===== DEBUG PLOTS =====
plotshape(longCondition and barstate.isconfirmed, title="Long Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.tiny)
plotshape(shortCondition and barstate.isconfirmed, title="Short Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.tiny)

// ===== VARIABLES FOR STOP LOSS MANAGEMENT =====
// For long positions.
var float initialLongStop = na   // Set at entry: low of the rebound candle.
var float trailStopLong   = na   // Updated trailing stop for long.
// For short positions.
var float initialShortStop = na  // Set at entry: high of the rebound candle.
var float trailStopShort   = na  // Updated trailing stop for short.

// ===== DYNAMIC LOT SIZE =====
// If current profit (strategy.equity - 50000) exceeds 4000, lot size becomes 3; otherwise, 2.
lotSize = (strategy.equity - 50000 > 4000) ? 3 : 2

// ===== ENTRY LOGIC (EXECUTED ON CONFIRMED BARS) =====
if barstate.isconfirmed and inSession and inDateRange and longCondition and strategy.position_size <= 0
    initialLongStop := low
    trailStopLong   := initialLongStop
    if strategy.position_size < 0
        strategy.close("Short", comment="Close Short before Long")
    // Submit a market order entry (no offset).
    strategy.entry("Long", strategy.long, qty=lotSize, comment="Enter Long")
    
if barstate.isconfirmed and inSession and inDateRange and shortCondition and strategy.position_size >= 0
    initialShortStop := high
    trailStopShort   := initialShortStop
    if strategy.position_size > 0
        strategy.close("Long", comment="Close Long before Short")
    // Submit a market order entry (no offset).
    strategy.entry("Short", strategy.short, qty=lotSize, comment="Enter Short")
    
// ===== TRAILING STOP LOGIC & EXIT ORDERS (ON CLOSED BARS) =====

if barstate.isconfirmed and strategy.position_size > 0
    // For Long Positions:
    floatingProfitLong = (close - strategy.position_avg_price) / syminfo.mintick
    newTrailLong = trailStopLong  // Default: no change.
    if floatingProfitLong >= 20 and floatingProfitLong < 30
        newTrailLong := initialLongStop + 5 * syminfo.mintick
    else if floatingProfitLong >= 31 and floatingProfitLong < 40
        newTrailLong := initialLongStop + 10 * syminfo.mintick
    else if floatingProfitLong >= 41 and floatingProfitLong < 50
        newTrailLong := initialLongStop + 15 * syminfo.mintick
    // Update trailing stop only if the new value is more favorable.
    trailStopLong := math.max(trailStopLong, newTrailLong)
    
    longRisk = strategy.position_avg_price - trailStopLong
    tpLong   = strategy.position_avg_price + 2.5 * longRisk
    strategy.exit("Exit Long", from_entry="Long", stop=trailStopLong, limit=tpLong)

if barstate.isconfirmed and strategy.position_size < 0
    // For Short Positions:
    floatingProfitShort = (strategy.position_avg_price - close) / syminfo.mintick
    newTrailShort = trailStopShort  // Default: no change.
    if floatingProfitShort >= 20 and floatingProfitShort < 30
        newTrailShort := initialShortStop - 5 * syminfo.mintick
    else if floatingProfitShort >= 31 and floatingProfitShort < 40
        newTrailShort := initialShortStop - 10 * syminfo.mintick
    else if floatingProfitShort >= 41 and floatingProfitShort < 50
        newTrailShort := initialShortStop - 15 * syminfo.mintick
    // Update trailing stop only if the new value is more favorable.
    trailStopShort := math.min(trailStopShort, newTrailShort)
    
    shortRisk = trailStopShort - strategy.position_avg_price
    tpShort = strategy.position_avg_price - 2.5 * shortRisk
    strategy.exit("Exit Short", from_entry="Short", stop=trailStopShort, limit=tpShort)