গতিশীল পজিশন ট্রেইলিং স্টপ লস 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 দিনের সরল চলমান গড় ((এসএমএ) ব্যবহার করে, গতিশীল অবস্থানের সমন্বয় এবং স্টপ লস ট্র্যাকিংয়ের সাথে মিলিত, বাজারের প্রবণতাগুলির মধ্যে ব্যবসায়ের সুযোগের সন্ধান করে। কৌশলটির কেন্দ্রবিন্দু হল মূল্য এবং সমান্তরালের সম্পর্কের মাধ্যমে বাজারের দিকনির্দেশনা নির্ধারণ করা, তহবিল পরিচালনা এবং ঝুঁকি নিয়ন্ত্রণ ব্যবহার করে লেনদেনের স্থিতিশীলতা নিশ্চিত করা।

কৌশল নীতি

এই কৌশলটি নিম্নলিখিত মূলনীতির উপর ভিত্তি করে কাজ করেঃ

  1. এন্ট্রি সংকেত 50 দিনের গড় লাইন এবং 200 দিনের গড় লাইন এর তুলনামূলক অবস্থানের উপর ভিত্তি করে 50 দিনের গড় লাইন এবং 50 দিনের গড় লাইন এর ক্রস উপর ভিত্তি করে একটি বড় প্রবণতা নির্ধারণ করে
  2. যখন দাম গড়ের নীচে থেকে বেরিয়ে আসে, তখন একটি মাল্টি সিগন্যাল ট্রিগার করা হয়; বিপরীতভাবে, একটি ফাঁকা সিগন্যাল ট্রিগার করা হয়
  3. পজিশন ম্যানেজমেন্ট একটি গতিশীল সমন্বয় ব্যবস্থা গ্রহণ করে, যখন অ্যাকাউন্টের মুনাফা 4000 ছাড়িয়ে যায় তখন পজিশন হোল্ডিংয়ের সংখ্যা বৃদ্ধি পায়
  4. স্টপ লস ট্র্যাকিং স্টপ মেকানিজম ব্যবহার করে, মুনাফা বাড়ার সাথে সাথে স্টপ লস পজিশনের গতিশীল সমন্বয়
  5. রিস্ক-রিটার্ন অনুপাত ১ঃ২.৫ সেট করা হয়েছে, যা নিশ্চিত করে যে প্রতিটি লেনদেনের প্রত্যাশিত রিটার্ন ঝুঁকির চেয়ে বেশি

কৌশলগত সুবিধা

  1. প্রযুক্তিগত সূচক এবং মূল্যের আচরণের সাথে যুক্ত ট্রেডিং লজিকের স্পষ্টতা এবং প্রবেশের সময় নির্ধারণ
  2. ডায়নামিক পজিশন ম্যানেজমেন্ট ব্যবহার করে, ট্রেডিং স্কেল বাড়ানো এবং তহবিলের ব্যবহারের দক্ষতা বাড়ানো যখন এটি লাভজনক হয়
  3. ট্র্যাকিং স্টপ লস কার্যকরভাবে মুনাফা লক করে এবং ব্যাপক প্রত্যাহার এড়ায়
  4. ট্রেডিং টাইম ফিল্টার সেট করা হয়েছে, শুধুমাত্র মূল ট্রেডিং সময় চলমান, কম তরলতা সময়ের ঝুঁকি এড়াতে
  5. ভাল ঝুঁকি নিয়ন্ত্রণ ব্যবস্থা, যার মধ্যে রয়েছে স্টপ লস, রিটার্ন টার্গেট এবং পজিশন ম্যানেজমেন্ট

কৌশলগত ঝুঁকি

  1. ক্রমাগত স্টপ লস হতে পারে, যা অস্থির বাজারে মিথ্যা ব্রেকিং সিগন্যালগুলি ঘন ঘন ট্রিগার করতে পারে
  2. বাজার হঠাৎ পাল্টে গেলে ডায়নামিক পজিশন ম্যানেজমেন্টের ফলে বড় ক্ষতি হতে পারে
  3. সমান্তরাল সিস্টেমের উপর নির্ভরশীলতা দ্রুত অস্থির বাজারে প্রতিক্রিয়াশীল হতে পারে
  4. স্থির ঝুঁকি-লাভের অনুপাত কিছু সম্ভাব্য বড় ট্রেন্ডের সুযোগ হারাতে পারে
  5. ট্রেডিংয়ের সময়সীমার কারণে গুরুত্বপূর্ণ কিছু বাজার সুযোগ হাতছাড়া হতে পারে

কৌশল অপ্টিমাইজেশনের দিকনির্দেশনা

  1. বিভিন্ন বাজার পরিস্থিতিতে গতিশীল সমন্বয় পরামিতি সহ অস্থিরতা সূচকগুলি প্রবর্তন করা যেতে পারে
  2. মার্কেট সেন্টিমেন্ট ইনডিকেটর যুক্ত করার কথা ভাবুন, যাতে এন্ট্রি সিগন্যালের নির্ভুলতা বাড়তে পারে
  3. স্টপ লস প্যারামিটারগুলিকে অনুকূলিতকরণ করুন যাতে এটি বিভিন্ন বাজারের অবস্থার সাথে আরও ভালভাবে মানিয়ে নিতে পারে
  4. মাল্টি টাইম সাইকেল বিশ্লেষণ এবং ট্রেডিং সিস্টেমের স্থিতিশীলতা বৃদ্ধি
  5. ট্র্যাফিক বিশ্লেষণের মাধ্যমে সিগন্যালের নির্ভরযোগ্যতা বাড়ানো

সারসংক্ষেপ

এই কৌশলটি সমান্তরাল সিস্টেম, গতিশীল পজিশন ম্যানেজমেন্ট এবং ট্র্যাকিং স্টপ লস মেশিনের সাথে একত্রিত করে একটি অপেক্ষাকৃত সম্পূর্ণ ট্রেডিং সিস্টেম তৈরি করে। কৌশলটির সুবিধা হ’ল সুস্পষ্ট ট্রেডিং লজিক এবং একটি উন্নত ঝুঁকি নিয়ন্ত্রণ ব্যবস্থা রয়েছে, তবে এমন কিছু জায়গা রয়েছে যেখানে অপ্টিমাইজেশনের প্রয়োজন রয়েছে। ক্রমাগত উন্নতি এবং অপ্টিমাইজেশনের মাধ্যমে কৌশলটি বাস্তব ব্যবসায়ের ক্ষেত্রে আরও ভাল পারফরম্যান্সের প্রত্যাশা করে।

কৌশল সোর্স কোড
/*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)