
এই কৌশলটি হল একটি পরিমাণগত ট্রেডিং সিস্টেম যা দুটি ক্লাসিক কে-লাইন ফর্মের উপর ভিত্তি করে: হাতুড়ি এবং হ্যাঙ্গিং ম্যান। কৌশলগুলি বাজারে এই বিপরীত প্যাটার্নগুলিকে চিহ্নিত করে মূল্য কর্মের সম্ভাব্য টার্নিং পয়েন্টের পূর্বাভাস দেয়। সিস্টেমটি সিগন্যালের বৈধতা নিশ্চিত করতে একাধিক প্রযুক্তিগত সূচককে একত্রিত করে, যার মধ্যে কে-লাইন সত্তা এবং ছায়া রেখার মধ্যে আনুপাতিক সম্পর্ক, প্রবণতা দিক এবং অন্যান্য কারণগুলি, বাজারের বিপরীত বিন্দুর সঠিক ক্যাপচার অর্জনের জন্য।
কৌশলটির মূল যুক্তি হল একটি প্রোগ্রাম্যাটিক পদ্ধতির মাধ্যমে দুটি মূল কে-লাইন প্যাটার্ন সনাক্ত করা:
কৌশলগুলি কঠোর পরামিতি সেট করে এই নিদর্শনগুলিকে পরিমাপ করে, যার মধ্যে রয়েছে:
এই কৌশলটি পরিমাণগত পদ্ধতির মাধ্যমে ক্লাসিক প্রযুক্তিগত বিশ্লেষণ তত্ত্বের পদ্ধতিগত প্রয়োগ উপলব্ধি করে এবং এর শক্তিশালী ব্যবহারিক মূল্য রয়েছে। প্যারামিটার অপ্টিমাইজেশন এবং ঝুঁকি নিয়ন্ত্রণ প্রক্রিয়ার উন্নতির মাধ্যমে, কৌশলগুলি বিভিন্ন বাজার পরিবেশে স্থিতিশীল কর্মক্ষমতা বজায় রাখতে পারে। কৌশলটির মডুলার ডিজাইন পরবর্তী অপ্টিমাইজেশনের জন্য একটি ভাল ভিত্তি প্রদান করে।
/*backtest
start: 2024-12-10 00:00:00
end: 2025-01-08 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=6
strategy("Hammer and Hanging Man Strategy", overlay=true)
// Input parameters
length = input.int(5, title="Minimum Candle Body Length (Multiplier)", minval=1)
shadowRatio = input.float(1, title="Lower Shadow to Candle Height Ratio", minval=1.0)
holdPeriods = input.int(26, title="Hold Periods (Bars)", minval=1) // Holding period in bars
// Function to calculate the absolute value
absValue(x) =>
x >= 0 ? x : -x
// Function to check if it is a Hammer
isHammer() =>
bodyLength = absValue(close - open)
candleHeight = high - low
lowerShadow = math.min(open, close) - low
upperShadow = high - math.max(open, close)
smallBody = bodyLength <= candleHeight / length
longLowerShadow = lowerShadow >= bodyLength * shadowRatio
shortUpperShadow = upperShadow <= bodyLength
smallBody and longLowerShadow and shortUpperShadow and close > open
// Function to check if it is a Hanging Man
isHangingMan() =>
bodyLength = absValue(close - open)
candleHeight = high - low
lowerShadow = math.min(open, close) - low
upperShadow = high - math.max(open, close)
smallBody = bodyLength <= candleHeight / length
longLowerShadow = lowerShadow >= bodyLength * shadowRatio
shortUpperShadow = upperShadow <= bodyLength
smallBody and longLowerShadow and shortUpperShadow and close < open
// Detect the candles
hammer = isHammer()
hangingMan = isHangingMan()
// Trading logic: Long on Hammer, Short on Hanging Man
if hammer
strategy.entry("Long", strategy.long) // Long entry on Hammer
if hangingMan
strategy.entry("Short", strategy.short) // Short entry on Hanging Man
// Exit after X bars
if strategy.position_size > 0 and bar_index - strategy.opentrades.entry_bar_index(0) >= holdPeriods
strategy.close("Long")
if strategy.position_size < 0 and bar_index - strategy.opentrades.entry_bar_index(0) >= holdPeriods
strategy.close("Short")
// Visualization of signals
plotshape(hammer, title="Hammer", location=location.belowbar, color=color.green, style=shape.labelup, text="Hammer")
plotshape(hangingMan, title="Hanging Man", location=location.abovebar, color=color.red, style=shape.labeldown, text="Hanging Man")