
یہ حکمت عملی ایک مقداری تجارتی حکمت عملی ہے جو ٹرینڈ ٹریکنگ اور ٹائم ایگزٹ میکانزم کو یکجا کرتی ہے۔ اس حکمت عملی کا بنیادی مقصد قیمت اور 60 دن کی موونگ ایوریج کے درمیان تعلق کو دیکھ کر مارکیٹ کے رجحانات کو پکڑنا ہے، جبکہ خطرات کو کنٹرول کرنے کے لیے سال کے آخر میں جبری لیکویڈیشن میکانزم کو متعارف کرانا ہے۔ جب اختتامی قیمت 60 دن کی موونگ ایوریج سے ٹوٹ جاتی ہے اور موونگ ایوریج کی ڈھلوان مثبت ہوتی ہے، تو لمبا سفر کرنے کے لیے مارکیٹ میں داخل ہوں، اور ہر سال کے آخری تجارتی دن تمام پوزیشنز کو بند کر دیں۔
حکمت عملی درج ذیل بنیادی عناصر پر مبنی ہے:
یہ حکمت عملی رجحان کی پیروی اور ٹائم مینجمنٹ کو ملا کر ایک نسبتاً مضبوط تجارتی نظام بناتی ہے۔ حکمت عملی کی منطق سادہ اور واضح، سمجھنے اور نافذ کرنے میں آسان ہے، اور اس میں اچھی عملییت ہے۔ معقول پیرامیٹر کی اصلاح اور رسک کنٹرول اقدامات کی تکمیل کے ذریعے، اس حکمت عملی سے حقیقی لین دین میں مستحکم منافع حاصل کرنے کی امید ہے۔
/*backtest
start: 2025-01-09 00:00:00
end: 2025-01-16 00:00:00
period: 3m
basePeriod: 3m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=5
strategy("Buy above 60-day MA, Sell at year-end", overlay=true, pyramiding=1)
// Define inputs for start and end dates
startDate = input(defval=timestamp("2010-01-01"), title="Start Date")
endDate = input(defval=timestamp("2024-12-31"), title="End Date")
// Define 60-day moving average
length = input.int(defval=60, title="MA Length", minval=1)
ma = ta.sma(close, length)
slope = ta.sma(ma, 14) - ta.sma(ma, 14)[1]
// Check if current bar is within the specified date range
withinDateRange = true
// Function to check if a day is a trading day (Monday to Friday)
isTradingDay(day) => true
// Check if current bar is the last trading day of the year
// Check if current bar is the last trading day of the year
isLastTradingDayOfYear = false
yearNow = year(time)
if (month == 12 and dayofmonth == 31)
isLastTradingDayOfYear := isTradingDay(time)
else if (month == 12 and dayofmonth == 30)
isLastTradingDayOfYear := isTradingDay(time) and not isTradingDay(time + 86400000)
else if (month == 12 and dayofmonth == 29)
isLastTradingDayOfYear := isTradingDay(time) and not isTradingDay(time + 86400000) and not isTradingDay(time + 86400000 * 2)
// Plot moving average
plot(ma, color=color.blue, linewidth=2)
// Buy when closing price crosses above 60-day MA and up trend
if (withinDateRange and ta.crossover(close, ma) and slope > 0)
strategy.entry("Buy", strategy.long)
// Sell all positions at the last trading day of the year
if (isLastTradingDayOfYear)
strategy.close_all(comment="Sell at year-end")
// Plot buy and sell signals
//plotshape(series=ta.crossover(close, ma), location=location.belowbar, color=color.green, style=shape.labelup, text="Buy")
//plotshape(series=isLastTradingDayOfYear, location=location.abovebar, color=color.red, style=shape.labeldown, text="Sell")