
یہ حکمت عملی ایک دو طرفہ تجارتی نظام ہے جو MACD متحرک اشارے اور EMA کی اوسط لائن کو جوڑتا ہے۔ یہ بنیادی طور پر MACD اشارے کے کراس سگنل اور قیمت کے EMA ((200) کے سلسلے میں پوزیشن پر مبنی ہے۔ حکمت عملی میں 2: 1 کا خطرہ / منافع کا تناسب استعمال کیا جاتا ہے ، جو 5 منٹ کے دورانیے پر چل سکتا ہے ، اور اس میں لچکدار پیرامیٹرز کی ایڈجسٹمنٹ کی حمایت کی جاتی ہے۔
حکمت عملی کی بنیادی منطق درج ذیل کلیدی شرائط پر مبنی ہے:
یہ ایک مناسب ڈیزائن شدہ حکمت عملی کا نظام ہے جو تکنیکی اشارے کے ساتھ مل کر نسبتا reliable قابل اعتماد تجارتی سگنل فراہم کرتا ہے۔ اگرچہ کچھ ممکنہ خطرات موجود ہیں ، لیکن مناسب اصلاح اور رسک مینجمنٹ کے ذریعہ ، اس حکمت عملی میں عملی جنگ میں اطلاق کے لئے اچھی صلاحیت موجود ہے۔ عملی استعمال سے پہلے بھرپور ریٹرننگ کی سفارش کی جاتی ہے ، اور پیرامیٹرز کو مخصوص مارکیٹ کی صورتحال کے مطابق ایڈجسٹ کیا جاتا ہے۔
/*backtest
start: 2025-02-12 00:00:00
end: 2025-02-19 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © @DieBartDie
//@version=5
strategy("Strategy with MACD and EMA", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Editable parameters
ema_length = input.int(200, title="EMA Length")
tp_ratio = input.float(2.0, title="Take Profit Ratio (%)") // Take Profit ratio
sl_ratio = input.float(1.0, title="Stop Loss Ratio (%)") // Stop Loss ratio
// MACD configuration
fast_length = input.int(12, title="MACD Fast Length")
slow_length = input.int(26, title="MACD Slow Length")
signal_length = input.int(9, title="MACD Signal Length")
// Operation type configuration
operation_type = input.string("Long & Short", title="Operation Type", options=["Long", "Short", "Long & Short"])
// Indicators
ema_200 = ta.ema(close, ema_length)
[macd, signal, _] = ta.macd(close, fast_length, slow_length, signal_length)
// Conditions for LONG entries
price_above_ema = close > ema_200
macd_above_signal = ta.crossover(macd, signal) // MACD crosses above the signal line
macd_below_zero = macd < 0
long_condition = price_above_ema and macd_above_signal and macd_below_zero
// Conditions for SHORT entries
price_below_ema = close < ema_200
macd_below_signal = ta.crossunder(macd, signal) // MACD crosses below the signal line
macd_above_zero = macd > 0
short_condition = price_below_ema and macd_below_signal and macd_above_zero
// Calculate Stop Loss and Take Profit
stop_loss_long = close * (1 - sl_ratio / 100)
take_profit_long = close * (1 + tp_ratio / 100)
stop_loss_short = close * (1 + sl_ratio / 100)
take_profit_short = close * (1 - tp_ratio / 100)
// Execute LONG position if conditions are met
if (operation_type == "Long" or operation_type == "Long & Short") and long_condition
strategy.entry("Long", strategy.long)
strategy.exit("Take Profit/Stop Loss", "Long", stop=stop_loss_long, limit=take_profit_long)
// Execute SHORT position if conditions are met
if (operation_type == "Short" or operation_type == "Long & Short") and short_condition
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit/Stop Loss", "Short", stop=stop_loss_short, limit=take_profit_short)
// Plot the EMA
plot(ema_200, color=color.orange, linewidth=2, title="EMA 200")