بنیادی پِنبار ٹریڈنگ حکمت عملی

مصنف:چاؤ ژانگ، تاریخ: 2023-11-15 15:25:57
ٹیگز:

img

جائزہ

یہ حکمت عملی پِن بار پیٹرن کو رجحان کے تعین کے ساتھ رجحان کی سمت میں تجارتی بریک آؤٹ کے لئے اوسط منتقل کرکے استعمال کرتی ہے۔ جب قیمت پِن بار موم بتی کے ذریعہ تشکیل دی گئی اعلی / کم سے باہر نکلتی ہے تو یہ تجارتی سگنل تیار کرتی ہے۔ اس کے علاوہ ، یہ مجموعی رجحان کی سمت کا تعین کرنے کے لئے تیز اور سست حرکت پذیر اوسط استعمال کرتی ہے ، جس سے حد سے وابستہ قیمت کی کارروائی کے دوران غلط سگنل سے گریز ہوتا ہے۔

حکمت عملی منطق

  1. تیز (20 دورانیہ) اور سست (50 دورانیہ) چلتی اوسط کا حساب لگائیں۔

  2. شمعدان کی بنیاد پر تیزی (بند> کھلا) اور کمی (بند< کھلا) pinbars کی شناخت کریں.

  3. چیک کریں کہ کیا پنبار ہائی / لو پچھلی موم بتی کی ہائی / لو کو توڑتا ہے۔ پچھلی اونچائی کو توڑنے والا ایک بولش پنبار ایک لمبا سگنل دیتا ہے۔ پچھلی کم کو توڑنے والا ایک bearish پنبار ایک مختصر سگنل دیتا ہے۔

  4. اس کے علاوہ چیک کریں کہ کیا تیز رفتار ایم اے سست رفتار ایم اے سے اوپر ہے تاکہ اپ ٹرینڈ کا تعین کیا جاسکے اور اس کے برعکس ڈاؤن ٹرینڈ کا تعین کیا جاسکے۔

  5. لمبے سگنل صرف اس وقت درست ہوتے ہیں جب تیز / سست ایم اے ایک اپ ٹرینڈ کی نشاندہی کرتا ہے۔ مختصر سگنل صرف اس وقت درست ہوتے ہیں جب تیز / سست ایم اے ایک ڈاؤن ٹرینڈ کی نشاندہی کرتا ہے۔ اس سے رینج سے منسلک قیمت کی کارروائی کے دوران غلط سگنلز سے گریز ہوتا ہے۔

  6. درست لانگ سگنلز پر پہلے سے طے شدہ سٹاپ لوس اور ٹیک پروفیٹ کے ساتھ لانگ جائیں۔ درست شارٹ سگنلز پر پہلے سے طے شدہ سٹاپ لوس اور ٹیک پروفیٹ کے ساتھ شارٹ جائیں۔

  7. اگر تیز رفتار ایم اے سست رفتار ایم اے سے نیچے گزر جائے تو، کسی بھی موجودہ پوزیشن کو بند کر دیں۔

فوائد

  • مضبوط رفتار کی نمائندگی کرنے والے بریک آؤٹ کی سطح کے طور پر پنبار اعلی / کم استعمال کرتا ہے.

  • رینج سے منسلک قیمت کی کارروائی کے دوران غلط سگنل سے بچنے کے لئے رجحان کی سمت پر غور کرتا ہے، درستگی کو بہتر بناتا ہے.

  • رجحانات اور بریکآؤٹس کو پکڑتا ہے، رجحانات کی مارکیٹوں میں اچھی کارکردگی کا مظاہرہ کرتا ہے.

  • پیرامیٹرز مختلف مصنوعات اور وقت کے فریم کے لئے بہتر کیا جا سکتا ہے.

خطرات اور تخفیف

  • ناکامی کا خطرہ۔ اس کو بڑھاوا دینے کی سطح اور مضبوط رفتار کے استعمال سے کم کیا جا سکتا ہے۔

  • غیر درست رجحان کی نشاندہی کا خطرہ۔ ایم اے پیرامیٹرز کو ایڈجسٹ کرکے یا دیگر رجحان اشارے شامل کرکے کم کیا جاسکتا ہے۔

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

  • منافع کو بہت تنگ کرتے ہوئے منافع کو محدود کرتے ہیں۔ متحرک طور پر منافع کے اہداف اور رسک - انعام کے تناسب کا تعین کرسکتے ہیں۔

