
Chiến lược này là một hệ thống theo dõi xu hướng dựa trên nhiều chu kỳ thời gian, kết hợp với đường tròn 50 chu kỳ giao dịch trọng lượng trung bình di chuyển ((VWMA) làm bộ lọc xu hướng lớn và sử dụng 200 chu kỳ VWMA và HLCC4 giá phá vỡ trong chu kỳ thời gian hiện tại như một tín hiệu giao dịch cụ thể. Đây là một chiến lược chỉ làm nhiều hơn để tăng độ tin cậy giao dịch thông qua xác nhận xu hướng nghiêm ngặt và xác minh nhiều chu kỳ thời gian.
Lập luận cốt lõi của chiến lược bao gồm một số yếu tố quan trọng:
Đây là một chiến lược theo dõi xu hướng nghiêm ngặt được thiết kế, kiểm soát rủi ro tốt hơn thông qua sự kết hợp nhiều chu kỳ thời gian và điều kiện giao dịch nghiêm ngặt. Ưu điểm cốt lõi của chiến lược là cơ chế xác nhận xu hướng hoàn hảo và logic giao dịch rõ ràng, phù hợp để nắm bắt cơ hội xu hướng trung và dài hạn trong thị trường mạnh.
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-17 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("Long-Only 200 WVMA + HLCC4 Strategy (Weekly 50 VWMA Filter, Daily Exit, Last 5 Years)", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Parameters
wvma_length = input(200, title="200 WVMA Length")
// Restrict backtesting to the last 5 years
var int backtest_start_year = na
if na(backtest_start_year)
backtest_start_year = year - 5 // Calculate the start year (5 years ago)
// Check if the current time is within the last 5 years
within_backtest_period = true
// Fetch Weekly 50 VWMA
weekly_vwma_50 = request.security(syminfo.tickerid, "W", ta.vwma(close, 50))
// Basic Condition: Price must be above Weekly 50 VWMA
above_weekly_vwma = (close > weekly_vwma_50)
// 200 Weighted Volume Moving Average (WVMA) on the current timeframe
wvma = ta.vwma(close, wvma_length)
plot(wvma, title="200 WVMA", color=color.blue, linewidth=2)
// HLCC4 Calculation
hlcc4 = (high + low + close + close) / 4
// Fetch Daily 200 WVMA
daily_wvma = request.security(syminfo.tickerid, "D", ta.vwma(close, wvma_length))
// Fetch Daily Close
daily_close = request.security(syminfo.tickerid, "D", close)
// Long Entry Condition
long_condition = (close[1] > wvma[1]) and (close > wvma) and (close > hlcc4[1])
// Long Exit Condition (Daily Close below Daily 200 WVMA)
exit_condition = (daily_close < daily_wvma)
// Check if there is an open position
var bool in_position = false
// Execute trades only within the last 5 years and above Weekly 50 VWMA
if within_backtest_period and above_weekly_vwma
if (long_condition and not in_position)
strategy.entry("Buy", strategy.long)
in_position := true
if (exit_condition and in_position)
strategy.close("Buy")
in_position := false
// Plotting Entry and Exit Signals
plotshape(series=long_condition and not in_position and within_backtest_period and above_weekly_vwma, style=shape.labelup, location=location.belowbar, color=color.green, text="Buy", size=size.small)
plotshape(series=exit_condition and in_position and within_backtest_period and above_weekly_vwma, style=shape.labeldown, location=location.abovebar, color=color.red, text="Exit", size=size.small)
// Highlight background for trend direction
bgcolor(long_condition and not in_position and within_backtest_period and above_weekly_vwma ? color.new(color.green, 90) : na, title="Uptrend Background")
bgcolor(exit_condition and in_position and within_backtest_period and above_weekly_vwma ? color.new(color.red, 90) : na, title="Exit Background")
// Plot Weekly 50 VWMA
plot(weekly_vwma_50, title="Weekly 50 VWMA", color=color.orange, linewidth=2)