
یہ حکمت عملی ایک متحرک اسٹاپ نقصان کے طریقہ کار کے ساتھ مل کر ایک ٹرینڈ ٹریکنگ سسٹم ہے جو ایک سے زیادہ اشاریہ حرکت پذیر اوسط ((EMA) کراسنگ پر مبنی ہے۔ حکمت عملی میں 21 ، 50 اور 200 دوروں کی ٹرپل ای ایم اے کا استعمال کیا جاتا ہے ، جو قلیل مدتی اور درمیانی مدت کے ای ایم اے کے کراسنگ کے ذریعہ تجارتی سگنل تیار کرتی ہے ، جبکہ طویل مدتی ای ایم اے کا استعمال کرتے ہوئے مجموعی رجحان کی سمت کی تصدیق کرتی ہے ، اور خطرے کو منظم کرنے کے لئے لچکدار اسٹاپ نقصانات کا تعین کرتی ہے۔ یہ حکمت عملی زیادہ اتار چڑھاؤ والے مارکیٹ کے ماحول کے لئے موزوں ہے ، خاص طور پر درمیانی مدت کے طویل مدتی رجحانات کے لئے۔
اس حکمت عملی کا بنیادی منطق تین ای ایم اے سسٹم کے تعاون پر مبنی ہے:
اس حکمت عملی میں مارکیٹ کے رجحانات کو مؤثر طریقے سے پکڑنے کے لئے متعدد ای ایم اے سسٹم کے ہم آہنگی کے ذریعے کام کیا جاتا ہے۔ اس میں خطرہ مینجمنٹ کا ایک مکمل طریقہ کار اور واضح تجارتی منطق موجود ہے جس کی وجہ سے یہ ایک عملی تجارتی آلہ بن گیا ہے۔ مسلسل اصلاح اور بہتری کے ذریعہ ، حکمت عملی کو مختلف مارکیٹ کے ماحول کے مطابق بہتر طور پر ڈھال لیا جاسکتا ہے ، جس سے تجارت کی کارکردگی اور استحکام میں اضافہ ہوتا ہے۔ یہ تجویز کیا گیا ہے کہ تاجروں کو عملی طور پر استعمال کرنے سے پہلے کافی حد تک بیک اپ اور پیرامیٹرز کی اصلاح کی جائے ، اور مارکیٹ کی خصوصیات اور ذاتی خطرے کی ترجیحات کے ساتھ مل کر مناسب ایڈجسٹمنٹ کی جائے۔
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-17 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA Crossover with SL and TP Levels", overlay=true)
// Input settings for stop loss and take profit
slTicks = input.int(50, title="Stop Loss (ticks)", minval=1)
tpTicks = input.int(100, title="Take Profit (ticks)", minval=1)
// Input settings for moving averages
shortMAPeriod = input.int(21, title="Short MA Period")
longMAPeriod = input.int(50, title="Long MA Period")
thirdMAPeriod = input.int(200, title="Third MA Period")
// Calculate moving averages
shortMA = ta.ema(close, shortMAPeriod) // Short EMA (21-period)
longMA = ta.ema(close, longMAPeriod) // Long EMA (50-period)
thirdMA = ta.ema(close, thirdMAPeriod) // Third EMA (200-period)
// Detect crossovers for entry signals
bullishCross = ta.crossover(shortMA, longMA) and close > thirdMA
bearishCross = ta.crossunder(shortMA, longMA) and close < thirdMA
// Initialize variables for SL and TP
var float longSL = na
var float longTP = na
var float shortSL = na
var float shortTP = na
// Execute trades based on crossovers
if (bullishCross)
longSL := close - slTicks * syminfo.mintick
longTP := close + tpTicks * syminfo.mintick
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=longSL, limit=longTP)
if (bearishCross)
shortSL := close + slTicks * syminfo.mintick
shortTP := close - tpTicks * syminfo.mintick
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=shortSL, limit=shortTP)
// Plot the MAs
plot(shortMA, color=color.green, linewidth=2, title="21-period EMA")
plot(longMA, color=color.red, linewidth=2, title="50-period EMA")
plot(thirdMA, color=color.blue, linewidth=2, title="200-period EMA")
// Plot buy/sell signals
plotshape(series=bullishCross, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", size=size.small, offset=-1)
plotshape(series=bearishCross, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", size=size.small, offset=-1)
// // Draw SL and TP lines for Long positions
// if (bullishCross)
// line.new(x1=bar_index, y1=longSL, x2=bar_index + 1, y2=longSL, color=color.red, width=2, style=line.style_dotted)
// line.new(x1=bar_index, y1=longTP, x2=bar_index + 1, y2=longTP, color=color.green, width=2, style=line.style_dotted)
// label.new(bar_index, longSL, text="Long SL", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
// label.new(bar_index, longTP, text="Long TP", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
// // Draw SL and TP lines for Short positions
// if (bearishCross)
// line.new(x1=bar_index, y1=shortSL, x2=bar_index + 1, y2=shortSL, color=color.red, width=2, style=line.style_dotted)
// line.new(x1=bar_index, y1=shortTP, x2=bar_index + 1, y2=shortTP, color=color.green, width=2, style=line.style_dotted)
// label.new(bar_index, shortSL, text="Short SL", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
// label.new(bar_index, shortTP, text="Short TP", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)