بہتر مواقع

  • مجموعی طور پر، ایم اے، بریکآؤٹ، سٹاپ نقصان اور منافع لینے کے پیرامیٹرز کو اپنی مرضی کے مطابق حکمت عملی کے لئے مصنوعات اور ٹائم فریموں میں بہتر بنایا جا سکتا ہے.

  • مختلف ایم اے جیسے ای ایم اے، ایس ایم اے وغیرہ کا تجربہ کیا جا سکتا ہے تاکہ زیادہ سے زیادہ اشارے کو تلاش کیا جا سکے۔

  • اضافی اشارے جیسے مومنٹم رجحان کی درستگی کو بہتر بنا سکتے ہیں۔

  • پیرامیٹرز کو مشین لرننگ تکنیک کا استعمال کرتے ہوئے متحرک طور پر بہتر بنایا جاسکتا ہے۔

  • بریک آؤٹ کی کامیابی کی شرح کو شماریاتی سیکھنے کے ذریعے بہتر بنایا جاسکتا ہے۔

خلاصہ

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


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

//@version=4
//Backtested Time Frame: H1
//Default Settings: Are meant to run successfully on all currency pairs to reduce over-fitting.
//Risk Warning: This is a forex trading robot, backtest performance will not equal future performance, USE AT YOUR OWN RISK.
//Code Warning: Although every effort has been made for robustness, this code has not been vetted by independent 3rd parties.
strategy("Pin Bar Strategy v1", overlay=true)

