ডাবল মুভিং এভারেজ ক্রসওভার স্ট্র্যাটেজি সহ ইম্পটেম ট্রেডিং

লেখক:চাওঝাং, তারিখঃ 2024-04-01 11:53:14
ট্যাগঃ

img

সারসংক্ষেপ

এই কৌশলটি বাজারের প্রবণতার পরিবর্তনগুলি সনাক্ত করতে 8-অবধি এবং 21-অবধি এক্সপোনেনশিয়াল মুভিং এভারেজ (ইএমএ) ব্যবহার করে। যখন স্বল্পমেয়াদী ইএমএ নীচে থেকে দীর্ঘমেয়াদী ইএমএর উপরে অতিক্রম করে তখন একটি ক্রয় সংকেত উত্পন্ন হয়, যখন স্বল্পমেয়াদী ইএমএ উপরে থেকে দীর্ঘমেয়াদী ইএমএর নীচে অতিক্রম করে তখন একটি বিক্রয় সংকেত উত্পন্ন হয়। কৌশলটি ট্রেন্ড বিপরীতের আরও নিশ্চিতকরণের জন্য তিনটি ধারাবাহিক উচ্চ নিম্ন (এইচএল) এবং তিনটি ধারাবাহিক নিম্ন উচ্চ (এলএইচ) অন্তর্ভুক্ত করে। উপরন্তু, ঝুঁকি পরিচালনা এবং মুনাফায় লক করার জন্য স্টপ-লস এবং টেক-লাভ স্তরগুলি সেট করা হয়।

কৌশলগত নীতি

  1. প্রাথমিক প্রবণতার দিকনির্দেশনা নির্ধারণের জন্য ৮ পেরিওড এবং ২১ পেরিওড EMA গণনা করুন।
  2. সম্ভাব্য প্রবণতা বিপরীতের প্রাথমিক সংকেত হিসাবে তিনটি পরপর উচ্চতম নিম্নতম (HLs) এবং তিনটি পরপর নিম্নতম উচ্চতম (LHs) চিহ্নিত করুন।
  3. যখন ৮ পেরিওড EMA ২১ পেরিওড EMA এর উপরে ক্রস করে এবং HL breakout ঘটে তখন একটি ক্রয় সংকেত তৈরি করুন; যখন ৮ পেরিওড EMA ২১ পেরিওড EMA এর নীচে ক্রস করে এবং LH breakout ঘটে তখন একটি বিক্রয় সংকেত তৈরি করুন।
  4. ঝুঁকি পরিচালনা এবং মুনাফা লক করার জন্য স্টপ-লস স্তরটি প্রবেশ মূল্যের 5% এবং লাভ গ্রহণের স্তরটি প্রবেশ মূল্যের 16% এ সেট করুন।
  5. যখন বিপরীত সংকেত আসবে তখন অবস্থান বন্ধ করুন এবং বিপরীত অবস্থান খুলুন।

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

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

