
Die Strategie ist ein multidimensionales Momentum-Trading-System, das die Transaktions-Energie-Indikator (OBV), den Moving Average (SMA) und den relativ starken RSI (RSI) kombiniert. Die Strategie erfasst die Marktbewegung durch die Überwachung der Kreuzung des OBV mit seinem Moving Average, während die RSI-Indikator zur Filterung genutzt wird, um eine übermäßige Verfolgung zu vermeiden. Die Strategie integriert auch eine prozentuale Stop-Loss- und Profit-End-Mechanik, um ein ausgewogenes Risikomanagement zu erzielen.
Die Strategie basiert auf drei Dimensionen:
Die Strategie verwendet ein festes Prozentsatz Stop-Loss (~ 2%) und Gewinnziel (~ 4%), und dieses symmetrische Risikomanagement-Framework hilft, ein stabiles Gewinn-Risiko-Verhältnis zu halten.
Es handelt sich um eine vernünftige, multidimensionale, dynamische Handelsstrategie, die durch die Kombination der Vorteile technischer Indikatoren ein vollständiges Handelssystem aufbaut. Die Kernvorteile der Strategie liegen in ihren mehrschichtigen Signalbestätigungsmechanismen und dem normierten Risikomanagement-Framework. Obwohl einige potenzielle Risiken bestehen, kann die Stabilität und Anpassungsfähigkeit der Strategie durch die empfohlene Optimierungsrichtung weiter verbessert werden. Der praktische Wert der Strategie zeigt sich hauptsächlich in der Logik, der Einfachheit der Implementierung und Wartung.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-28 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("OBV Strategy with SMA, RSI, SL and TP (Improved Visualization)", overlay=true)
// حساب OBV يدويًا
obv = ta.cum(math.sign(close - close[1]) * volume)
// إعداد المتوسط المتحرك البسيط لـ OBV
lengthOBV = input(20, title="OBV SMA Length")
obvSMA = ta.sma(obv, lengthOBV)
// إعداد مؤشر RSI
lengthRSI = input(14, title="RSI Length")
rsi = ta.rsi(close, lengthRSI)
// إعدادات وقف الخسارة وجني الأرباح
stopLossPerc = input(2.0, title="Stop Loss %") / 100 // 2% وقف خسارة
takeProfitPerc = input(4.0, title="Take Profit %") / 100 // 4% جني أرباح
// حساب مستوى وقف الخسارة وجني الأرباح
longStopLoss = close * (1 - stopLossPerc)
longTakeProfit = close * (1 + takeProfitPerc)
shortStopLoss = close * (1 + stopLossPerc)
shortTakeProfit = close * (1 - takeProfitPerc)
// إعداد شروط الشراء
longCondition = ta.crossover(obv, obvSMA) and rsi < 70
if (longCondition)
strategy.entry("Buy", strategy.long)
strategy.exit("Take Profit/Stop Loss", "Buy", stop=longStopLoss, limit=longTakeProfit)
// إعداد شروط البيع
shortCondition = ta.crossunder(obv, obvSMA) and rsi > 30
if (shortCondition)
strategy.entry("Sell", strategy.short)
strategy.exit("Take Profit/Stop Loss", "Sell", stop=shortStopLoss, limit=shortTakeProfit)
// رسم OBV والمؤشرات الأخرى على الرسم البياني
plot(obv, title="OBV", color=color.blue, linewidth=2) // رسم OBV بخط أزرق عريض
plot(obvSMA, title="OBV SMA", color=color.orange, linewidth=2) // رسم SMA بخط برتقالي
// رسم إشارات الشراء والبيع على الرسم البياني
plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// رسم RSI في نافذة منفصلة بوضوح أكبر
hline(70, "RSI Overbought", color=color.red, linestyle=hline.style_dashed)
hline(30, "RSI Oversold", color=color.green, linestyle=hline.style_dashed)
plot(rsi, title="RSI", color=color.purple, linewidth=2)
// إضافة منطقة RSI بالألوان
bgcolor(rsi > 70 ? color.new(color.red, 90) : rsi < 30 ? color.new(color.green, 90) : na)