
Chiến lược này là một hệ thống giao dịch tổng hợp kết hợp đường trung bình động hàm mũ (EMA) với đám mây Ichimoku. Đường giao nhau EMA chủ yếu được sử dụng để nắm bắt tín hiệu bắt đầu xu hướng và xác nhận cơ hội mua, trong khi Đám mây Ichimoku được sử dụng để xác định xu hướng thị trường và xác định cơ hội bán. Thông qua sự phối hợp đồng bộ của các chỉ báo kỹ thuật đa chiều, chiến lược này không chỉ nắm bắt hiệu quả xu hướng mà còn kịp thời tránh được rủi ro.
Cơ chế vận hành chiến lược chủ yếu bao gồm hai phần cốt lõi:
Chiến lược này xây dựng một hệ thống giao dịch có khả năng theo dõi xu hướng và nắm bắt sự đảo chiều thông qua sự kết hợp hữu cơ giữa đường giao nhau EMA và Biểu đồ đám mây Ichimoku. Chiến lược được thiết kế hợp lý, kiểm soát rủi ro được thực hiện và có giá trị ứng dụng thực tế tốt. Thông qua các hướng tối ưu hóa được đề xuất, chiến lược vẫn còn có thể được cải thiện thêm. Khi áp dụng theo thời gian thực, trước tiên nên xác định tổ hợp tham số phù hợp thông qua thử nghiệm ngược, sau đó thực hiện các điều chỉnh động dựa trên điều kiện thực tế của thị trường.
/*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("EMA Crossover Buy + Ichimoku Cloud Sell Strategy", overlay=true)
// Input Parameters for the EMAs
shortEmaPeriod = input.int(9, title="Short EMA Period", minval=1)
longEmaPeriod = input.int(21, title="Long EMA Period", minval=1)
// Input Parameters for the Ichimoku Cloud
tenkanPeriod = input.int(9, title="Tenkan-Sen Period", minval=1)
kijunPeriod = input.int(26, title="Kijun-Sen Period", minval=1)
senkouSpanBPeriod = input.int(52, title="Senkou Span B Period", minval=1)
displacement = input.int(26, title="Displacement", minval=1)
// Calculate the EMAs
shortEma = ta.ema(close, shortEmaPeriod)
longEma = ta.ema(close, longEmaPeriod)
// Ichimoku Cloud Calculations
tenkanSen = ta.sma(close, tenkanPeriod)
kijunSen = ta.sma(close, kijunPeriod)
senkouSpanA = ta.sma(tenkanSen + kijunSen, 2)
senkouSpanB = ta.sma(close, senkouSpanBPeriod)
chikouSpan = close[displacement]
// Plot the EMAs on the chart
plot(shortEma, color=color.green, title="Short EMA")
plot(longEma, color=color.red, title="Long EMA")
// Plot the Ichimoku Cloud
plot(tenkanSen, color=color.blue, title="Tenkan-Sen")
plot(kijunSen, color=color.red, title="Kijun-Sen")
plot(senkouSpanA, color=color.green, title="Senkou Span A", offset=displacement)
plot(senkouSpanB, color=color.purple, title="Senkou Span B", offset=displacement)
plot(chikouSpan, color=color.orange, title="Chikou Span", offset=-displacement)
// Buy Condition: Short EMA crosses above Long EMA
buyCondition = ta.crossover(shortEma, longEma)
// Sell Condition: Tenkan-Sen crosses below Kijun-Sen, and price is below the cloud
sellCondition = ta.crossunder(tenkanSen, kijunSen) and close < senkouSpanA and close < senkouSpanB
// Plot Buy and Sell signals
plotshape(series=buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Execute Buy and Sell Orders
if (buyCondition)
strategy.entry("Buy", strategy.long)
if (sellCondition)
strategy.entry("Sell", strategy.short)
// Optional: Add Stop Loss and Take Profit (risk management)
stopLossPercentage = input.float(1.5, title="Stop Loss Percentage", minval=0.1) / 100
takeProfitPercentage = input.float(3.0, title="Take Profit Percentage", minval=0.1) / 100
longStopLoss = close * (1 - stopLossPercentage)
longTakeProfit = close * (1 + takeProfitPercentage)
shortStopLoss = close * (1 + stopLossPercentage)
shortTakeProfit = close * (1 - takeProfitPercentage)
strategy.exit("Take Profit/Stop Loss", "Buy", stop=longStopLoss, limit=longTakeProfit)
strategy.exit("Take Profit/Stop Loss", "Sell", stop=shortStopLoss, limit=shortTakeProfit)