
یہ ایک کارڈ کی شکل پر مبنی خودکار تجارتی حکمت عملی ہے۔ یہ حکمت عملی متعدد کارڈ کی شکل کے اشارے کی شناخت کرکے ، جب شکل کے حالات میں داخل ہوتی ہے ، اور روک تھام ، اسٹاپ اور ٹریکنگ اسٹاپ کو ترتیب دے کر خطرے کو کنٹرول کرتی ہے۔
اس حکمت عملی میں بنیادی طور پر درج ذیل کارڈ کی شکلوں کو داخلہ سگنل کے طور پر پہچانا جاتا ہے: پیکیج شکل ، احاطہ شدہ شکل ، جوڑ کھودنے والی شکل ، چمکتا ہوا ستارہ شکل ، سیاہ بادل دباؤ شہر شکل ، حاملہ لائن شکل ، تینوں شکل ، ٹیلے کی شکل وغیرہ۔ جب مذکورہ بالا خرید سگنل کا پتہ چلتا ہے تو ، زیادہ داخلہ کریں؛ جب فروخت سگنل کا پتہ چلتا ہے تو ، خالی داخلہ کریں۔
اس کے علاوہ ، حکمت عملی میں خطرے پر قابو پانے کے لئے اسٹاپ نقصان ، اسٹاپ اور ٹریکنگ اسٹاپ بھی شامل ہیں۔ خاص طور پر ، اسٹاپ نقصان داخلہ قیمت کے نیچے ایک مقررہ فیصد کے طور پر مقرر کیا گیا ہے ، اسٹاپ نقصان داخلہ قیمت کے اوپر ایک مقررہ قیمت ہے ، اور ٹریکنگ اسٹاپ داخلہ قیمت کے اوپر ایک خاص متحرک نقطہ ہے۔
اس بات پر زور دینے کی ضرورت ہے کہ اس حکمت عملی میں ٹریڈنگ کے اوقات بھی متعین کیے گئے ہیں، اور تمام پوزیشنوں کو حکمت عملی کے طے شدہ ٹریڈنگ کے اوقات میں خالی کیا جاتا ہے، تاکہ راتوں رات کے خطرے سے بچایا جاسکے۔
اس حکمت عملی کا سب سے بڑا فائدہ یہ ہے کہ کارڈ کی شکل کو ایک موثر تکنیکی اشارے کے طور پر استعمال کیا جاتا ہے جس میں داخلہ کی بنیاد ہے۔ بہت سارے تاریخی اعداد و شمار سے پتہ چلتا ہے کہ جب کچھ مخصوص K لائن کی شکلیں ظاہر ہوتی ہیں تو یہ بہت امکان ہوتا ہے کہ یہ مطالبہ کی فراہمی کے تعلقات اور مارکیٹ کی نفسیات میں تبدیلی کی نشاندہی کرتی ہے ، جو ہمارے داخلے کے لئے ایک اچھا وقت فراہم کرتی ہے۔
ایک اور فائدہ یہ ہے کہ ایک مکمل خطرے کے کنٹرول کا طریقہ کار قائم کیا گیا ہے۔ چاہے یہ نقصان کو روکنے ، روکنے یا نقصان کو روکنے کے لئے ہو ، اس سے زیادہ سے زیادہ نقصان کو روکا جاسکتا ہے اور خطرے کو کنٹرول کیا جاسکتا ہے۔
آخر میں ، حکمت عملی لچکدار چلتی ہے ، جس میں مختلف اقسام اور تجارت کی ترجیحات کو ایڈجسٹ کرنے کے لئے شکل کے پیرامیٹرز اور رسک کنٹرول کے پیرامیٹرز کو ایڈجسٹ کیا جاسکتا ہے۔
اس حکمت عملی کا سب سے بڑا خطرہ تکنیکی اشارے کے طور پر کارڈ کی شکل کی عدم استحکام ہے۔ اگرچہ کارڈ کی شکل مارکیٹ کے بدلتے رجحانات کی واضح عکاسی کرسکتی ہے ، لیکن اس کے ساتھ ہی مارکیٹ میں بے ترتیب اتار چڑھاؤ کا بھی خطرہ ہوتا ہے ، غلط سگنل کا امکان کم نہیں ہے۔
مزید برآں ، کارڈ کی شکل اور قیمت میں ہونے والی تبدیلی کے مابین کوئی لازمی وجہ وجوہ نہیں ہے۔ یہاں تک کہ اگر ایک عام شکل کا پتہ چل جائے تو ، اس بات کا امکان بھی موجود ہے کہ قیمت اس شکل کی توقع کے برعکس سمت میں جائے گی۔
مذکورہ بالا خطرات کو کم کرنے کے لئے ، اسٹاپ ، اسٹاپ اور ٹریک اسٹاپ کے قواعد پر سختی سے عمل کرنے کے علاوہ ، کسی ایک تکنیکی اشارے سے پیدا ہونے والے ممکنہ خطرات سے بچنے کے لئے ، دوسرے زیادہ مستحکم اشارے کے ساتھ مل کر غور کیا جاسکتا ہے۔
کارڈ کی شکل کی استحکام کی حدود کو مدنظر رکھتے ہوئے ، اس کے بعد مزید مستحکم اشارے کے ساتھ جوڑنے کی کوشش کی جاسکتی ہے۔ مثال کے طور پر ، رجحان ساز اشارے جیسے برن بینڈ ، منتقل اوسط ، یا جھٹکے والے اشارے جیسے آر ایس آئی ، ایم اے سی ڈی۔ اس کا استعمال کھیل میں آنے والے وقت کو فلٹر کرنے کے لئے کیا جاسکتا ہے تاکہ شور کی تجارت کا امکان کم کیا جاسکے۔
ایک اور ممکنہ اصلاحی سمت مشین لرننگ کے طریقوں کو اپنانا ہے۔ نیورل نیٹ ورکس جیسے بڑے پیمانے پر تاریخی اعداد و شمار کی تربیت کے ذریعہ ، شکل اور قیمتوں کی اصل حرکت کے مابین اعدادوشمار کے تعلقات کے ماڈل تیار کریں۔ یہ شکل کے اشارے کی درستگی کو بہتر بنا سکتا ہے۔
آخر میں ، اس حکمت عملی کو بنیادی فریم ورک کے طور پر استعمال کیا جاسکتا ہے اور اعلی تعدد تجارت کے ل more زیادہ پیچیدہ الگورتھم کے ساتھ بہتر بنایا جاسکتا ہے۔ مثال کے طور پر زیادہ نفیس اسٹاپ نقصانات ، یا اعلی درجے کی زبان کے ذریعہ زیادہ سے زیادہ ڈیٹا انٹرفیس کے ساتھ پیچیدہ ماڈلنگ وغیرہ۔
مجموعی طور پر ، یہ حکمت عملی کارڈ کی شکل کا استعمال کرتی ہے ، جو ایک موثر تکنیکی اشارے کے طور پر سگنل انٹری ہے ، اور اس میں ایک مکمل اسٹاپ نقصان ، اسٹاپ اسٹاپ اور ٹریکنگ اسٹاپ نقصان کے منطقی کنٹرول کا خطرہ ہے۔ یہ ایک ایسی حکمت عملی ہے جس کی عملی جانچ پڑتال کے قابل ہے۔ کوڈنگ اینگل نے اس حکمت عملی کو بنیادی فریم ورک کے طور پر استعمال کرنے کی ترغیب دی ہے تاکہ بہتر عملی اثر پیدا کیا جاسکے۔
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
//DanyChe
//The script allows you to test popular candlestick patterns on various instruments and timeframes. In addition, you can configure risk management (if the value is zero, it means the function is disabled), and you can also specify the time of the trading session (for example, so that the positions are not transferred to the next day).
//The author is grateful to JayRogers and Phi35, their code examples helped a lot in writing the strategy.
strategy("Candle Patterns Strategy", shorttitle="CPS", overlay=true)
//--- Patterns Input ---
OnEngulfing = input(defval=true, title="Engulfing")
OnHarami = input(defval=true, title="Harami")
OnPiercingLine = input(defval=true, title="Piercing Line / Dark Cloud Cover")
OnMorningStar = input(defval=true, title="Morning Star / Evening Star ")
OnBeltHold = input(defval=true, title="Belt Hold")
OnThreeWhiteSoldiers = input(defval=true, title="Three White Soldiers / Three Black Crows")
OnThreeStarsInTheSouth = input(defval=true, title="Three Stars in the South")
OnStickSandwich = input(defval=true, title="Stick Sandwich")
OnMeetingLine = input(defval=true, title="Meeting Line")
OnKicking = input(defval=true, title="Kicking")
OnLadderBottom = input(defval=true, title="Ladder Bottom")
//--- Risk Management Input ---
inpsl = input(defval = 100, title="Stop Loss", minval = 0)
inptp = input(defval = 1000, title="Take Profit", minval = 0)
inptrail = input(defval = 40, title="Trailing Stop", minval = 0)
// If the zero value is set for stop loss, take profit or trailing stop, then the function is disabled
sl = inpsl >= 1 ? inpsl : na
tp = inptp >= 1 ? inptp : na
trail = inptrail >= 1 ? inptrail : na
//--- Session Input ---
sess = input(defval = "0000-0000", title="Trading session")
t = time('240', sess)
session_open = na(t) ? false : true
// --- Candlestick Patterns ---
//Engulfing
bullish_engulfing = high[0]>high[1] and low[0]<low[1] and open[0]<open[1] and close[0]>close[1] and close[0]>open[0] and close[1]<close[2] and close[0]>open[1] ? OnEngulfing : na
bearish_engulfing = high[0]>high[1] and low[0]<low[1] and open[0]>open[1] and close[0]<close[1] and close[0]<open[0] and close[1]>close[2] and close[0]<open[1] ? OnEngulfing : na
//Harami
bullish_harami = open[1]>close[1] and close[1]<close[2] and open[0]>close[1] and open[0]<open[1] and close[0]>close[1] and close[0]<open[1] and high[0]<high[1] and low[0]>low[1] and close[0]>=open[0] ? OnHarami : na
bearish_harami = open[1]<close[1] and close[1]>close[2] and open[0]<close[1] and open[0]>open[1] and close[0]<close[1] and close[0]>open[1] and high[0]<high[1] and low[0]>low[1] and close[0]<=open[0] ? OnHarami : na
//Piercing Line/Dark Cloud Cover
piercing_line = close[2]>close[1] and open[0]<low[1] and close[0]>avg(open[1],close[1]) and close[0]<open[1] ? OnPiercingLine : na
dark_cloud_cover = close[2]<close[1] and open[0]>high[1] and close[0]<avg(open[1],close[1]) and close[0]>open[1] ? OnPiercingLine : na
//Morning Star/Evening Star
morning_star = close[3]>close[2] and close[2]<open[2] and open[1]<close[2] and close[1]<close[2] and open[0]>open[1] and open[0]>close[1] and close[0]>close[2] and open[2]-close[2]>close[0]-open[0] ? OnMorningStar : na
evening_star = close[3]<close[2] and close[2]>open[2] and open[1]>close[2] and close[1]>close[2] and open[0]<open[1] and open[0]<close[1] and close[0]<close[2] and close[2]-open[2]>open[0]-close[0] ? OnMorningStar : na
//Belt Hold
bullish_belt_hold = close[1]<open[1] and low[1]>open[0] and close[1]>open[0] and open[0]==low[0] and close[0]>avg(close[0],open[0]) ? OnBeltHold :na
bearish_belt_hold = close[1]>open[1] and high[1]<open[0] and close[1]<open[0] and open[0]==high[0] and close[0]<avg(close[0],open[0]) ? OnBeltHold :na
//Three White Soldiers/Three Black Crows
three_white_soldiers = close[3]<open[3] and open[2]<close[3] and close[2]>avg(close[2],open[2]) and open[1]>open[2] and open[1]<close[2] and close[1]>avg(close[1],open[1]) and open[0]>open[1] and open[0]<close[1] and close[0]>avg(close[0],open[0]) and high[1]>high[2] and high[0]>high[1] ? OnThreeWhiteSoldiers : na
three_black_crows = close[3]>open[3] and open[2]>close[3] and close[2]<avg(close[2],open[2]) and open[1]<open[2] and open[1]>close[2] and close[1]<avg(close[1],open[1]) and open[0]<open[1] and open[0]>close[1] and close[0]<avg(close[0],open[0]) and low[1]<low[2] and low[0]<low[1] ? OnThreeWhiteSoldiers : na
//Three Stars in the South
three_stars_in_the_south = open[3]>close[3] and open[2]>close[2] and open[2]==high[2] and open[1]>close[1] and open[1]<open[2] and open[1]>close[2] and low[1]>low[2] and open[1]==high[1] and open[0]>close[0] and open[0]<open[1] and open[0]>close[1] and open[0]==high[0] and close[0]==low[0] and close[0]>=low[1] ? OnThreeStarsInTheSouth : na
//Stick Sandwich
stick_sandwich = open[2]>close[2] and open[1]>close[2] and open[1]<close[1] and open[0]>close[1] and open[0]>close[0] and close[0]==close[2] ? OnStickSandwich : na
//Meeting Line
bullish_ml = open[2]>close[2] and open[1]>close[1] and close[1]==close[0] and open[0]<close[0] and open[1]>=high[0] ? OnMeetingLine : na
bearish_ml = open[2]<close[2] and open[1]<close[1] and close[1]==close[0] and open[0]>close[0] and open[1]<=low[0] ? OnMeetingLine : na
//Kicking
bullish_kicking = open[1]>close[1] and open[1]==high[1] and close[1]==low[1] and open[0]>open[1] and open[0]==low[0] and close[0]==high[0] and close[0]-open[0]>open[1]-close[1] ? OnKicking : na
bearish_kicking = open[1]<close[1] and open[1]==low[1] and close[1]==high[1] and open[0]<open[1] and open[0]==high[0] and close[0]==low[0] and open[0]-close[0]>close[1]-open[1] ? OnKicking : na
//Ladder Bottom
ladder_bottom = open[4]>close[4] and open[3]>close[3] and open[3]<open[4] and open[2]>close[2] and open[2]<open[3] and open[1]>close[1] and open[1]<open[2] and open[0]<close[0] and open[0]>open[1] and low[4]>low[3] and low[3]>low[2] and low[2]>low[1] ? OnLadderBottom : na
// ---Plotting ---
plotshape(bullish_engulfing, text='Engulfing', style=shape.triangleup, color=#1FADA2, editable=true, title="Bullish Engulfing Text")
plotshape(bearish_engulfing,text='Engulfing', style=shape.triangledown, color=#F35A54, editable=true, title="Bearish Engulfing Text")
plotshape(bullish_harami,text='Harami', style=shape.triangleup, color=#1FADA2, editable=true, title="Bullish Harami Text")
plotshape(bearish_harami,text='Harami', style=shape.triangledown, color=#F35A54, editable=true, title="BEarish Harami Text")
plotshape(piercing_line,text='Piercing Line', style=shape.triangleup, color=#1FADA2, editable=false)
plotshape(dark_cloud_cover,text='Dark Cloud Cover', style=shape.triangledown, color=#F35A54, editable=false)
plotshape(morning_star,text='Morning Star', style=shape.triangleup, color=#1FADA2, editable=false)
plotshape(evening_star,text='Evening Star', style=shape.triangledown, color=#F35A54, editable=false)
plotshape(bullish_belt_hold,text='Belt Hold', style=shape.triangleup, color=#1FADA2, editable=false)
plotshape(bearish_belt_hold,text='Belt Hold', style=shape.triangledown, color=#F35A54, editable=false)
plotshape(three_white_soldiers,text='Three White Soldiers', style=shape.triangleup, color=#1FADA2, editable=false)
plotshape(three_black_crows,text='Three Black Crows', style=shape.triangledown, color=#F35A54, editable=false)
plotshape(three_stars_in_the_south,text='3 Stars South', style=shape.triangleup, color=#1FADA2, editable=false)
plotshape(stick_sandwich,text='Stick Sandwich', style=shape.triangleup, color=#1FADA2, editable=false)
plotshape(bullish_ml,text='Meeting Line', style=shape.triangleup, color=#1FADA2, editable=false)
plotshape(bearish_ml,text='Meeting Line', style=shape.triangledown, color=#F35A54, editable=false)
plotshape(bullish_kicking,text='Kicking', style=shape.triangleup, color=#1FADA2, editable=false)
plotshape(bearish_kicking,text='Kicking', style=shape.triangledown, color=#F35A54, editable=false)
plotshape(ladder_bottom,text='Ladder Bottom', style=shape.triangleup, color=#1FADA2, editable=false)
// --- STRATEGY ---
SignalUp = bullish_engulfing or bullish_harami or piercing_line or morning_star or bullish_belt_hold or three_white_soldiers or three_stars_in_the_south or stick_sandwich or bullish_ml or bullish_kicking or ladder_bottom
SignalDown = bearish_engulfing or bearish_harami or dark_cloud_cover or evening_star or bearish_belt_hold or three_black_crows or bearish_ml or bearish_kicking
strategy.entry("long", true, when = SignalUp and session_open)
strategy.entry("short", false, when = SignalDown and session_open)
strategy.close("long", when = not session_open)
strategy.close("short", when = not session_open)
strategy.exit("Risk Exit long", from_entry = "long", profit = tp, trail_points = trail, loss = sl)
strategy.exit("Risk Exit short", from_entry = "short", profit = tp, trail_points = trail, loss = sl )