
یہ حکمت عملی ایک مقداری تجارتی نظام ہے جس کی بنیاد دو کلاسک کینڈل سٹک پیٹرن پر ہے: ہیمر لائن اور ہینگنگ مین۔ حکمت عملی مارکیٹ میں ان الٹ پیٹرن کی نشاندہی کرکے قیمت کی کارروائی میں ممکنہ موڑ کی پیشین گوئی کرتی ہے۔ یہ نظام سگنل کی درستگی کی تصدیق کے لیے متعدد تکنیکی اشاریوں کو یکجا کرتا ہے، بشمول K-line باڈی اور شیڈو کے درمیان متناسب تعلق، رجحان کی سمت اور دیگر عوامل، تاکہ مارکیٹ کے الٹ پلٹ پوائنٹس کی درست گرفت حاصل کی جا سکے۔
حکمت عملی کی بنیادی منطق یہ ہے کہ دو کلیدی موم بتی کے نمونوں کو پروگرامی طریقے سے شناخت کیا جائے:
حکمت عملی سخت پیرامیٹرز ترتیب دے کر ان نمونوں کی مقدار درست کرتی ہے، بشمول:
یہ حکمت عملی مقداری طریقوں کے ذریعے کلاسیکی تکنیکی تجزیہ تھیوری کے منظم اطلاق کو سمجھتی ہے اور اس کی مضبوط عملی قدر ہے۔ پیرامیٹرز کو بہتر بنانے اور رسک کنٹرول میکانزم کو بہتر بنا کر، حکمت عملی مختلف مارکیٹ کے ماحول میں مستحکم کارکردگی کو برقرار رکھ سکتی ہے۔ حکمت عملی کا ماڈیولر ڈیزائن بعد کی اصلاح کے لیے ایک اچھی بنیاد بھی فراہم کرتا ہے۔
/*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")