
この戦略は、相対力指数 (RSI)、移動平均 (MA)、ボリンジャーバンド (BB) という 3 つの主要なテクニカル指標を統合した定量取引システムです。この戦略は、複数のテクニカル指標の信号を総合的に分析し、市場のトレンドと変動の中で最適な取引機会を見つけます。この戦略は、MA20とMA50のゴールデンクロスとデッドクロスを使用して中期トレンドを判断し、RSIの買われすぎと売られすぎのシグナルとボリンジャーバンドの上限と下限のブレイクスルー回帰を組み合わせて、完全な取引決定を構築します。作成システム。
戦略の中核となるロジックは、次の 3 つの次元に基づいています。
ロング条件は同時に満たされる必要があります: RSI < 25 (売られすぎ) + MA20 > MA50 (上昇トレンド) + 価格 < ボリンジャーバンドの下方軌道 (売られすぎ) 空売り条件は、RSI>80(買われすぎ)+ MA20ボリンジャーバンドの上限トラック(上昇しすぎ)という条件を同時に満たす必要があります。
この戦略は、複数のテクニカル指標の協調的な連携を通じて、比較的完全な取引システムを構築します。この戦略はトレンドが明確な市場では良好なパフォーマンスを発揮しますが、市場環境の変化に注意し、それに応じた調整を行う必要があります。この戦略は継続的な最適化と改善を通じて、実際の取引で安定した収益を達成することが期待されます。
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-04 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("RSI + MA + BB30 Strategy", overlay=true)
// === Cài đặt RSI ===
rsiLength = input(14, title="RSI Length")
rsiOverbought = input(80, title="RSI Overbought Level")
rsiOversold = input(25, title="RSI Oversold Level")
rsi = ta.rsi(close, rsiLength)
// === Cài đặt MA ===
maLength20 = input(20, title="MA20 Length")
maLength50 = input(50, title="MA50 Length")
ma20 = ta.sma(close, maLength20)
ma50 = ta.sma(close, maLength50)
// === Cài đặt Bollinger Bands (BB30) ===
bbLength = input(30, title="Bollinger Bands Length")
bbStdDev = input(2, title="BB Standard Deviation")
[bbUpper, bbBasis, bbLower] = ta.bb(close, bbLength, bbStdDev)
// === Điều kiện giao dịch ===
// Điều kiện Long
longCondition = (rsi < rsiOversold) and (ma20 > ma50) and (close < bbLower)
// Điều kiện Short
shortCondition = (rsi > rsiOverbought) and (ma20 < ma50) and (close > bbUpper)
// === Mở lệnh giao dịch ===
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// === Hiển thị chỉ báo trên biểu đồ ===
// Hiển thị MA
plot(ma20, color=color.blue, title="MA20")
plot(ma50, color=color.red, title="MA50")
// Hiển thị Bollinger Bands
plot(bbUpper, color=color.green, title="BB Upper")
plot(bbBasis, color=color.gray, title="BB Basis")
plot(bbLower, color=color.green, title="BB Lower")
// Hiển thị RSI và mức quan trọng
hline(rsiOverbought, "RSI Overbought", color=color.red, linestyle=hline.style_dashed)
hline(rsiOversold, "RSI Oversold", color=color.green, linestyle=hline.style_dashed)
plot(rsi, color=color.purple, title="RSI")