
Chiến lược này là một hệ thống giao dịch động lực kết hợp nhiều chỉ số kỹ thuật, đồng thời tích hợp cơ chế dừng lỗ linh hoạt. Chiến lược này chủ yếu sử dụng tín hiệu chéo của ba chỉ số kỹ thuật phổ biến là RSI, EMA và MACD để đánh giá xu hướng và động lực của thị trường và đưa ra quyết định giao dịch dựa trên đó.
Nguyên tắc cốt lõi của chiến lược này là xác định các cơ hội giao dịch tiềm năng thông qua sự phối hợp của nhiều chỉ số:
Chiến lược sẽ kích hoạt tín hiệu giao dịch khi các chỉ số này đáp ứng cùng một điều kiện cụ thể. Ví dụ: khi EMA ngắn hạn vượt qua EMA dài hạn, RSI dưới mức mua quá mức và MACD cao hơn đường tín hiệu, sẽ tạo ra tín hiệu đa. Các điều kiện ngược lại sẽ kích hoạt tín hiệu tháo lỗ.
Ngoài ra, chiến lược này còn kết hợp các cơ chế dừng lỗ, cho phép các nhà giao dịch đặt mức dừng và dừng lỗ phù hợp theo sở thích rủi ro của họ. Việc giới thiệu tỷ lệ lợi nhuận rủi ro đã tối ưu hóa hơn nữa chiến lược quản lý tiền.
Chiến lược giao dịch động lực chéo đa chỉ số này cung cấp cho các nhà giao dịch một hệ thống giao dịch toàn diện bằng cách sử dụng các chỉ số kỹ thuật như RSI, EMA và MACD, kết hợp với cơ chế dừng lỗ linh hoạt. Ưu điểm của chiến lược là khả năng phân tích thị trường từ nhiều góc độ và phương pháp quản lý rủi ro linh hoạt. Tuy nhiên, giống như tất cả các chiến lược giao dịch, nó cũng phải đối mặt với các rủi ro như giao dịch quá mức và nhạy cảm với các tham số.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-10-12 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Crypto Futures Day Trading with Profit/Limit/Loss", overlay=true, margin_long=100, margin_short=100)
// Parameters for the strategy
rsiPeriod = input.int(14, title="RSI Period")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
emaShortPeriod = input.int(9, title="Short EMA Period")
emaLongPeriod = input.int(21, title="Long EMA Period")
macdFastLength = input.int(12, title="MACD Fast Length")
macdSlowLength = input.int(26, title="MACD Slow Length")
macdSignalSmoothing = input.int(9, title="MACD Signal Smoothing")
// Parameters for Take Profit, Stop Loss, and Limit
takeProfitPercent = input.float(3, title="Take Profit %", step=0.1) // 3% by default
stopLossPercent = input.float(1, title="Stop Loss %", step=0.1) // 1% by default
limitRiskRewardRatio = input.float(2, title="Risk/Reward Ratio", step=0.1) // Example: 2:1 ratio
// Calculate RSI
rsi = ta.rsi(close, rsiPeriod)
// Calculate EMA (Exponential Moving Average)
emaShort = ta.ema(close, emaShortPeriod)
emaLong = ta.ema(close, emaLongPeriod)
// Calculate MACD
[macdLine, signalLine, _] = ta.macd(close, macdFastLength, macdSlowLength, macdSignalSmoothing)
// Calculate take profit and stop loss levels
takeProfitLong = strategy.position_avg_price * (1 + takeProfitPercent / 100)
stopLossLong = strategy.position_avg_price * (1 - stopLossPercent / 100)
takeProfitShort = strategy.position_avg_price * (1 - takeProfitPercent / 100)
stopLossShort = strategy.position_avg_price * (1 + stopLossPercent / 100)
// Entry conditions for long position
longCondition = ta.crossover(emaShort, emaLong) and rsi < rsiOverbought and macdLine > signalLine
if (longCondition)
strategy.entry("Long", strategy.long)
// Exit conditions for long position based on stop loss and take profit
strategy.exit("Take Profit/Stop Loss Long", from_entry="Long", limit=takeProfitLong, stop=stopLossLong)
// Entry conditions for short position
shortCondition = ta.crossunder(emaShort, emaLong) and rsi > rsiOversold and macdLine < signalLine
if (shortCondition)
strategy.entry("Short", strategy.short)
// Exit conditions for short position based on stop loss and take profit
strategy.exit("Take Profit/Stop Loss Short", from_entry="Short", limit=takeProfitShort, stop=stopLossShort)
// Plot EMA lines on the chart
plot(emaShort, color=color.blue, title="Short EMA (9)")
plot(emaLong, color=color.red, title="Long EMA (21)")
// Plot MACD and signal lines in a separate window
plot(macdLine, color=color.green, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")
// Plot RSI
hline(rsiOverbought, "Overbought", color=color.red)
hline(rsiOversold, "Oversold", color=color.green)
plot(rsi, color=color.purple, title="RSI")