
Chiến lược này là một hệ thống giao dịch cao cấp dựa trên chỉ số siêu xu hướng (Supertrend) để xác định các tín hiệu mua và bán thị trường thông qua việc phân tích hành vi thay đổi xu hướng và hành vi giá. Chiến lược này sử dụng cơ chế theo dõi xu hướng động, kết hợp với xác minh giá phá vỡ, có thể nắm bắt hiệu quả các điểm biến đổi xu hướng thị trường.
Cốt lõi của chiến lược này dựa trên các yếu tố chính sau:
Chiến lược này kết hợp các chỉ số siêu xu hướng và phân tích hành vi giá để xây dựng một hệ thống giao dịch tương đối đáng tin cậy. Mặc dù có một số rủi ro tiềm ẩn, nhưng hướng tối ưu hóa được đề xuất có thể nâng cao hơn nữa sự ổn định và lợi nhuận của chiến lược.
/*backtest
start: 2024-08-01 00:00:00
end: 2025-02-19 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"DOGE_USDT"}]
*/
//@version=5
strategy("Supertrend Strategy with Money Ocean Trade", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Input parameters
supertrendLength = input.int(6, title="Supertrend Length")
supertrendFactor = input.float(0.25, title="Supertrend Factor")
// Supertrend calculation
[supertrend, direction] = ta.supertrend(supertrendFactor, supertrendLength)
// Plot Supertrend line
supertrendColor = direction == 1 ? color.green : color.red
plot(supertrend, title="Supertrend", color=supertrendColor, linewidth=2, style=plot.style_line)
// Variables to track trend change and candle break
var bool trendChanged = false
var float prevSupertrend = na
if (not na(prevSupertrend) and direction != nz(ta.valuewhen(prevSupertrend != supertrend, direction, 1)))
trendChanged := true
else
trendChanged := false
prevSupertrend := supertrend
longEntry = trendChanged and close[1] < supertrend[1] and close > supertrend
shortEntry = trendChanged and close[1] > supertrend[1] and close < supertrend
// Strategy execution
if (longEntry)
strategy.entry("Long", strategy.long)
if (shortEntry)
strategy.entry("Short", strategy.short)
// Plot entry signals on the chart
plotshape(series=longEntry, location=location.belowbar, color=color.green, style=shape.labelup, title="BUY")
plotshape(series=shortEntry, location=location.abovebar, color=color.red, style=shape.labeldown, title="SELL")
// Alerts
alertcondition(longEntry, title="Buy Signal", message="Buy Signal Triggered!")
alertcondition(shortEntry, title="Short Signal", message="Short Signal Triggered!")