দ্বৈত সূচক হাইব্রিড পরিমাণগত ট্রেডিং কৌশল


সৃষ্টির তারিখ: 2023-12-20 10:31:06 অবশেষে সংশোধন করুন: 2023-12-20 10:31:06
অনুলিপি: 0 ক্লিকের সংখ্যা: 611
1
ফোকাস
1621
অনুসারী

দ্বৈত সূচক হাইব্রিড পরিমাণগত ট্রেডিং কৌশল

ওভারভিউ

এই কৌশলটি প্রবণতার দিক চিহ্নিত করে এবং ডাবল সূচকগুলির সংমিশ্রণ দ্বারা ট্রেড করে। প্রথমত, এটি স্বল্পমেয়াদী প্রবণতা বিচার করতে দুটি চলমান গড়ের ক্রস ব্যবহার করে (দ্রুত লাইন এবং মাঝারি লাইন); দ্বিতীয়ত, এটি প্রধান প্রবণতার দিক বিচার করতে চ্যানেলের ব্যাপ্তি এবং দীর্ঘমেয়াদী চলমান গড় ব্যবহার করে। কেবলমাত্র যখন দুটি বিচার ফলাফল একমত হয় তখনই একটি ট্রেডিং সংকেত উত্পন্ন হয়। এই কৌশলটি একাধিক সূচক ব্যবহার করে, যা কার্যকরভাবে মিথ্যা সংকেতগুলি ফিল্টার করে এবং স্থিতিশীলতা বাড়ায়।

কৌশল নীতি

এই কৌশলটি তিনটি সূচক ব্যবহার করে বিচার করে। প্রথমত, স্বল্পমেয়াদী প্রবণতা নির্ধারণের জন্য দ্রুত লাইন EMA (২৬ চক্র) এবং মাঝারি লাইন EMA (৫০ চক্র) এর গোল্ডেন ফোর্ক; দ্বিতীয়ত, মধ্যমেয়াদী প্রবণতা নির্ধারণের জন্য চ্যানেলের পরিধি গণনা করে, দামটি এই পরিসীমাটি অতিক্রম করেছে কিনা তা নির্ধারণের জন্য; এবং অবশেষে, দীর্ঘমেয়াদী গড় লাইন SMA (২০০ চক্র) গণনা করে, মূল প্রবণতা দিকটি নির্ধারণের জন্য দামের সাথে তুলনা করে। কেবলমাত্র যখন তিনটি বিচার ফলাফল একমত হয় তখনই একটি ট্রেডিং সংকেত দেওয়া হয়।

এই ক্ষেত্রে, বিচার করার যৌক্তিকতা হলঃ

  1. দ্রুত এবং মাঝারি গতির লাইনের ক্রস (উচ্চ এবং নিম্ন) স্বল্পমেয়াদী প্রবণতা নির্দেশ করে।

  2. মধ্যমেয়াদী ট্রেন্ডের দিকনির্দেশনা নির্ধারণের জন্য চ্যানেলের সীমা অতিক্রম করা হয়েছে কিনা তা নির্ধারণ করুন। দীর্ঘমেয়াদী গড় রেখার উপর ভিত্তি করে চ্যানেলের সীমাটি ATR হ্রাস করে একটি ফ্যাক্টর দ্বারা গুণিত হয়। যদি দামটি উপরের সীমাটি অতিক্রম করে তবে এটি একটি মুদ্রাস্ফীতি; যদি এটি নীচের সীমাটি অতিক্রম করে তবে এটি একটি পতন।

  3. মূল প্রবণতার দিকনির্দেশনা নির্ধারণের জন্য মূল্য এবং দীর্ঘমেয়াদী গড়ের আকারের তুলনা করুন।

শেষ অবধি, কেবলমাত্র সংক্ষিপ্ত, মাঝারি এবং দীর্ঘ তিনটি সিদ্ধান্তের ফলাফল একমত হলেই একটি লেনদেনের সংকেত দেওয়া হবে। এই মিশ্রিত সিদ্ধান্তটি কার্যকরভাবে মিথ্যা সংকেতগুলি ফিল্টার করতে এবং স্থিতিশীলতা বাড়িয়ে তুলতে পারে।

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