কৌশলগত ঝুঁকি

  1. অস্থির বাজারে, ঘন ঘন ক্রসওভার একাধিক মিথ্যা সংকেত হতে পারে, যার ফলে ক্ষতি হতে পারে।
  2. নির্দিষ্ট স্টপ লস এবং টেক প্রফিট স্তরগুলি বিভিন্ন বাজারের অবস্থার সাথে ভালভাবে মানিয়ে নিতে পারে না, যা সম্ভাব্য সুযোগ ব্যয় বা বৃহত্তর ক্ষতির দিকে পরিচালিত করে।
  3. কৌশলটি ঐতিহাসিক তথ্যের উপর ভিত্তি করে এবং হঠাৎ ঘটনা বা মৌলিক পরিবর্তনগুলির সাথে ভালভাবে মানিয়ে নিতে পারে না।

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

  1. বিভিন্ন বাজারের অবস্থার সাথে আরও ভালভাবে মানিয়ে নিতে স্টপ-লস এবং লাভ নেওয়ার অভিযোজিত প্রক্রিয়া প্রবর্তন করুন, যেমন অস্থিরতার ভিত্তিতে স্তরগুলি সামঞ্জস্য করা (যেমন, ATR) ।
  2. সংকেতগুলি আরও ফিল্টার করতে এবং নির্ভরযোগ্যতা উন্নত করতে ভলিউম, আপেক্ষিক শক্তি সূচক (আরএসআই) ইত্যাদি অন্যান্য সূচক বা কারণগুলি অন্তর্ভুক্ত করুন।
  3. নির্দিষ্ট বাজার বা যন্ত্রের জন্য সর্বোত্তম পারফরম্যান্সের সমন্বয় খুঁজে পেতে প্যারামিটারগুলি (যেমন, EMA সময়কাল, স্টপ-লস এবং লাভের শতাংশ) অনুকূল করুন।
  4. ব্যক্তিগত লেনদেনের ঝুঁকি নিয়ন্ত্রণের জন্য ঝুঁকি ব্যবস্থাপনা ব্যবস্থা যেমন পজিশনের আকার নির্ধারণের বিষয়টি বিবেচনা করা উচিত।

সংক্ষিপ্তসার

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


