دوہری اشارے والا ہائبرڈ مقداری تجارتی حکمت عملی

مصنف:چاؤ ژانگ، تاریخ: 2023-12-20 10:31:06
ٹیگز:

img

جائزہ

یہ حکمت عملی رجحان کی سمت کی نشاندہی کرنے اور تجارت کرنے کے لئے دوہری اشارے کو جوڑتی ہے۔ سب سے پہلے ، یہ قلیل مدتی رجحان کا فیصلہ کرنے کے لئے دو حرکت پذیر اوسط (تیز اور درمیانے) کے کراس اوور کا استعمال کرتی ہے۔ دوسرا ، یہ چینل رینج اور طویل مدتی حرکت پذیر اوسط کا استعمال اہم رجحان کی سمت کا تعین کرنے کے لئے کرتی ہے۔ تجارتی سگنل صرف اس وقت پیدا ہوتے ہیں جب دونوں فیصلے مستقل ہوں۔ متعدد اشارے کا استعمال کرتے ہوئے ہائبرڈ حکمت عملی غلط اشاروں کو مؤثر طریقے سے فلٹر کرسکتی ہے اور استحکام کو بہتر بناسکتی ہے۔

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

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

خاص طور پر، منطق یہ ہے:

  1. مختصر مدت کے رجحان کا تعین کرنے کے لئے تیز رفتار اور درمیانے درجے کے چلنے والے اوسطوں کا کراس اوور (گولڈن کراس برائے بولش ، ڈیتھ کراس برائے بیرش) ۔

  2. کیا قیمت درمیانی مدتی رجحان کا تعین کرنے کے لئے چینل کی حد سے گزرتی ہے۔ چینل کی حد طویل مدتی ایم اے پلس / مائنس اے ٹی آر ضرب ایک ضارب پر مبنی ہے۔ اوپری حد کو توڑنے سے اشارے بڑھتے ہیں ، نیچے کی حد کو توڑنے سے اشارے کم ہوتے ہیں۔

  3. اہم رجحان کا تعین کرنے کے لئے طویل مدتی ایم اے کے ساتھ قیمت کا موازنہ.

آخر میں ، تجارتی سگنل صرف اس وقت پیدا ہوتے ہیں جب تینوں فیصلے مستقل ہوتے ہیں۔ یہ ہائبرڈ میکانزم غلط سگنلز کو مؤثر طریقے سے فلٹر کرسکتا ہے اور استحکام کو بہتر بنا سکتا ہے۔

حکمت عملی کے فوائد

اس دوہری اشارے ہائبرڈ حکمت عملی میں کئی فوائد ہیں:

  1. غلط سگنل کو مؤثر طریقے سے فلٹر کریں اور استحکام کو بہتر بنائیں۔ کیونکہ تجارتی سگنل کو ایک ہی میٹرک سے غلطیوں سے بچنے کے لئے متعدد اشارے سے توثیق کی ضرورت ہے۔

  2. مختلف مارکیٹوں کے لئے پیرامیٹرز کو ایڈجسٹ کرنے کے لئے اعلی لچک۔ ایم اے اور چینل رینج کے پیرامیٹرز کو مختلف ماحول کے لئے ایڈجسٹ کیا جاسکتا ہے۔

  3. رجحان کی تجارت اور رینج ٹریڈنگ کو یکجا کریں۔ درمیانی اور قلیل مدتی اشارے رجحانات کو پکڑتے ہیں ، طویل مدتی اشارے رینج کا تعین کرتے ہیں۔ مجموعی طور پر رجحان اور اوسط ریورس دونوں حکمت عملیوں کی خوبیوں کا حامل ہے۔

  4. سرمایہ کے استعمال کی اعلی کارکردگی۔ صرف اس وقت آرڈر دیں جب متعدد اشارے متفق ہوں ، غیر ضروری تجارت سے بچنے کے لئے سرمایہ کو مؤثر طریقے سے استعمال کیا جاسکتا ہے۔

حکمت عملی کے خطرات

کچھ خطرات بھی ہیں:

  1. پیرامیٹر سیٹنگ خطرہ۔ ایم اے ادوار اور چینل رینج کو مناسب ترتیب کی ضرورت ہے ، غلط ترتیبات رجحانات کا پتہ لگانے میں ناکام ہوسکتی ہیں یا بہت زیادہ غلط سگنل پیدا کرسکتی ہیں۔

  2. دوہری اشارے سے مواقع کی لاگت میں اضافہ۔ سنگل اشارے کی حکمت عملیوں کے مقابلے میں ، کچھ تجارتی مواقع ضائع ہوسکتے ہیں ، بہترین مقامات پر داخل ہونے اور باہر نکلنے کے قابل نہیں ہوتے ہیں۔

  3. سٹاپ نقصان کے طریقہ کار کو احتیاط کی ضرورت ہے۔ یہاں بریک آؤٹ اسٹاپ نقصان غیر ضروری نقصانات کا سبب بن سکتا ہے۔ اسٹاپ نقصان کا فیصد محتاط ترتیب کی ضرورت ہے۔

  4. انتہائی اتار چڑھاؤ والے بازاروں میں کم کارکردگی کا مظاہرہ کرسکتا ہے۔ یہ حکمت عملی واضح رجحان والے بازاروں میں بہتر کام کرتی ہے۔

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

اسٹریٹیجی کو مندرجہ ذیل پہلوؤں سے بہتر بنایا جاسکتا ہے:

  1. زیادہ سے زیادہ تلاش کرنے کے لئے مختلف پیرامیٹر مجموعے کی جانچ کریں۔ زیادہ سے زیادہ ترتیب تلاش کرنے کے لئے تاریخی اعداد و شمار کے ساتھ مزید بیک ٹیسٹ۔

  2. موافقت پذیر سٹاپ نقصان میکانزم شامل کریں. متحرک طور پر اتار چڑھاؤ اشارے کی بنیاد پر سٹاپ نقصان کی سطح کو ایڈجسٹ کریں.

  3. اہم نکات پر حجم کے اشارے کے ساتھ مدد کریں۔ سرمایہ کاری کی کارکردگی کو بہتر بنانے کے لئے حجم کے ساتھ پوزیشن سائزنگ کا فیصلہ کریں۔

  4. انٹری منطق کو بہتر بنائیں۔ ایک ہی انٹری کے خطرے کو کم کرنے کے لئے لاگت کی اوسط کے ساتھ مرحلہ وار اندراجات پر غور کریں۔

  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)

مزید