এই ডাবল-মিটার মিশ্রণ কৌশলটির বেশ কিছু সুবিধা রয়েছেঃ

  1. এটি কার্যকরভাবে মিথ্যা সংকেতগুলি ফিল্টার করতে পারে এবং স্থিতিশীলতা বাড়িয়ে তুলতে পারে। কারণ ট্রেডিং সিগন্যালের জন্য সংক্ষিপ্ত, মাঝারি এবং দীর্ঘ একাধিক সূচকের ফলাফলের যাচাইয়ের প্রয়োজন, যাতে একক সূচকের দ্বারা ভুল সংকেতগুলি এড়ানো যায়।

  2. উচ্চ নমনীয়তা, সূচক পরামিতি বাজার অনুযায়ী সামঞ্জস্য করা যেতে পারে। দ্রুত এবং ধীর গড় লাইন এবং চ্যানেলের পরিসীমা পরামিতিগুলি বিভিন্ন বাজার পরিবেশে প্রযোজ্য।

  3. প্রবণতা ট্রেডিং এবং ব্যাচ ট্রেডিংয়ের সমন্বয়ে মাঝারি এবং স্বল্পমেয়াদী সূচকগুলি প্রবণতা ক্যাপচার করে, দীর্ঘমেয়াদী সূচকগুলি ব্যাচগুলি নির্ধারণ করে, সামগ্রিকভাবে প্রবণতা এবং বিপরীত কৌশলগুলির সুবিধাগুলি অন্তর্ভুক্ত করে

  4. তহবিলের ব্যবহারের দক্ষতা বেশি। কেবলমাত্র যখন একাধিক সূচক ফলাফলের সমন্বয় করা হয়, তখন তহবিলকে কার্যকরভাবে ব্যবহার করা যায়, অপ্রয়োজনীয় লেনদেন এড়ানো যায়।

কৌশলগত ঝুঁকি

এই কৌশলটির কিছু ঝুঁকিও রয়েছেঃ

  1. প্যারামিটার সেটিংয়ের ঝুঁকি। চলমান গড়ের সময়কাল এবং চ্যানেলের পরিসীমা প্যারামিটারগুলি যুক্তিসঙ্গতভাবে সেট করা দরকার, যদি এটি সঠিক না হয় তবে এটি কার্যকরভাবে প্রবণতা সনাক্ত করতে পারে না বা খুব বেশি ভুল সংকেত তৈরি করতে পারে।

  2. দ্বিগুণ সূচক ব্যবসায়ের সুযোগের ব্যয় বাড়ায়। একক সূচক কৌশলগুলির তুলনায়, কিছু ব্যবসায়ের সুযোগ মিস করা যেতে পারে এবং সর্বোত্তম পয়েন্টে প্রবেশ এবং প্রস্থান করা যায় না।

  3. স্টপ লস স্ট্র্যাটেজিতে সতর্কতা অবলম্বন করা প্রয়োজন। স্টপ লস মেশিনের মধ্যে একটি ব্রেকআউট অপ্রয়োজনীয় ক্ষতির কারণ হতে পারে এবং স্টপ লস অনুপাতটি সতর্কতার সাথে সেট করা দরকার।

  4. এই কৌশলটি প্রবণতাযুক্ত বাজার পরিবেশে বেশি উপযুক্ত।

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