// User Input
usr_risk = input(title="Equity Risk (%)",type=input.integer,minval=1,maxval=100,step=1,defval=3,confirm=false)
atr_mult = input(title="Stop Loss (x*ATR, Float)",type=input.float,minval=0.1,maxval=100,step=0.1,defval=1.9,confirm=false)
trd_rewd = input(title="Risk : Reward (1 : x*SL, Float)",type=input.float,minval=0.1,maxval=100,step=0.1,defval=3.1,confirm=false)
sma_fast = input(title="Fast MA (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=20,confirm=false)
sma_slow = input(title="Slow MA (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=50,confirm=false)
atr_valu = input(title="ATR (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=14,confirm=false)
use_slpe = input(title="Use MA Slope (Boolean)",type=input.bool,defval=true,confirm=false)
slp_long = input(title="Bull Slope Angle (Deg)",type=input.integer,minval=-90,maxval=90,step=1,defval=1,confirm=false)
slp_shrt = input(title="Bear Slope Angle (Deg)",type=input.integer,minval=-90,maxval=90,step=1,defval=-1,confirm=false)
emg_exit = input(title="Exit When MA Re-Cross (Boolean)",type=input.bool,defval=true,confirm=false)
ent_canc = input(title="Cancel Entry After X Bars (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=3,confirm=false)

// Create Indicators
fastSMA = sma(close, sma_fast)
slowSMA = sma(close, sma_slow)
bullishPinBar = ((close > open) and ((open - low) > 0.66 * (high - low))) or ((close < open) and ((close - low) > 0.66 * (high - low)))
bearishPinBar = ((close > open) and ((high - close) > 0.66 * (high - low))) or ((close < open) and ((high - open) > 0.66 * (high - low)))
atr = atr(atr_valu)

// Specify Trend Conditions
smaUpTrend = (fastSMA > slowSMA) and (fastSMA[1] > slowSMA[1]) and (fastSMA[2] > slowSMA[2]) and (fastSMA[3] > slowSMA[3]) and (fastSMA[4] > slowSMA[4])
smaDnTrend = (fastSMA < slowSMA) and (fastSMA[1] < slowSMA[1]) and (fastSMA[2] < slowSMA[2]) and (fastSMA[3] < slowSMA[3]) and (fastSMA[4] < slowSMA[4])
candleUpTrend = (close[5] > fastSMA[5]) and (open[5] > fastSMA[5]) and (close[6] > fastSMA[6]) and (open[6] > fastSMA[6]) and (close[7] > fastSMA[7]) and (open[7] > fastSMA[7]) and (close[8] > fastSMA[8]) and (open[8] > fastSMA[8]) and (close[9] > fastSMA[9]) and (open[9] > fastSMA[9]) and (close[10] > fastSMA[10]) and (open[10] > fastSMA[10])
candleDnTrend = (close[5] < fastSMA[5]) and (open[5] < fastSMA[5]) and (close[6] < fastSMA[6]) and (open[6] < fastSMA[6]) and (close[7] < fastSMA[7]) and (open[7] < fastSMA[7]) and (close[8] < fastSMA[8]) and (open[8] < fastSMA[8]) and (close[9] < fastSMA[9]) and (open[9] < fastSMA[9]) and (close[10] < fastSMA[10]) and (open[10] < fastSMA[10])

// Specify Piercing Conditions
bullPierce = ((low < fastSMA) and (open > fastSMA) and (close > fastSMA)) or ((low < slowSMA) and (open > slowSMA) and (close > slowSMA))
bearPierce = ((high > fastSMA) and (open < fastSMA) and (close < fastSMA)) or ((high > slowSMA) and (open < slowSMA) and (close < slowSMA))

// MA Slope Function
angle(_source) =>
    rad2degree=180/3.14159265359
    ang=rad2degree*atan((_source[0] - _source[1])/atr(atr_valu)) 

// Calculate MA Slope
fastSlope=angle(fastSMA)
slowSlope=angle(slowSMA)
slopingUp = fastSlope > slp_long
slopingDn = fastSlope < slp_shrt
    
// Specify Entry Conditions
longEntry = smaUpTrend and bullishPinBar and bullPierce
shortEntry = smaDnTrend and bearishPinBar and bearPierce
longEntryWithSlope = smaUpTrend and bullishPinBar and bullPierce and slopingUp
shortEntryWithSlope = smaDnTrend and bearishPinBar and bearPierce and slopingDn

// Specify Secondary Exit Conditions
longExit = crossunder(fastSMA, slowSMA)
shortExit = crossover(fastSMA, slowSMA)

// Long Entry Function
enterlong() =>
    risk = usr_risk * 0.01 * strategy.equity
    stopLoss = low[1] - atr[1] * atr_mult
    entryPrice = high[1]
    units = risk / (entryPrice - stopLoss)
    takeProfit = entryPrice + trd_rewd * (entryPrice - stopLoss)
    strategy.entry("long", strategy.long, units, stop=entryPrice)
    strategy.exit("exit long", "long", stop=stopLoss, limit=takeProfit)
    
// Short Entry Function
entershort() =>
    risk = usr_risk * 0.01 * strategy.equity
    stopLoss = high[1] + atr[1] * atr_mult
    entryPrice = low[1]
    units = risk / (stopLoss - entryPrice)
    takeProfit = entryPrice - trd_rewd * (stopLoss - entryPrice)
    strategy.entry("short", strategy.short, units, stop=entryPrice)
    strategy.exit("exit short", "short", stop=stopLoss, limit=takeProfit)
    
// Execute Long Entry w/o Slope
if (longEntry and use_slpe == false)
    enterlong()
    
// Execute Long Entry w/ Slope
if (longEntryWithSlope and use_slpe == true)
    enterlong()

// Exit Long Due to Re-Cross
if(longExit and strategy.position_size > 0 and emg_exit)    
    strategy.order("exit long, re-cross", strategy.short, abs(strategy.position_size))

// Cancel the Long Entry
strategy.cancel("long", barssince(longEntry) > ent_canc)

// Execute Short Entry w/o Slope
if (shortEntry and use_slpe == false)
    entershort() 
    
// Execute Short Entry w/ Slope
if (shortEntryWithSlope and use_slpe == true)
    entershort() 

// Exit Short Due to Re-Cross
if(shortExit and strategy.position_size < 0 and emg_exit)    
    strategy.order("exit short, re-cross", strategy.long, abs(strategy.position_size))

// Cancel the Short Entry
strategy.cancel("short", barssince(shortEntry) > ent_canc)

// Plot Moving Averages to Chart
plot(fastSMA, color=color.red)
plot(slowSMA, color=color.blue)

// Plot Pin Bars to Chart
plotshape(bullishPinBar, style=shape.arrowup, location=location.abovebar, color=#FF0000, text='')
plotshape(bearishPinBar, style=shape.arrowdown, location=location.belowbar, color=#0000FF, text='')

مزید