
Đây là một chiến lược giao dịch theo dõi xu hướng kết hợp nhiều chỉ số kỹ thuật SuperTrend, VWAP, EMA và ADX. Chiến lược này chủ yếu sử dụng chỉ số SuperTrend để xác định hướng xu hướng và sử dụng mối quan hệ vị trí của VWAP và EMA để xác nhận xu hướng, đồng thời sử dụng chỉ số ADX để lọc xu hướng yếu, do đó cung cấp tín hiệu giao dịch chính xác. Chiến lược được thiết kế cho giao dịch trong ngày, đặc biệt là trên các chu kỳ thời gian như 5 phút, 15 phút và 1 giờ.
Lập luận cốt lõi của chiến lược dựa trên một số thành phần quan trọng sau:
Đây là một chiến lược theo dõi xu hướng có cấu trúc, logic rõ ràng. Bằng cách sử dụng nhiều chỉ số phối hợp, hiệu quả nâng cao độ tin cậy của tín hiệu giao dịch. Ưu điểm của chiến lược là tín hiệu rõ ràng, dễ thực hiện và có khả năng mở rộng tốt.
/*backtest
start: 2024-02-10 00:00:00
end: 2025-02-08 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("SuperTrend on Steroids", overlay=true)
// Input parameters
atrLength = input(10, title="ATR Period")
atrMultiplier = input(3.0, title="ATR Multiplier")
emaLength = input(21, title="EMA Length")
adxLength = input(14, title="ADX Length")
adxSmoothing = input(14, title="ADX Smoothing")
// EMA Calculation
emaValue = ta.ema(close, emaLength)
// VWAP Calculation
vwapValue = ta.vwap(close)
// ATR Calculation
atrValue = ta.atr(atrLength)
// SuperTrend Calculation
var trend = 1
up = hl2 - atrMultiplier * atrValue
dn = hl2 + atrMultiplier * atrValue
up1 = nz(up[1], up)
dn1 = nz(dn[1], dn)
up := close[1] > up1 ? math.max(up, up1) : up
dn := close[1] < dn1 ? math.min(dn, dn1) : dn
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
// ADX Calculation
[diplus, diminus, adx] = ta.dmi(adxLength, adxSmoothing)
// Buy/Sell Signals
buySignal = trend == 1 and trend[1] == -1
sellSignal = trend == -1 and trend[1] == 1
// Executing Trades
if buySignal
strategy.entry("Long", strategy.long)
if sellSignal
strategy.close("Long")
// Plotting SuperTrend Line
upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_line, color=color.yellow, linewidth=2)
dnPlot = plot(trend == -1 ? dn : na, title="Down Trend", style=plot.style_line, color=color.red, linewidth=2)
// Buy/Sell Labels
plotshape(buySignal, title="Buy Signal", text="BUY", location=location.belowbar, style=shape.labelup, size=size.normal, color=color.green, textcolor=color.white, offset=-1)
plotshape(sellSignal, title="Sell Signal", text="SELL", location=location.abovebar, style=shape.labeldown, size=size.normal, color=color.red, textcolor=color.white, offset=1)
// Background Highlighting
fill(upPlot, dnPlot, color=trend == 1 ? color.new(color.green, 90) : color.new(color.red, 90), title="Trend Highlight")
//vwap and EMA
plot(emaValue, title="EMA", color=color.white, linewidth=2)
plot(vwapValue, title="VWAP", color=color.blue, linewidth=2)