कैंडलस्टिक पैटर्न रणनीति

लेखक:चाओझांग, दिनांकः 2024-01-18 15:14:13
टैगः

img

अवलोकन

यह रणनीति कैंडलस्टिक चार्ट पर विभिन्न मूल्य पैटर्न संरचनाओं की पहचान करके खरीद और बिक्री संकेतों को निर्धारित करती है। रणनीति में तकनीकी विश्लेषण विधियां शामिल हैं जैसे कि चैनलून और डाउ थ्योरी, बाजार में मोड़ बिंदुओं को पकड़ने के लिए एक दर्जन से अधिक सामान्य ग्राफिक पैटर्न का उपयोग करना।

रणनीतिक सिद्धांत

इस रणनीति का मूल विभिन्न मोमबत्तियों के पैटर्न को पहचानने में निहित है, जिसमें निगलने वाली रेखाएं, हरामियों की रेखाएं, छेदने वाली रेखाएं, सुबह के सितारे आदि शामिल हैं। जब एक तेजी का पैटर्न पहचाना जाता है, तो एक खरीद संकेत उत्पन्न होता है; जब एक मंदी का पैटर्न पता लगाया जाता है, तो एक बिक्री संकेत ट्रिगर किया जाता है।

उदाहरण के लिए, जब तीन सफेद सैनिकों के पैटर्न को पहचाना जाता है, तो इसका मतलब है कि अंतिम तीन मोमबत्तियां सभी लंबी हरी मोमबत्तियां हैं, और प्रत्येक मोमबत्ती का समापन मूल्य इसकी शुरुआती कीमत से अधिक है, यह दर्शाता है कि मजबूत खरीद कीमत को ऊपर धकेल रही है, इसलिए एक खरीद संकेत उत्पन्न होता है।

प्रत्येक पैटर्न की पहचान करने के लिए एक विशिष्ट एल्गोरिथ्म होता है। रणनीति ऐतिहासिक मोमबत्तियों के माध्यम से स्कैन करती है, यह देखते हुए कि क्या प्रत्येक पट्टी एक निश्चित पैटर्न के फॉर्मूलेशन एल्गोरिथ्म को पूरा करती है, और एक बार ऐसा करने के बाद, उस पट्टी पर उस संकेत को चिह्नित करने वाले ग्राफिक मार्कर को प्लॉट करती है।

लाभ

  1. विभिन्न पैटर्नों के निर्णयों का संयोजन जीत की दर में सुधार करता है
  2. मैन्युअल हस्तक्षेप के बिना स्वचालित रूप से पैटर्न पहचान
  3. विज़ुअलाइज़ेड मार्कर सहज ज्ञान देता है
  4. स्टॉप लॉस और ले लाभ को एकीकृत करके जोखिमों को नियंत्रित करना

जोखिम और अनुकूलन

  1. पैटर्न पहचान के लिए विफलता की संभावना अभी भी मौजूद है
  2. प्रति व्यापार हानि को कम करने के लिए स्टॉप लॉस अनुपात को ठीक से समायोजित करें
  3. विपरीत पैटर्न से बचने के लिए प्रवृत्ति निर्णय जोड़ना
  4. रात भर के जोखिमों को समाप्त करने के लिए सत्र सेटिंग को अनुकूलित करें

अनुकूलन के सुझाव

  1. अधिक सहायक पैटर्न निर्णय शामिल करें
  2. प्रवेश संकेतों के लिए प्रवृत्ति संकेतक फ़िल्टर जोड़ें
  3. स्टॉप लॉस और लाभ लेने के अनुपात को अनुकूलित करें
  4. पैटर्न पहचानने के लिए मशीन सीखने के तरीकों की कोशिश करें
  5. स्थिति आकार नियंत्रण जोड़ें

सारांश

यह रणनीति तकनीकी उपकरणों का उपयोग करके कैंडलस्टिक बार पर बने ग्राफिक पैटर्न का विश्लेषण करके भविष्य के बाजार की चाल को निर्धारित करती है। यह रणनीति उपयोग करने के लिए व्यावहारिक है, लेकिन व्यापारियों को अभी भी सामान्य बाजार वातावरण को ध्यान में रखने की आवश्यकता है, स्थानीय आकारों के कारण प्रमुख रुझानों को याद करने से बचने के लिए। आगे के अनुकूलन द्वारा, यह रणनीति की स्थिरता और लाभप्रदता को बढ़ाने का वादा करता है।


/*backtest
start: 2024-01-10 00:00:00
end: 2024-01-17 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy("Candle Patterns Strategy", shorttitle="CPS", overlay=true)

//--- Patterns Input ---

OnEngulfing = input(defval=true, title="Engulfing", type=bool)
OnHarami = input(defval=true, title="Harami", type=bool)
OnPiercingLine = input(defval=true, title="Piercing Line / Dark Cloud Cover", type=bool)
OnMorningStar = input(defval=true, title="Morning Star / Evening Star ", type=bool)
OnBeltHold = input(defval=true, title="Belt Hold", type=bool)
OnThreeWhiteSoldiers = input(defval=true, title="Three White Soldiers / Three Black Crows", type=bool)
OnThreeStarsInTheSouth = input(defval=true, title="Three Stars in the South", type=bool)
OnStickSandwich = input(defval=true, title="Stick Sandwich", type=bool)
OnMeetingLine = input(defval=true, title="Meeting Line", type=bool)
OnKicking = input(defval=true, title="Kicking", type=bool)
OnLadderBottom = input(defval=true, title="Ladder Bottom", type=bool)

//--- Risk Management Input ---

inpsl = input(defval = 70, title="Stop Loss", minval = 0)
inptp = input(defval = 1000, title="Take Profit", minval = 0)
inptrail = input(defval = 30, 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(timeframe.period, sess)
session_open = 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 )

अधिक