رفتار کی نگرانی کی حکمت عملی

مصنف:چاؤ ژانگ، تاریخ: 2023-12-29 16:26:49
ٹیگز:

img

جائزہ

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

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

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

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

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

فوائد کا تجزیہ

مومنٹم ٹریکنگ حکمت عملی میں رجحانات کے فیصلے اور رسک کنٹرول کے فوائد کو یکجا کیا گیا ہے ، جو رجحانات کی منڈیوں میں اچھی واپسی حاصل کرسکتا ہے۔ مقررہ اسٹاپ نقصان کی حکمت عملیوں کے مقابلے میں ، یہ اسٹاپ نقصان کو منتقل کرکے رجحان چلتا ہے اور عام مارکیٹ میں اتار چڑھاؤ سے روکنے سے بچ سکتا ہے۔

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

خطرے کا تجزیہ

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

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

اصلاح کی ہدایات

مومنٹوم ٹریکنگ کی حکمت عملی کو مندرجہ ذیل سمتوں میں بہتر بنایا جاسکتا ہے:

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

خلاصہ

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


/*backtest
start: 2023-11-28 00:00:00
end: 2023-12-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// © Milleman
//@version=4
strategy("MilleMachine", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.06)


// Additional settings
Mode = input(title="Mode", defval="LongShort", options=["LongShort", "OnlyLong", "OnlyShort","Indicator Mode"])
UseTP = false                               //input(false, title="Use Take Profit?")
QuickSwitch = true                          //input(true, title="Quickswitch")
UseTC = true                                //input(true, title="Use Trendchange?")

// Risk management settings
//Spacer2 = input(false, title="======= Risk management settings =======")
Risk = input(1.0, title="% Risk",minval=0)/100
RRR = 2                                     //input(2,title="Risk Reward Ratio",step=0.1,minval=0,maxval=20)
SL_Mode = false                             // input(true, title="ON = Fixed SL / OFF = Dynamic SL (ATR)")
SL_Fix = 3                                  //input(3,title="StopLoss %",step=0.25, minval=0)/100
ATR = atr(14)                               //input(14,title="Periode ATR"))
Mul = input(2,title="ATR Multiplier",step=0.1)
xATR = ATR * Mul
SL = SL_Mode ? SL_Fix : (1 - close/(close+xATR))

// INDICATORS  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Ind(type, src, len) =>
    float result = 0
    if type=="McGinley"
        result := na(result[1]) ? ema(src, len) : result[1] + (src - result[1]) / (len * pow(src/result[1], 4))
    if type=="HMA"
        result := wma(2*wma(src, len/2)-wma(src, len), round(sqrt(len)))
    if type=="EHMA"
        result := ema(2*ema(src, len/2)-ema(src, len), round(sqrt(len)))
    if type=="THMA"
        lend = len/2
        result := wma(wma(src, lend/3)*3-wma(src, lend/2)-wma(src,lend), lend)
    if type=="SMA" // Simple
        result := sma(src, len)
    if type=="EMA" // Exponential
        result := ema(src, len)
    if type=="DEMA" // Double Exponential
        e = ema(src, len)
        result := 2 * e - ema(e, len)
    if type=="TEMA" // Triple Exponential
        e = ema(src, len)
        result := 3 * (e - ema(e, len)) + ema(ema(e, len), len)
    if type=="WMA" // Weighted
        result := wma(src, len)
    if type=="VWMA" // Volume Weighted
        result := vwma(src, len) 
    if type=="SMMA" // Smoothed
        w = wma(src, len)
        result := (w[1] * (len - 1) + src) / len
    if type == "RMA"
        result := rma(src, len)
    if type=="LSMA" // Least Squares
        result := linreg(src, len, 0)
    if type=="ALMA" // Arnaud Legoux
        result := alma(src, len, 0.85, 6)
    if type=="Kijun" //Kijun-sen
        kijun = avg(lowest(len), highest(len))
        result :=kijun
    if type=="WWSA" // Welles Wilder Smoothed Moving Average
        result := nz(result[1]) + (close -nz(result[1]))/len
    result

// Baseline : Switch from Long to Short and vice versa
BL_Act = input(true, title="====== Activate Baseline - Switch L/S ======")
BL_type = input(title="Baseline Type", defval="McGinley", options=["McGinley","HMA","EHMA","THMA","SMA","EMA","DEMA","TEMA","WMA","VWMA","SMMA","RMA","LSMA","ALMA","Kijun","WWSA"])
BL_src = input(close, title="BL source")
BL_len = input(50, title="BL length", minval=1)
BL = Ind(BL_type,BL_src, BL_len)

// Confirmation indicator
C1_Act = input(false, title="===== Activate Confirmation indicator =====")
C1_type = input(title="C1 Entry indicator", defval="SMA", options=["McGinley","HMA","EHMA","THMA","SMA","EMA","DEMA","TEMA","WMA","VWMA","SMMA","RMA","LSMA","ALMA","Kijun","WWSA"])
C1_src = input(close, title="Source")
C1_len = input(5,title="Length", minval=1)
C1 = Ind(C1_type,C1_src,C1_len)

// Entry indicator : Hull Moving Average
Spacer5 = input(true, title="====== ENTRY indicator =======")
EI_type = input(title="EI Entry indicator", defval="HMA", options=["McGinley","HMA","EHMA","THMA","SMA","EMA","DEMA","TEMA","WMA","VWMA","SMMA","RMA","LSMA","ALMA","Kijun","WWSA"])
EI_src = input(close, title="Source")
EI_Len = input(46,title="Length", minval=1)
EI = Ind(EI_type,EI_src,EI_Len)

// Trail stop settings
TrailActivation = input(true, title="===== Activate Trailing Stop =====")
TS_type = input(title="TS Traling Stop Type", defval="EMA", options=["McGinley","HMA","EHMA","THMA","SMA","EMA","DEMA","TEMA","WMA","VWMA","SMMA","RMA","LSMA","ALMA","Kijun","WWSA"])
TrailSLScaling = 1 //input(100, title="SL Scaling", minval=0, step=5)/100
TrailingSourceLong = Ind(TS_type,low,input(5,"Smoothing Trail Long EMA", minval=1))
TrailingSourceShort = Ind(TS_type,high,input(2,"Smoothing Trail Short EMA", minval=1))

//VARIABLES MANAGEMENT
TriggerPrice = 0.0, TriggerPrice := TriggerPrice[1]
TriggerSL = 0.0, TriggerSL := TriggerSL[1]
SLPrice = 0.0, SLPrice := SLPrice[1], TPPrice = 0.0, TPPrice := TPPrice[1]
isLong = false, isLong := isLong[1], isShort = false, isShort := isShort[1]

//LOGIC
GoLong = crossover(EI,EI[1]) and (strategy.position_size == 0.0 and QuickSwitch) and (not BL_Act or BL/BL[1] > 1) and (not C1_Act or C1>C1[1]) and (Mode == "LongShort" or Mode == "OnlyLong")
GoShort = crossunder(EI,EI[1]) and (strategy.position_size == 0.0 and QuickSwitch) and (not BL_Act or BL/BL[1] < 1) and (not C1_Act or C1<C1[1]) and (Mode == "LongShort" or Mode == "OnlyShort")
ExitLong = isLong and crossunder(EI,EI[1]) and UseTC
ExitShort = isShort and crossover(EI,EI[1]) and UseTC

//FRAMEWORK
//Reset Long-Short memory
if isLong and strategy.position_size == 0.0
    isLong := false
if isShort and strategy.position_size == 0.0
    isShort := false
//Long
if GoLong
    isLong := true, TriggerPrice := close, TriggerSL := SL
    TPPrice := UseTP? TriggerPrice * (1 + (TriggerSL * RRR)) : na
    SLPrice := TriggerPrice * (1-TriggerSL)
    Entry_Contracts = strategy.equity * Risk / ((TriggerPrice-SLPrice)/TriggerPrice) / TriggerPrice
    strategy.entry("Long", strategy.long, comment=tostring(round((TriggerSL/TriggerPrice)*1000)), qty=Entry_Contracts)
    strategy.exit("TPSL","Long", limit=TPPrice, stop=SLPrice)
if isLong
    NewValSL = TrailingSourceLong * (1 - (SL*TrailSLScaling))
    if TrailActivation and NewValSL > SLPrice
        SLPrice := NewValSL
    strategy.exit("TPSL","Long", limit=TPPrice, stop=SLPrice)
if ExitLong
    strategy.close_all(comment="TrendChange")
    isLong := false

//Short
if GoShort
    isShort := true, TriggerPrice := close, TriggerSL := SL
    TPPrice := UseTP? TriggerPrice * (1 - (TriggerSL * RRR)) : na
    SLPrice := TriggerPrice * (1 + TriggerSL)
    Entry_Contracts = strategy.equity * Risk / ((SLPrice-TriggerPrice)/TriggerPrice) / TriggerPrice
    strategy.entry("Short", strategy.short, comment=tostring(round((TriggerSL/TriggerPrice)*1000)), qty=Entry_Contracts)
    strategy.exit("TPSL","Short", limit=TPPrice, stop=SLPrice)
if isShort
    NewValSL = TrailingSourceShort * (1 + (SL*TrailSLScaling))
    if TrailActivation and NewValSL < SLPrice
        SLPrice := NewValSL
    strategy.exit("TPSL","Short", limit=TPPrice, stop=SLPrice)
if ExitShort
    strategy.close_all(comment="TrendChange")
    isShort := false

//VISUALISATION
plot(BL_Act?BL:na, color=color.blue,title="Baseline")
plot(C1_Act?C1:na, color=color.yellow,title="confirmation Indicator")
EIColor = EI>EI[1] ? color.green : color.red
Fill_EI = plot(EI, color=EIColor, linewidth=1, transp=40, title="Entry Indicator EI")
Fill_EID = plot(EI[1], color=EIColor, linewidth=1, transp=40, title="Entry Indicator EID")
fill(Fill_EI,Fill_EID, title="EI_Fill", color=EIColor,transp=50)

plot(strategy.position_size != 0.0 and (isLong or isShort) ? TriggerPrice : na, title="TriggerPrice", color=color.yellow, style=plot.style_linebr)
plot(strategy.position_size != 0.0 and (isLong or isShort) ? TPPrice : na, title="TakeProfit", color=color.green, style=plot.style_linebr)
plot(strategy.position_size != 0.0 and (isLong or isShort) ? SLPrice : na, title="StopLoss", color=color.red, style=plot.style_linebr)
bgcolor(isLong[1] and cross(low,SLPrice) and low[1] > SLPrice and TriggerPrice>SLPrice ? color.yellow : na, transp=75, title="SL Long")
bgcolor(isShort[1] and cross(high,SLPrice) and high[1] < SLPrice and TriggerPrice<SLPrice ? color.yellow : na, transp=75, title="SL Short")

مزید