/*backtest
start: 2023-03-26 00:00:00
end: 2024-03-31 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy('Trend Following 8&21EMA with strategy tester [ukiuro7]', overlay=true, process_orders_on_close=true, calc_on_every_tick=true, initial_capital = 10000)

//INPUTS
lh3On = true
hl3On = true
emaOn = input(title='105ema / 30min', defval=true) 
assistantOn = input(title='Assistant', defval=true)
textOn = input(title='Text', defval=true)

showRiskReward = input.bool(true, title='Show Risk/Reward Area', group="TP/SL")
stopPerc = input.float(5.0, step=0.1, minval=0.1, title='Stop-Loss %:',group="TP/SL") / 100
tpPerc = input.float(16.0, step=0.1, minval=0.1, title='Take-Profit %:',group="TP/SL") / 100

backtestFilter = input(false, title='Backtest Entries to Date Range',group="Backtest Date Range")
i_startTime = input(defval=timestamp('01 Jan 2022 00:00'), inline="b_1", title='Start',group="Backtest Date Range")
i_endTime = input(defval=timestamp('01 Jan 2029 00:00'), inline="b_1", title='End',group="Backtest Date Range")
inDateRange = true

message_long_entry = input.string(title='Alert Msg: LONG Entry', defval ='', group='Alert Message')
message_short_entry = input.string(title='Alert Msg: SHORT Entry', defval='', group='Alert Message')
message_long_exit = input.string(title='Alert Msg: LONG SL/TP', defval='', group='Alert Message')
message_short_exit = input.string(title='Alert Msg: SHORT SL/TP', defval='', group='Alert Message')  

//CALCS
threeHigherLows() =>
    low[0] >= low[1] and low[1] >= low[2]

threeLowerHighs() =>
    high[2] >= high[1] and high[1] >= high[0]

breakHigher() =>
    padding = timeframe.isintraday ? .02 : .1
    high >= high[1] + padding

breakLower() =>
    padding = timeframe.isintraday ? .02 : .1
    low <= low[1] - padding

lh3 = threeLowerHighs() and lh3On
lh3bh = lh3[1] and breakHigher() and lh3On

hl3 = threeHigherLows() and hl3On
hl3bl = hl3[1] and breakLower() and hl3On

ema8 = ta.ema(close, 8)
ema21 = ta.ema(close, 21)

//VARS
var float longStop = na, var float longTp = na
var float shortStop = na, var float shortTp = na

//CONDS
isUptrend = ema8 >= ema21
isDowntrend = ema8 <= ema21
trendChanging = ta.cross(ema8, ema21)

buySignal = lh3bh and lh3[2] and lh3[3] and isUptrend and timeframe.isintraday
sellSignal = hl3bl and hl3[2] and hl3[3] and isDowntrend and timeframe.isintraday

goingDown = hl3 and isDowntrend and timeframe.isintraday
goingUp = lh3 and isUptrend and timeframe.isintraday

projectXBuy = trendChanging and isUptrend
projectXSell = trendChanging and isDowntrend

longCond = trendChanging and isUptrend and assistantOn
shortCond = trendChanging and isDowntrend and assistantOn

//STRATEGY
if shortCond and strategy.position_size > 0 and barstate.isconfirmed
    strategy.close('Long', comment='CLOSE LONG', alert_message=message_long_exit)

if longCond and strategy.position_size < 0 and barstate.isconfirmed
    strategy.close('Short', comment='CLOSE SHORT', alert_message=message_short_exit) 

if longCond and strategy.position_size <= 0 and barstate.isconfirmed and inDateRange
    longStop := close * (1 - stopPerc)
    longTp := close * (1 + tpPerc)
    strategy.entry('Long', strategy.long, comment='LONG', alert_message=message_long_entry)
    strategy.exit('Long Exit', 'Long', comment_loss="SL LONG", comment_profit = "TP LONG", stop=longStop, limit=longTp, alert_message=message_long_exit)

if shortCond and strategy.position_size >= 0 and barstate.isconfirmed and inDateRange
    shortStop := close * (1 + stopPerc)
    shortTp := close * (1 - tpPerc)
    strategy.entry('Short', strategy.short, comment='SHORT', alert_message=message_short_entry)
    strategy.exit('Short Exit', 'Short', comment_loss="SL SHORT", comment_profit="TP SHORT", stop=shortStop, limit=shortTp, alert_message=message_short_exit)

//PLOTS
plotshape(longCond, style=shape.triangleup, location=location.belowbar, color=color.new(color.green, 0), size=size.small, text='Buy')
plotshape(shortCond, style=shape.triangledown, location=location.abovebar, color=color.new(color.red, 0), size=size.small, text='Sell')
plotchar(trendChanging and isUptrend and close < open and assistantOn, char='!', location=location.abovebar, color=color.new(color.green, 0), size=size.small)

aa = plot(ema8, linewidth=3, color=color.new(color.green, 0), editable=true)
bb = plot(ema21, linewidth=3, color=color.new(color.red, 0), editable=true)
fill(aa, bb, color=isUptrend ? color.new(color.green,90) : color.new(color.red,90))
buyZone = isUptrend and lh3 and high < ema21 and timeframe.isintraday
sellZone = isDowntrend and hl3 and low > ema21 and timeframe.isintraday

L1 = plot(showRiskReward and strategy.position_size > 0 ? strategy.position_avg_price : na, color=color.new(color.green, 0), linewidth=1, style=plot.style_linebr, title='Long Entry Price')
L2 = plot(showRiskReward and strategy.position_size > 0 ? longTp : na, color=color.new(color.green, 0), linewidth=1, style=plot.style_linebr, title='Long TP Price')
L3 = plot(showRiskReward and strategy.position_size > 0 ? longStop : na, color=color.new(color.red, 0), linewidth=1, style=plot.style_linebr, title='Long Stop Price')

S1 = plot(showRiskReward and strategy.position_size < 0 ? strategy.position_avg_price : na, color=color.new(color.teal, 0), linewidth=1, style=plot.style_linebr, title='Short Entry Price')
S2 = plot(showRiskReward and strategy.position_size < 0 ? shortTp : na, color=color.new(color.teal, 0), linewidth=1, style=plot.style_linebr, title='Short TP Price')
S3 = plot(showRiskReward and strategy.position_size < 0 ? shortStop : na, color=color.new(color.maroon, 0), linewidth=1, style=plot.style_linebr, title='Short Stop Price')

fill(L1, L2, color=color.new(color.green, 90))
fill(L1, L3, color=color.new(color.red, 90))
fill(S1, S2, color=color.new(color.teal, 90))
fill(S1, S3, color=color.new(color.maroon, 90))

bgcolor(inDateRange == false ? color.new(color.red,90) : na, title="Backtest Off-Range") 


আরো