এই কৌশলটি নিম্নলিখিত দিকগুলি থেকে উন্নত করা যেতে পারেঃ

  1. বিভিন্ন প্যারামিটার সমন্বয় পরীক্ষা করে, সর্বোত্তম প্যারামিটার খুঁজুন। আপনি আরও ইতিহাসের ডেটা পরীক্ষা করে সর্বোত্তম প্যারামিটার সেটিং খুঁজে পেতে পারেন।

  2. স্বনির্ধারিত স্টপ-ডাউন ব্যবস্থা যোগ করা হয়েছে। স্টপ-ডাউনের মাত্রা পরিবর্তনশীলভাবে সংশোধন করা যেতে পারে ভোল্যাটিলিটি ইন্ডিকেটরের সাথে।

  3. ক্যাপাসিটি নির্দেশক বাড়ানো সহায়ক বিচার। পজিশনের আকার নির্ধারণে সহায়ক, তহবিলের ব্যবহারের দক্ষতা বাড়ানো।

  4. ভর্তির লজিক অনুকূলিতকরণ। ভর্তির জন্য কম খরচে ভর্তি হওয়ার জন্য Cost Average কৌশল বিবেচনা করুন।

  5. মেশিন লার্নিং মডেলের সাথে মিলিত। মডেলের মজবুততা এবং ফিটনেসের জন্য নিউরাল নেটওয়ার্কের মতো মডেলের প্রবর্তন।

সারসংক্ষেপ

এই কৌশলটি দ্রুত এবং দীর্ঘ ত্রিগুণ নির্দেশক বিচার এবং দ্বৈত যাচাইকরণ ব্যবস্থার মাধ্যমে কার্যকরভাবে মিথ্যা সংকেত প্রতিরোধ করতে পারে, স্থিতিশীলতা বাড়ায়। একই সাথে প্রবণতা বাণিজ্য এবং ব্যবধানের ব্যবসায়ের সুবিধা রয়েছে, তহবিলের ব্যবহারের দক্ষতা রয়েছে। প্যারামিটার অপ্টিমাইজেশন, স্টপ লস অপ্টিমাইজেশন, পরিমাণগত শক্তি সূচক সংমিশ্রণ ইত্যাদির মাধ্যমে বিভিন্ন উপায়ে উন্নতি করা যেতে পারে। এটি একটি সুপারিশযোগ্য মিশ্রিত পরিমাণগত কৌশল।

