
Dual Moving Average Crossover with RSI Strength Filter Trading Strategy Chiến lược giao dịch
Chiến lược này là một hệ thống giao dịch kết hợp các bộ lọc chỉ số crossover và RSI. Chiến lược sử dụng chỉ số chuyển động 5 chu kỳ ((EMA5) và chỉ số chuyển động đơn giản 10 chu kỳ ((SMA10) như là công cụ định hướng chính, đồng thời giới thiệu chỉ số tương đối mạnh 14 chu kỳ ((RSI14) như là bộ lọc tín hiệu giao dịch, để tăng độ chính xác của giao dịch thông qua các điều kiện vào và ra nghiêm ngặt.
Lập luận cốt lõi của chiến lược dựa trên sự kết hợp của hai chỉ số kỹ thuật quan trọng:
Cơ chế xác nhận tín hiệu hoàn thiện
Kiểm soát rủi ro hiệu quả
Chiến lược logic rõ ràng
Rủi ro của thị trường biến động
Rủi ro của sự chậm trễ
Độ nhạy tham số
Tiếp theo, bạn có thể sử dụng một bộ lọc theo xu hướng.
Các tham số tối ưu hóa tự điều chỉnh
Quản lý rủi ro tốt hơn
Chiến lược này được xây dựng một hệ thống giao dịch tương đối hoàn hảo bằng cách kết hợp các bộ lọc crossover và RSI. Lợi thế chính của chiến lược là cơ chế xác nhận tín hiệu và các biện pháp kiểm soát rủi ro, nhưng cũng có một số hạn chế vốn có. Với hướng tối ưu hóa được đề xuất, chiến lược có khả năng hoạt động tốt hơn trong giao dịch thực tế.
/*backtest
start: 2024-06-20 00:00:00
end: 2024-12-01 00:00:00
period: 3d
basePeriod: 3d
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("EMA and SMA Crossover with RSI14 Filtering", overlay=true)
// Define parameters for EMA, SMA, and RSI
ema5_length = 5
sma10_length = 10
rsi14_length = 14
rsi60_level = 60
rsi50_level = 50
// Calculate EMAs, SMAs, and RSI
ema5 = ta.ema(close, ema5_length)
sma10 = ta.sma(close, sma10_length)
rsi14 = ta.rsi(close, rsi14_length)
// Define Crossover Conditions
positive_crossover = ta.crossover(ema5, sma10)
negative_crossover = ta.crossunder(ema5, sma10)
// Define RSI filter conditions
rsi_above_60 = rsi14 > rsi60_level
rsi_below_50 = rsi14 < rsi50_level
// Condition: price below 60 on RSI 14 and later crosses above for Buy
price_below_rsi60 = close < rsi14
price_above_rsi60 = close > rsi14
// Condition: price above 50 on RSI 14 and later crosses below for Sell
price_above_rsi50 = close > rsi14
price_below_rsi50 = close < rsi14
// Trading logic
var bool active_buy_trade = false
var bool active_sell_trade = false
// Buy Condition: EMA 5 crosses above SMA 10 and RSI 14 crosses above 60
if (positive_crossover and not active_buy_trade)
if (price_below_rsi60)
// Wait for price to cross above RSI 60
if (price_above_rsi60)
strategy.entry("Buy", strategy.long)
active_buy_trade := true
else
strategy.entry("Buy", strategy.long)
active_buy_trade := true
// Sell Condition: EMA 5 crosses below SMA 10 and RSI 14 crosses below 50
if (negative_crossover and not active_sell_trade)
if (price_above_rsi50)
// Wait for price to cross below RSI 50
if (price_below_rsi50)
strategy.entry("Sell", strategy.short)
active_sell_trade := true
else
strategy.entry("Sell", strategy.short)
active_sell_trade := true
// Exit Buy Condition: Reverse Signal (EMA crosses below SMA or RSI crosses below 50)
if (active_buy_trade and (negative_crossover or rsi14 < rsi50_level))
strategy.close("Buy")
active_buy_trade := false
// Exit Sell Condition: Reverse Signal (EMA crosses above SMA or RSI crosses above 60)
if (active_sell_trade and (positive_crossover or rsi14 > rsi60_level))
strategy.close("Sell")
active_sell_trade := false
// Plotting EMAs, SMAs, and RSI 14 on the chart
plot(ema5, color=color.blue, linewidth=2, title="EMA 5")
plot(sma10, color=color.red, linewidth=2, title="SMA 10")
hline(rsi60_level, "RSI 60", color=color.gray, linestyle=hline.style_dotted)
hline(rsi50_level, "RSI 50", color=color.gray, linestyle=hline.style_dotted)
plot(rsi14, color=color.green, linewidth=1, title="RSI 14")