
یہ حکمت عملی ایک رجحان ٹریکنگ سسٹم ہے جس میں متعدد تکنیکی اشارے شامل ہیں ، جو ایک مکمل تجارتی فیصلہ سازی کا فریم ورک تشکیل دیتے ہیں ، جیسے کہ متحرک اوسط ((EMA) ، نسبتا strong مضبوط اشارے ((RSI) ، متحرک اوسط متغیر متغیر اشارے ((MACD) ، اور برلن بینڈ ((BB)) ۔ اس حکمت عملی میں متحرک رسک مینجمنٹ کا طریقہ کار استعمال کیا گیا ہے ، جس میں فیصد پر مبنی اسٹاپ نقصانات اور رسک پر مبنی منافع کے مقابلے میں اسٹاپ سیٹنگ شامل ہیں ، جس کا مقصد مستحکم اور صحت مند رسک ایڈجسٹمنٹ کے بعد منافع حاصل کرنا ہے۔
اس حکمت عملی کی بنیادی منطق مارکیٹ کے تجزیہ پر مبنی ہے جس میں کئی سطحیں ہیں:
اس حکمت عملی نے متعدد تکنیکی اشارے کے مربوط استعمال کے ذریعے ایک مکمل رجحان ٹریکنگ ٹریڈنگ سسٹم تشکیل دیا ہے۔ سخت رسک مینجمنٹ اور کثیر جہتی مارکیٹ تجزیہ کے ذریعہ ، حکمت عملی میں بہتر موافقت اور استحکام ہے۔ اگرچہ کچھ اصلاحات کی گنجائش موجود ہے ، لیکن مجموعی طور پر فریم ورک ڈیزائن معقول ہے اور درمیانی اور طویل مدتی تجارتی حکمت عملی کی بنیاد پر موزوں ہے۔ حکمت عملی کے کامیاب نفاذ کے لئے مسلسل نگرانی اور مختلف مارکیٹ کے حالات کے مطابق بروقت پیرامیٹرز کی ایڈجسٹمنٹ کی ضرورت ہے۔
/*backtest
start: 2025-01-10 00:00:00
end: 2025-02-09 00:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Altcoin Long/Short Strategy", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=200, commission_type=strategy.commission.percent, commission_value=0.1)
// —————— Inputs ——————
emaFastLength = input.int(20, "Fast EMA")
emaSlowLength = input.int(50, "Slow EMA")
rsiLength = input.int(14, "RSI Length")
bbLength = input.int(20, "Bollinger Bands Length")
riskRewardRatio = input.float(1.5, "Risk/Reward Ratio")
stopLossPerc = input.float(2, "Stop Loss %") / 100
// —————— Indicators ——————
// Trend: EMAs
emaFast = ta.ema(close, emaFastLength)
emaSlow = ta.ema(close, emaSlowLength)
ema200 = ta.ema(close, 200)
// Momentum: RSI & MACD
rsi = ta.rsi(close, rsiLength)
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
// Volatility: Bollinger Bands
basis = ta.sma(close, bbLength)
dev = ta.stdev(close, bbLength)
upperBand = basis + 2 * dev
lowerBand = basis - 2 * dev
// —————— Strategy Logic ——————
// Long Conditions
longCondition =
close > ema200 and // Long-term bullish
ta.crossover(emaFast, emaSlow) and // EMA crossover
rsi > 50 and // Momentum rising
close > lowerBand and // Bounce from lower Bollinger Band
macdLine > signalLine // MACD bullish
// Short Conditions
shortCondition =
close < ema200 and // Long-term bearish
ta.crossunder(emaFast, emaSlow) and // EMA crossunder
rsi < 50 and // Momentum weakening
close < upperBand and // Rejection from upper Bollinger Band
macdLine < signalLine // MACD bearish
// —————— Risk Management ——————
stopLoss = strategy.position_avg_price * (1 - stopLossPerc)
takeProfit = strategy.position_avg_price * (1 + (riskRewardRatio * stopLossPerc))
// —————— Execute Trades ——————
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=stopLoss, limit=takeProfit)
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=stopLoss, limit=takeProfit)
// —————— Plotting ——————
plot(emaFast, "Fast EMA", color=color.blue)
plot(emaSlow, "Slow EMA", color=color.orange)
plot(ema200, "200 EMA", color=color.gray)
plot(upperBand, "Upper Bollinger", color=color.red)
plot(lowerBand, "Lower Bollinger", color=color.green)