কৌশল সোর্স কোড
/*backtest
start: 2023-11-19 00:00:00
end: 2023-12-19 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
// Indicator to combines:
//           Trend Channel[Gu5] (SMA 200) +
//           EMA's cross  (26, 50 ) +
//           Golden Cross (50, 200)
// Author: @gu5tavo71 08/2019
// v2.3.6, 2022.02.18
// Trend Channel [Gu5] // Author: @gu5tavo71 08/2019
//
// This source code is subject to these terms:
// Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
// https://www.safecreative.org/work/2202190517452-mix1-ema-cross-trend-channel-gu5-
// You are free to:
// Share, copy and redistribute this script
// Adapt, transform and build on this script
// Under the following terms:
// Non-commercial: You cannot sell my indicator. You can't sell my work.
// Attribution: If you post part of my code, you must give me proper credit
//
// I am using part of this code published by @PineCoders and Public Library
// Disclaimer: I am not a financial advisor.
//             For purpose educate only. Use at your own risk.
strategy(title = 'Mix1 : Ema Cross + Trend Channel [Gu5] - Backtest', shorttitle = 'Mix01', overlay = true,
  initial_capital = 100,
  default_qty_value = 100,
  default_qty_type = strategy.percent_of_equity,
  commission_value = 0.075,
  commission_type = strategy.commission.percent,
  format = format.price,
  precision = 2,
  process_orders_on_close = true)


// ---------   Inputs                       "=============================="           |
i_maSrc      = input.source     (close,     'MA Source'                     , group    = 'EMAs')
i_maFast1    = input.int        (26,        'EMA Fast'                      , group    = 'EMAs')
i_maFast2    = input.int        (50,        'EMA Medium'                    , group    = 'EMAs')
i_maLen      = input.int        (200,       'MA Trend'                      , group    = 'Trend Channel')
o_maLen1     =                              'EMA'
o_maLen2     =                              'SMA'
i_maLenSel   = input.string     (o_maLen2,  'MA Type'                       , group    = 'Trend Channel',
               options = [o_maLen1, o_maLen2],
               tooltip = "EMA or SMA")
i_htf        = input.timeframe  ('',        'Select Higher Timeframe'       , tooltip  = 'Only for MA Trend'  , group    = 'Trend Channel')
i_rangeLen   = input.float      (0.618,     'Channel Range Length'          , tooltip  = 'ATR of the MA Trend', group    = 'Trend Channel')
i_slOn       = input.bool       (false,     '■ Stop Loss On/Off'            , group    = 'Stop Loss')
i_sl         = input.float      (2.618,     'SL %'                          , step     = 0.1, group    = 'Stop Loss')
i_periodSw   = input.bool       (true,      '■ Period On/Off'               , group    = 'Period')
o_start      = timestamp        (           '2020-01-01 00:00 GMT-3'        )
o_end        = timestamp        (           '2099-12-31 00:00 GMT-3'        )
i_periodStar = input       (o_start,   'Start Time'                    , group    = 'Period')
i_periodEnd  = input       (o_end,     'End Time'                      , group    = 'Period')
o_posSel1    =                              'Only Long'
o_posSel2    =                              'Only Short'
o_posSel3    =                              'Both'
i_posSel     = input.string     (o_posSel3, 'Position Type'                 , group   = 'Strategy',
               options = [o_posSel1, o_posSel2, o_posSel3],
               tooltip = "Only Long, Only short or Both")
o_typeS1     =                              'Strategy 1'
o_typeS2     =                              'Strategy 2'
i_typeS      = input.string     (o_typeS2,  'Strategy Type'                 , group   = 'Strategy',
               options = [o_typeS1, o_typeS2],
               tooltip = "Strategy 1:\nLong, when the price (close) crosses the ema.\nStrategy 2:\nLong, only when ema goes up")
i_barColOn   = input.bool       (true,      '■ Bar Color On/Off'            , group   = 'Display')
i_alertOn    = input.bool       (false,     '■ Alert On/Off'                , group   = 'Display')
i_channelOn  = input.bool       (false,     '■ Channel Range On/Off'        , tooltip = 'If the price (close) is over than the channel, the trend is bullish. If the price is under, bearish. And if the price is in the channel, it is in range', group   = 'Display')
i_goldenOn   = input.bool       (false,     '■ Golden Cross On/Off'         )
o_alert      =                              '{{strategy.order.comment}}'
i_alert      = input.string     (o_alert,   'Setting alert'                 , tooltip = 'For Alerts, just copy {{strategy.order.comment}} and paste in alert window.', group   = 'Display')

// ---------   Calculations
maFast1      = ta.ema(i_maSrc, i_maFast1)
maFast2      = ta.ema(i_maSrc, i_maFast2)
maDir        = maFast1 > maFast2 ? 1 : -1
maTrend      = request.security(syminfo.tickerid, i_htf,
               i_maLenSel == "SMA" ? ta.sma(close, i_maLen)[1] : ta.ema(close, i_maLen)[1],
               lookahead = barmerge.lookahead_on)  //No repaint
maTrendDir   = i_maSrc >= maTrend ? 1 : -1
rangeAtr     = ta.atr(i_maLen) * i_rangeLen
rangeTop     = maTrend + rangeAtr
rangeBot     = maTrend - rangeAtr
rangeCh      = (open <= rangeTop or close <= rangeTop) and
               (open >= rangeBot or close >= rangeBot)
trendDir     = i_typeS  ==  'Strategy 1'                            ?
               rangeCh                                                ?  0 :
               maTrendDir ==  1 and maDir ==  1 and maTrend > maFast2 ?  0 :
               maTrendDir == -1 and maDir == -1 and maTrend < maFast2 ?  0 :
               maTrendDir ==  1 and maDir ==  1                       ?  1 :
               maTrendDir == -1 and maDir == -1                       ? -1 : 0 :
               rangeCh                                                ?  0 :
               maTrendDir ==  1 and maDir ==  1                       ?  1 :
               maTrendDir == -1 and maDir == -1                       ? -1 : 0
GCross       = i_goldenOn ? ta.crossover (maFast2, maTrend) : na
DCross       = i_goldenOn ? ta.crossunder(maFast2, maTrend) : na

period       = true
// Set initial values
condition    = 0.0
entryLong    = trendDir ==  1 and
               i_posSel != 'Only Short' and
               (i_periodSw ? period : true)
entryShort   = trendDir == -1 and
               i_posSel != 'Only Long' and
               (i_periodSw ? period : true)
exitLong     = (trendDir !=  1 or maDir == -1) and
               condition[1] == 1 and 
               i_posSel != 'Only Short' and
               (i_periodSw ? period : true)
exitShort    = (trendDir != -1 or maDir ==  1) and
               condition[1] == -1 and
               i_posSel != 'Only Long' and
               (i_periodSw ? period : true)
closeCond    = exitLong or exitShort
// Stop Loss (sl)
slEntry      = close * i_sl / 100
slTop        = close + slEntry
slBot        = close - slEntry
slTopBuff    = ta.valuewhen(condition[1] !=  1 and entryLong,  slBot, 0)
slBotBuff    = ta.valuewhen(condition[1] != -1 and entryShort, slTop, 0)
slLine       = condition[1] == -1 and entryLong  ? slTopBuff :
               condition[1] ==  1 and entryShort ? slBotBuff :
               condition[1] ==  1  or entryLong  ? slTopBuff :
               condition[1] == -1  or entryShort ? slBotBuff : na
slTopCross   = condition[1] ==  1 and ta.crossunder(close, slLine) or high > slLine and low < slLine
slBotCross   = condition[1] == -1 and ta.crossover (close, slLine) or high > slLine and low < slLine
slExit       = i_slOn ? slTopCross or slBotCross : na
// Conditions
condition   := condition[1] !=  1 and entryLong  ?  1 :
               condition[1] != -1 and entryShort ? -1 :
               condition[1] !=  0 and slExit     ?  0 :
               condition[1] !=  0 and exitLong   ?  0 :
               condition[1] !=  0 and exitShort  ?  0 : nz(condition[1])
long         = condition[1] !=  1 and condition ==  1
short        = condition[1] != -1 and condition == -1
xl           = condition[1] ==  1 and exitLong and not slExit
xs           = condition[1] == -1 and exitShort and not slExit
sl           = condition[1] !=  0 and slExit

// ---------   Colors
c_green      = #006400  //Green
c_greenLight = #388e3c  //Green Light
c_red        = #8B0000  //Red
c_redLight   = #b71c1c  //Red Light
c_emas       = xl                             ? color.new(color.orange, 99) :
               xs                             ? color.new(color.orange, 99) :
               trendDir ==  1 and maDir ==  1 ? color.new(c_green,      99) :
               trendDir == -1 and maDir == -1 ? color.new(c_red,        99) :
               color.new(color.orange, 99)
c_maFill     = xl                             ? color.new(color.orange, 70) :
               xs                             ? color.new(color.orange, 70) :
               trendDir ==  1 and maDir ==  1 ? color.new(c_green,      70) :
               trendDir == -1 and maDir == -1 ? color.new(c_red,        70) :
               color.new(color.orange, 70)
c_maTrend    = trendDir ==  0                           ? color.new(color.orange,  0) :
               trendDir ==  1 and maTrend[1]  < maTrend ? color.new(c_green,       0) :
               trendDir ==  1 and maTrend[1] >= maTrend ? color.new(c_greenLight,  0) :
               trendDir == -1 and maTrend[1]  < maTrend ? color.new(c_redLight,    0) :
               trendDir == -1 and maTrend[1] >= maTrend ? color.new(c_red,         0) : na
c_ch         = trendDir ==  0                           ? color.new(color.orange, 50) :
               trendDir ==  1                           ? color.new(c_green,      50) :
               trendDir == -1                           ? color.new(c_red,        50) : na
c_slLineUp   = ta.rising (slLine, 1)
c_slLineDn   = ta.falling(slLine, 1)
c_slLine     = c_slLineUp ? na :
               c_slLineDn ? na : color.red
c_barCol     = trendDir ==  0                   ? color.new(color.orange,  0) :
               trendDir ==  1 and open <= close ? color.new(c_green,       0) :
               trendDir ==  1 and open  > close ? color.new(c_greenLight,  0) :
               trendDir == -1 and open >= close ? color.new(c_red,         0) :
               trendDir == -1 and open  < close ? color.new(c_redLight,    0) :
               color.new(color.orange, 0)

// ---------   Plots
p_maFast1    = plot(
  maFast1,
  title      = 'EMA Fast 1',
  color      = c_emas,
  linewidth  = 1)
p_maFast2    = plot(
  maFast2,
  title      = 'EMA Fast 2',
  color      = c_emas,
  linewidth  = 2)
fill(
  p_maFast1, p_maFast2,
  title      = 'EMAs Fill',
  color      = c_maFill)
plot(
  maTrend,
  title      = 'SMA Trend',
  color      = c_maTrend,
  linewidth  = 3)
p_chTop      = plot(
  i_channelOn   ? rangeTop : na,
  title      = 'Top Channel',
  color      = c_maTrend,
  linewidth  = 1)
p_chBot      = plot(
  i_channelOn   ? rangeBot : na,
  title      = 'Bottom Channel',
  color      = c_maTrend,
  linewidth  = 1)
fill(
  p_chTop, p_chBot,
  title      = 'Channel',
  color      = c_ch)
plot(
  i_slOn and condition != 0 ? slLine : na,
  title      = 'Stop Loss Line',
  color      = c_slLine,
  linewidth  = 1,
  style      = plot.style_linebr)

// ---------   Alerts
barcolor(i_barColOn ? c_barCol : na)

plotshape(
  i_alertOn and long ? high : na,
  title      = 'Long Label',
  text       = 'Long',
  textcolor  = color.white,
  color      = color.new(c_green, 0),
  style      = shape.labelup,
  size       = size.normal,
  location   = location.belowbar)
plotshape(
  i_alertOn and short ? low : na,
  title      = 'Short Label',
  text       = 'Short',
  textcolor  = color.white,
  color      = color.new(c_red, 0),
  style      = shape.labeldown,
  size       = size.normal,
  location   = location.abovebar)
plotshape(
  i_alertOn and (xl or xs) ? close : na,
  title      = 'Close Label',
  text       = 'Close',
  textcolor  = color.orange,
  color      = color.new(color.orange, 0),
  style      = shape.xcross,
  size       = size.small,
  location   = location.absolute)
plotshape(
  i_alertOn and sl ? slLine : na,
  title      = 'Stop Loss',
  text       = 'Stop\nLoss',
  textcolor  = color.orange,
  color      = color.new(color.orange, 0),
  style      = shape.xcross,
  size       = size.small,
  location   = location.absolute)
plotshape(
  i_alertOn and i_goldenOn and GCross ? maTrend : na,
  title      = 'Golden Cross Label',
  text       = 'Golden\nCross',
  textcolor  = color.white,
  color      = color.new(color.orange, 0),
  style      = shape.labelup,
  size       = size.normal,
  location   = location.absolute)
plotshape(
  i_alertOn and i_goldenOn and DCross ? maTrend : na,
  title      = 'Death Cross Label',
  text       = 'Death\nCross',
  textcolor  = color.white,
  color      = color.new(color.orange, 0),
  style      = shape.labeldown,
  size       = size.normal,
  location   = location.absolute)

bgcolor(
  i_periodSw and not period ? color.new(color.gray, 90) : na,
  title      = 'Session')

// ---------   Backtest
if long  and strategy.position_size == 0 and barstate.isconfirmed
    strategy.entry('Long',  strategy.long,  comment = 'long')
if short and strategy.position_size == 0 and barstate.isconfirmed
    strategy.entry('Short', strategy.short, comment = 'short')
strategy.exit(
  id         = 'XL',
  from_entry = 'Long',
  stop       = i_slOn ? slLine : na)
strategy.exit(
  id         = 'XS',
  from_entry = 'Short',
  stop       = i_slOn ? slLine : na)
strategy.close(
  'Long',
  comment    = 'Close',
  when       = xl)
strategy.close(
  'Short',
  comment    = 'Close',
  when = xs)