متعدد متحرک اشارے کے امتزاج کی حکمت عملی

ATR BB ST MA VWMA
تخلیق کی تاریخ: 2025-04-01 10:12:19 آخر میں ترمیم کریں: 2025-04-01 10:12:19
کاپی: 4 کلکس کی تعداد: 294
2
پر توجہ دیں
319
پیروکار

متعدد متحرک اشارے کے امتزاج کی حکمت عملی متعدد متحرک اشارے کے امتزاج کی حکمت عملی

جائزہ

اس مضمون میں بولنگر بینڈ اور سپر ٹرینڈ اشارے کے ساتھ مل کر ایک مرکب تجارتی حکمت عملی کا تعارف کیا گیا ہے۔ اس حکمت عملی میں متعدد تکنیکی تجزیہ ٹولز کو مربوط کیا گیا ہے تاکہ مارکیٹ میں داخل ہونے اور باہر نکلنے کے زیادہ درست سگنل فراہم کیے جاسکیں ، جبکہ تجارتی خطرہ کو کم کیا جاسکے۔

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

اس حکمت عملی کے دو اہم اجزاء ہیں: بولنگر بینڈ اور سپر ٹرینڈ اشارے.

  1. برائن بینڈ کے حساب سے:
  • ترتیب دینے کے قابل چلتی اوسط ((MA) استعمال کرتے ہوئے بیس لائن کا حساب لگائیں
  • معیاری فرق کے ضارب کے مطابق اوپر اور نیچے کے مدار کی تخلیق
  • ایک سے زیادہ قسم کے متحرک اوسط کی حمایت کرتا ہے: سادہ متحرک اوسط ((SMA) ، اشاریہ متحرک اوسط ((EMA) ، ہموار متحرک اوسط ((SMMA) ، بھاری بھرکم متحرک اوسط ((WMA) اور ٹرانزیکشن کی مقدار بھاری بھرکم متحرک اوسط ((VWMA)
  1. سپر ٹرینڈ سیکشن:
  • اوسط حقیقی اتار چڑھاو کی حد ((ATR) کا استعمال کرتے ہوئے اسٹاپ نقصان کا حساب لگائیں
  • مارکیٹ کے رجحانات کی سمت کا تعین کرنے کے لئے متحرک
  • رجحان کی تبدیلی کے مطابق خرید و فروخت کے اشارے پیدا کرنا

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

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

اسٹریٹجک رسک

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

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

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

خلاصہ کریں۔

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

حکمت عملی کا ماخذ کوڈ
/*backtest
start: 2024-04-01 00:00:00
end: 2025-03-31 00:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/

//@version=6
strategy("Combined BB & New SuperTrend Strategy", overlay=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=10, pyramiding=0)

//============================
// Bollinger Bands Parameters
//============================
lengthBB   = input.int(20, minval=1, title="BB Length")
maType     = input.string("SMA", "BB Basis MA Type", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"])
srcBB      = input(close, title="BB Source")
multBB     = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev Multiplier")
offsetBB   = input.int(0, title="BB Offset", minval=-500, maxval=500)

// Moving average function based on chosen type
ma(source, length, _type) =>
    switch _type
        "SMA"         => ta.sma(source, length)
        "EMA"         => ta.ema(source, length)
        "SMMA (RMA)"  => ta.rma(source, length)
        "WMA"         => ta.wma(source, length)
        "VWMA"        => ta.vwma(source, length)

// Bollinger Bands calculations
basis   = ma(srcBB, lengthBB, maType)
dev     = multBB * ta.stdev(srcBB, lengthBB)
upperBB = basis + dev
lowerBB = basis - dev

// Plot Bollinger Bands
plot(basis, title="BB Basis", color=color.blue, offset=offsetBB)
p1 = plot(upperBB, title="BB Upper", color=color.red, offset=offsetBB)
p2 = plot(lowerBB, title="BB Lower", color=color.green, offset=offsetBB)
fill(p1, p2, title="BB Fill", color=color.new(color.blue, 90))

//============================
// New SuperTrend Parameters & Calculations
// (Based on the new script you provided)
//============================
st_length         = input.int(title="ATR Period", defval=22)
st_mult           = input.float(title="ATR Multiplier", step=0.1, defval=3)
st_src            = input.source(title="SuperTrend Source", defval=hl2)
st_wicks          = input.bool(title="Take Wicks into Account?", defval=true)
st_showLabels     = input.bool(title="Show Buy/Sell Labels?", defval=true)
st_highlightState = input.bool(title="Highlight State?", defval=true)

// Calculate ATR component for SuperTrend
st_atr = st_mult * ta.atr(st_length)

// Price selection based on wicks option
st_highPrice = st_wicks ? high : close
st_lowPrice  = st_wicks ? low  : close
st_doji4price = (open == close and open == low and open == high)

// Calculate SuperTrend stop levels
st_longStop = st_src - st_atr
st_longStopPrev = nz(st_longStop[1], st_longStop)
if st_longStop > 0
    if st_doji4price
        st_longStop := st_longStopPrev
    else
        st_longStop := (st_lowPrice[1] > st_longStopPrev ? math.max(st_longStop, st_longStopPrev) : st_longStop)
else
    st_longStop := st_longStopPrev

st_shortStop = st_src + st_atr
st_shortStopPrev = nz(st_shortStop[1], st_shortStop)
if st_shortStop > 0
    if st_doji4price
        st_shortStop := st_shortStopPrev
    else
        st_shortStop := (st_highPrice[1] < st_shortStopPrev ? math.min(st_shortStop, st_shortStopPrev) : st_shortStop)
else
    st_shortStop := st_shortStopPrev

// Determine trend direction: 1 for bullish, -1 for bearish
var int st_dir = 1
st_dir := st_dir == -1 and st_highPrice > st_shortStopPrev ? 1 : st_dir == 1 and st_lowPrice < st_longStopPrev ? -1 : st_dir

// Define colors for SuperTrend
st_longColor  = color.green
st_shortColor = color.red

// Plot SuperTrend stops
st_longStopPlot  = plot(st_dir == 1 ? st_longStop : na, title="Long Stop", style=plot.style_line, linewidth=2, color=st_longColor)
st_shortStopPlot = plot(st_dir == -1 ? st_shortStop : na, title="Short Stop", style=plot.style_line, linewidth=2, color=st_shortColor)

// Generate SuperTrend signals based on direction change
st_buySignal  = st_dir == 1 and st_dir[1] == -1
st_sellSignal = st_dir == -1 and st_dir[1] == 1

// Optionally plot labels for buy/sell signals
if st_buySignal and st_showLabels
    label.new(bar_index, st_longStop, "Buy", style=label.style_label_up, color=st_longColor, textcolor=color.white, size=size.tiny)
if st_sellSignal and st_showLabels
    label.new(bar_index, st_shortStop, "Sell", style=label.style_label_down, color=st_shortColor, textcolor=color.white, size=size.tiny)

// Fill the state area (optional visual enhancement)
st_midPricePlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=1, display=display.none)
st_longFillColor  = st_highlightState ? (st_dir == 1 ? st_longColor : na) : na
st_shortFillColor = st_highlightState ? (st_dir == -1 ? st_shortColor : na) : na
fill(st_midPricePlot, st_longStopPlot, title="Long State Filling", color=st_longFillColor)
fill(st_midPricePlot, st_shortStopPlot, title="Short State Filling", color=st_shortFillColor)

//============================
// Trading Logic
//============================

// When a bullish reversal occurs, close any short position before entering long.
if st_buySignal
    strategy.close("Short")
    strategy.entry("Long", strategy.long)

// When a bearish reversal occurs, close any long position before entering short.
if st_sellSignal
    strategy.close("Long")
    strategy.entry("Short", strategy.short)

// Exit conditions using Bollinger Bands:
// - For a long position: exit if price reaches (or exceeds) the upper Bollinger Band.
// - For a short position: exit if price reaches (or falls below) the lower Bollinger Band.
if strategy.position_size > 0 and close >= upperBB
    strategy.close("Long", comment="Exit Long via BB Upper")
if strategy.position_size < 0 and close <= lowerBB
    strategy.close("Short", comment="Exit Short via BB Lower")