
এই কৌশলটি একটি স্বয়ংক্রিয় ট্রেডিং সিস্টেম যা কে-লাইন মোড সনাক্তকরণের উপর ভিত্তি করে। এটি দশটি ক্লাসিক কে-লাইন মোডকে একত্রিত করে, যার মধ্যে পাঁচটি উর্ধ্বমুখী মোড ((কুকুরের লাইন, মাল্টি-হেড গ্রাস, পিন্টার লাইন, মর্নিং স্টার এবং তিন সাদা সৈনিক) এবং পাঁচটি পতনশীল মোড ((উপরের লাইন, উড়োজাহাজের গ্রাস, মেঘাচ্ছন্ন, ডাইভিং স্টার এবং তিন কালো সৈনিক)) । কৌশলটি এই মোডগুলির রিয়েল-টাইম সনাক্তকরণ এবং বিশ্লেষণের মাধ্যমে ব্যবসায়ীদের সম্ভাব্য বাজার বিপরীত সংকেত এবং ব্যবসায়ের সুযোগ সরবরাহ করে।
কৌশলটির মূল বিষয় হল বিভিন্ন K-লাইন আকৃতির সঠিক সনাক্তকরণের জন্য প্রোগ্রামিং করা। প্রতিটি আকৃতির নিজস্ব গাণিতিক সংজ্ঞা এবং শর্তাদি রয়েছেঃ
এটি একটি যুক্তিসঙ্গত, যুক্তিসঙ্গতভাবে নকশাকৃত K-লাইন মডেল ট্রেডিং কৌশল। এটি প্রচলিত প্রযুক্তিগত বিশ্লেষণে সর্বাধিক ব্যবহৃত কে-লাইন মডেলের বিচারকে প্রোগ্রামিং পদ্ধতিতে বাস্তবায়ন করে, ব্যবসায়ীদের জন্য একটি উদ্দেশ্যমূলক, পদ্ধতিগত ট্রেডিং সরঞ্জাম সরবরাহ করে। যদিও কিছু অন্তর্নিহিত সীমাবদ্ধতা রয়েছে, তবে যথাযথ অপ্টিমাইজেশন এবং অন্যান্য প্রযুক্তিগত সরঞ্জামগুলির সাথে সমন্বয় করে, কৌশলটি ট্রেডিং সিদ্ধান্তের জন্য মূল্যবান রেফারেন্স সংকেত সরবরাহ করতে পারে। কৌশলটির মডিউল ডিজাইনটি পরবর্তী কার্যকারিতা প্রসারিত এবং কার্যকারিতা অপ্টিমাইজেশনের জন্য একটি ভাল ভিত্তি সরবরাহ করে।
/*backtest
start: 2024-11-10 00:00:00
end: 2024-12-09 08:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
// Author: Raymond Ngobeni
strategy('Candlestick Pattern Strategy [Ubaton]', 'Ubaton - Candlestick Pattern Strategy', overlay = true, max_labels_count = 500, max_lines_count = 500, max_boxes_count = 500)
// User Inputs: Enable/Disable Patterns
// Bullish Patterns
enableHammer = input.bool(true, "Show Hammer")
enableBullEngulfing = input.bool(true, "Show Bullish Engulfing")
enablePiercingLine = input.bool(true, "Show Piercing Line")
enableMorningStar = input.bool(true, "Show Morning Star")
enableThreeWhiteSoldiers = input.bool(true, "Show Three White Soldiers")
// Bearish Patterns
enableHangingMan = input.bool(true, "Show Hanging Man")
enableBearEngulfing = input.bool(true, "Show Bearish Engulfing")
enableDarkCloudCover = input.bool(true, "Show Dark Cloud Cover")
enableEveningStar = input.bool(true, "Show Evening Star")
enableThreeBlackCrows = input.bool(true, "Show Three Black Crows")
// Helper Functions
isHammer() =>
bodySize = math.abs(open - close)
shadowSize = low < math.min(open, close) ? math.min(open, close) - low : na
shadowSize >= 2 * bodySize and high - math.max(open, close) <= bodySize
isBullishEngulfing() =>
close[1] < open[1] and close > open and open <= close[1] and close >= open[1]
isPiercingLine() =>
close[1] < open[1] and close > close[1] + (open[1] - close[1]) * 0.5 and close < open[1]
isMorningStar() =>
close[2] < open[2] and math.abs(close[1] - open[1]) < (high[1] - low[1]) * 0.3 and close > open
isThreeWhiteSoldiers() =>
close > open and close[1] > open[1] and close[2] > open[2] and open > close[1] and open[1] > close[2]
isHangingMan() =>
bodySize = math.abs(open - close)
shadowSize = low < math.min(open, close) ? math.min(open, close) - low : na
shadowSize >= 2 * bodySize and high - math.max(open, close) <= bodySize and close < open
isBearishEngulfing() =>
close[1] > open[1] and close < open and open >= close[1] and close <= open[1]
isDarkCloudCover() =>
close[1] > open[1] and open > close[1] and close < open[1] and close < close[1] + (open[1] - close[1]) * 0.5
isEveningStar() =>
close[2] > open[2] and math.abs(close[1] - open[1]) < (high[1] - low[1]) * 0.3 and close < open
isThreeBlackCrows() =>
close < open and close[1] < open[1] and close[2] < open[2] and open < close[1] and open[1] < close[2]
// Detect Patterns
// Bullish
hammerDetected = enableHammer and isHammer()
bullEngulfDetected = enableBullEngulfing and isBullishEngulfing()
piercingDetected = enablePiercingLine and isPiercingLine()
morningStarDetected = enableMorningStar and isMorningStar()
threeWhiteDetected = enableThreeWhiteSoldiers and isThreeWhiteSoldiers()
// Bearish
hangingManDetected = enableHangingMan and isHangingMan()
bearEngulfDetected = enableBearEngulfing and isBearishEngulfing()
darkCloudDetected = enableDarkCloudCover and isDarkCloudCover()
eveningStarDetected = enableEveningStar and isEveningStar()
threeBlackDetected = enableThreeBlackCrows and isThreeBlackCrows()
// Plot Bullish Patterns
plotshape(enableHammer and hammerDetected, title="Hammer", location=location.belowbar, color=color.green, style=shape.labelup, text="Hammer")
plotshape(enableBullEngulfing and bullEngulfDetected, title="Bullish Engulfing", location=location.belowbar, color=color.green, style=shape.labelup, text="Engulf")
plotshape(enablePiercingLine and piercingDetected, title="Piercing Line", location=location.belowbar, color=color.green, style=shape.labelup, text="Piercing")
plotshape(enableMorningStar and morningStarDetected, title="Morning Star", location=location.belowbar, color=color.green, style=shape.labelup, text="Morning")
plotshape(enableThreeWhiteSoldiers and threeWhiteDetected, title="Three White Soldiers", location=location.belowbar, color=color.green, style=shape.labelup, text="3 Soldiers")
// Plot Bearish Patterns
plotshape(enableHangingMan and hangingManDetected, title="Hanging Man", location=location.abovebar, color=color.red, style=shape.labeldown, text="Hanging")
plotshape(enableBearEngulfing and bearEngulfDetected, title="Bearish Engulfing", location=location.abovebar, color=color.red, style=shape.labeldown, text="Engulf")
plotshape(enableDarkCloudCover and darkCloudDetected, title="Dark Cloud Cover", location=location.abovebar, color=color.red, style=shape.labeldown, text="Dark Cloud")
plotshape(enableEveningStar and eveningStarDetected, title="Evening Star", location=location.abovebar, color=color.red, style=shape.labeldown, text="Evening")
plotshape(enableThreeBlackCrows and threeBlackDetected, title="Three Black Crows", location=location.abovebar, color=color.red, style=shape.labeldown, text="3 Crows")
// Strategy Execution
if hammerDetected or bullEngulfDetected or piercingDetected or morningStarDetected or threeWhiteDetected
strategy.entry("Bullish Entry", strategy.long)
if hangingManDetected or bearEngulfDetected or darkCloudDetected or eveningStarDetected or threeBlackDetected
strategy.entry("Bearish Entry", strategy.short)