
یہ حکمت عملی MACD اشارے اور منتقل اوسط پر مبنی ایک کثیر ٹائم زون ٹریڈنگ سسٹم ہے۔ یہ 1 منٹ اور 3 منٹ کے دو ٹائم پیریڈ کے MACD اشارے کو جوڑتا ہے ، جبکہ 200 سیکنڈ ای ایم اے کو رجحان فلٹر کے طور پر استعمال کرتا ہے ، مارکیٹ کے رجحانات کی تسلسل کو پکڑ کر تجارت کرتا ہے۔ حکمت عملی میں رسک مینجمنٹ میکانزم شامل ہے ، جس میں اسٹاپ نقصان کی ترتیب اور متحرک ایڈجسٹمنٹ کی خصوصیات شامل ہیں۔
حکمت عملی کی بنیادی منطق درج ذیل کلیدی عناصر پر مبنی ہے:
مخصوص ٹریڈنگ سگنل جنریشن قواعد مندرجہ ذیل ہیں:
رسک کنٹرول کی تجاویز:
اس حکمت عملی نے کثیر وقتی مدت کے MACD اشارے اور EMA ٹرینڈ فلٹرز کے امتزاج کے ذریعہ ایک نسبتا complete مکمل تجارتی نظام تشکیل دیا ہے۔ اس کا فائدہ متعدد تصدیق کے میکانزم اور رسک مینجمنٹ کی سالمیت پر ہے ، لیکن اسی وقت مختلف مارکیٹ کے حالات میں موافقت کے مسائل پر بھی توجہ دینے کی ضرورت ہے۔ تجویز کردہ اصلاحی سمت کے ذریعہ ، حکمت عملی کو اس کی استحکام کو برقرار رکھتے ہوئے اس کی آمدنی کی صلاحیت کو مزید بڑھانے کی امید ہے۔
/*backtest
start: 2025-02-13 00:00:00
end: 2025-02-15 02:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("NQ MACD Continuation Backtest", overlay=true)
// MACD Settings
fastLength = 12
slowLength = 26
signalLength = 9
// 1-minute MACD
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalLength)
// 3-minute MACD for trend filter
[htfMacd, htfSignal, _] = request.security(syminfo.tickerid, "3", ta.macd(close, fastLength, slowLength, signalLength), lookahead=barmerge.lookahead_on)
// 200 EMA
ema200 = ta.ema(close, 200)
// Time Filters
inSession = (hour(time, "America/New_York") >= 9 and (hour(time, "America/New_York") > 9 or minute(time, "America/New_York") >= 45)) and (hour(time, "America/New_York") < 22 or (hour(time, "America/New_York") == 22 and minute(time, "America/New_York") == 30))
notRestricted = (hour(time, "America/New_York") >= 6 and hour(time, "America/New_York") < 22)
// Track Previous MACD Crosses
var bool bullishCrossed = false
var bool bearishCrossed = false
if (ta.crossover(macdLine, signalLine) and macdLine > 0)
bullishCrossed := true
if (ta.crossunder(macdLine, signalLine) and macdLine < 0)
bearishCrossed := true
// Define Continuation Signals with EMA and 3-Min MACD Filter
bullishContinuation = (ta.crossover(macdLine, signalLine) and macdLine > 0 and signalLine > 0 and htfMacd > htfSignal and bullishCrossed and close > ema200)
bearishContinuation = (ta.crossunder(macdLine, signalLine) and macdLine < 0 and signalLine < 0 and htfMacd < htfSignal and bearishCrossed and close < ema200)
// Entry Conditions with SL and 10 Contracts
if (bullishContinuation and inSession and notRestricted)
strategy.entry("Long", strategy.long, qty=10, stop=close - 7 * syminfo.mintick)
if (bearishContinuation and inSession and notRestricted)
strategy.entry("Short", strategy.short, qty=10, stop=close + 7 * syminfo.mintick)
// Break-Even Adjustment
if (strategy.position_size > 0 and close >= strategy.position_avg_price + 5 * syminfo.mintick)
strategy.exit("BreakEvenLong", from_entry="Long", stop=strategy.position_avg_price)
if (strategy.position_size < 0 and close <= strategy.position_avg_price - 5 * syminfo.mintick)
strategy.exit("BreakEvenShort", from_entry="Short", stop=strategy.position_avg_price)
// Display Indicators on Chart
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
plot(ema200, color=color.red, title="200 EMA")