Chiến lược này sử dụng nhiều chỉ số tổng hợp như đường trung bình, dải Brin và thời gian, để xác định bắt đầu và kết thúc của xu hướng giá, thực hiện hoạt động theo dõi xu hướng. Chiến lược được xác nhận thông qua nhiều chỉ số, có thể lọc hiệu quả phá vỡ giả.
Chiến lược bao gồm các bước quan trọng sau:
Tính toán đường trung bình nhanh và đường trung bình chậm. Các đường trung bình được tính toán bằng cách sử dụng VWAP thay vì giá đóng cửa, để phản ánh chính xác hơn giá giao dịch thực tế.
Tính trung bình của đường trung bình được tính toán và dựa trên giá trị trung bình này để vẽ các vùng Brin. Các vùng Brin có thể xác định mức dao động của giá có mở rộng hay không và cho biết xu hướng bắt đầu.
Tiếp theo, hãy đưa vào chỉ số TSV để xác định liệu khối lượng giao dịch có đang mở rộng hay không.
Một tín hiệu mua được tạo ra khi đường trung bình nhanh vượt qua đường trung bình chậm, giá cao hơn đường trên của Brin và TSV lớn hơn 0; ngược lại, một tín hiệu bán xuất hiện.
Sử dụng rút lui đường trung bình và đường ray dưới Brin như tín hiệu dừng lỗ.
Sử dụng nhiều chỉ số xác nhận, có thể lọc hiệu quả phá vỡ giả, nhận diện xu hướng bắt đầu
Phương pháp tính toán đường trung bình có thể phản ánh chính xác hơn giá giao dịch thực tế
Xác định xu hướng kết hợp với chỉ số biến động
Tăng chỉ số khối lượng giao dịch, xác nhận xu hướng phát triển
Thiết lập các tiêu chuẩn ngăn chặn và ngăn chặn hợp lý để kiểm soát rủi ro
Các tham số có thể được cấu hình, có thể được điều chỉnh linh hoạt đến trạng thái tối ưu
Xác định kết hợp nhiều chỉ số, có vấn đề khó khăn trong việc tối ưu hóa tham số
Các đường trung bình và các dải Brin đều có vấn đề về độ trễ, có thể dẫn đến mất mát không kịp thời.
Chỉ số thời gian nhạy cảm với các thiết lập tham số, cần điều chỉnh theo thị trường khác nhau
Trong thị trường tổng hợp, có khả năng tạo ra nhiều tín hiệu sai.
Không tính đến tác động của chi phí giao dịch, lợi nhuận và lỗ hổng thực tế sẽ thấp hơn so với kết quả kiểm tra lại
Cố gắng sử dụng phương pháp học máy để tự động tối ưu hóa các tham số
Thiết lập động di chuyển dừng hoặc theo dõi dừng để khóa lợi nhuận tốt hơn
Tiếp theo là việc đưa ra chỉ số năng lượng khối lượng giao dịch để tránh các giao dịch sai lệch do khối lượng giao dịch.
Kết hợp lý thuyết sóng, đánh giá các tham số chiến lược điều chỉnh động trong giai đoạn đầu, giữa và cuối của xu hướng hiện tại
Cân nhắc về tác động của chi phí giao dịch thực tế, đặt mức dừng tối thiểu để kiểm soát hiệu quả chi phí
Chiến lược tổng hợp xem xét nhiều chỉ số cung cấp khả năng nhận dạng xu hướng tốt, có thể đánh giá hiệu quả sự khởi đầu và kết thúc của xu hướng thực sự. Sự ổn định của chiến lược có thể được nâng cao hơn nữa thông qua tối ưu hóa tham số, tối ưu hóa dừng lỗ và tối ưu hóa bộ lọc.
/*backtest
start: 2022-09-14 00:00:00
end: 2023-09-20 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// @version=4
// Credits
// "Vwap with period" code which used in this strategy to calculate the leadLine was written by "neolao" active on https://tr.tradingview.com/u/neolao/
// "TSV" code which used in this strategy was written by "liw0" active on https://www.tradingview.com/u/liw0. The code is corrected by "vitelot" December 2018.
strategy("HYE Trend Hunter [Strategy]", overlay = true, initial_capital = 1000, default_qty_value = 100, default_qty_type = strategy.percent_of_equity, commission_value = 0.025, pyramiding = 0)
// Strategy inputs
slowtenkansenPeriod = input(9, minval=1, title="Slow Tenkan Sen VWAP Line Length", group = "Tenkansen / Kijunsen")
slowkijunsenPeriod = input(26, minval=1, title="Slow Kijun Sen VWAP Line Length", group = "Tenkansen / Kijunsen")
fasttenkansenPeriod = input(5, minval=1, title="Fast Tenkan Sen VWAP Line Length", group = "Tenkansen / Kijunsen")
fastkijunsenPeriod = input(13, minval=1, title="Fast Kijun Sen VWAP Line Length", group = "Tenkansen / Kijunsen")
BBlength = input(20, minval=1, title= "Bollinger Band Length", group = "Bollinger Bands")
BBmult = input(2.0, minval=0.001, maxval=50, title="Bollinger Band StdDev", group = "Bollinger Bands")
tsvlength = input(13, minval=1, title="TSV Length", group = "Tıme Segmented Volume")
tsvemaperiod = input(7, minval=1, title="TSV Ema Length", group = "Tıme Segmented Volume")
// Make input options that configure backtest date range
startDate = input(title="Start Date", type=input.integer,
defval=1, minval=1, maxval=31, group = "Backtest Range")
startMonth = input(title="Start Month", type=input.integer,
defval=1, minval=1, maxval=12, group = "Backtest Range")
startYear = input(title="Start Year", type=input.integer,
defval=2000, minval=1800, maxval=2100, group = "Backtest Range")
endDate = input(title="End Date", type=input.integer,
defval=31, minval=1, maxval=31, group = "Backtest Range")
endMonth = input(title="End Month", type=input.integer,
defval=12, minval=1, maxval=12, group = "Backtest Range")
endYear = input(title="End Year", type=input.integer,
defval=2021, minval=1800, maxval=2100, group = "Backtest Range")
inDateRange = true
//Slow Tenkan Sen Calculation
typicalPriceTS = (high + low + close) / 3
typicalPriceVolumeTS = typicalPriceTS * volume
cumulativeTypicalPriceVolumeTS = sum(typicalPriceVolumeTS, slowtenkansenPeriod)
cumulativeVolumeTS = sum(volume, slowtenkansenPeriod)
slowtenkansenvwapValue = cumulativeTypicalPriceVolumeTS / cumulativeVolumeTS
//Slow Kijun Sen Calculation
typicalPriceKS = (high + low + close) / 3
typicalPriceVolumeKS = typicalPriceKS * volume
cumulativeTypicalPriceVolumeKS = sum(typicalPriceVolumeKS, slowkijunsenPeriod)
cumulativeVolumeKS = sum(volume, slowkijunsenPeriod)
slowkijunsenvwapValue = cumulativeTypicalPriceVolumeKS / cumulativeVolumeKS
//Fast Tenkan Sen Calculation
typicalPriceTF = (high + low + close) / 3
typicalPriceVolumeTF = typicalPriceTF * volume
cumulativeTypicalPriceVolumeTF = sum(typicalPriceVolumeTF, fasttenkansenPeriod)
cumulativeVolumeTF = sum(volume, fasttenkansenPeriod)
fasttenkansenvwapValue = cumulativeTypicalPriceVolumeTF / cumulativeVolumeTF
//Fast Kijun Sen Calculation
typicalPriceKF = (high + low + close) / 3
typicalPriceVolumeKF = typicalPriceKS * volume
cumulativeTypicalPriceVolumeKF = sum(typicalPriceVolumeKF, fastkijunsenPeriod)
cumulativeVolumeKF = sum(volume, fastkijunsenPeriod)
fastkijunsenvwapValue = cumulativeTypicalPriceVolumeKF / cumulativeVolumeKF
//Slow LeadLine Calculation
lowesttenkansen_s = lowest(slowtenkansenvwapValue, slowtenkansenPeriod)
highesttenkansen_s = highest(slowtenkansenvwapValue, slowtenkansenPeriod)
lowestkijunsen_s = lowest(slowkijunsenvwapValue, slowkijunsenPeriod)
highestkijunsen_s = highest(slowkijunsenvwapValue, slowkijunsenPeriod)
slowtenkansen = avg(lowesttenkansen_s, highesttenkansen_s)
slowkijunsen = avg(lowestkijunsen_s, highestkijunsen_s)
slowleadLine = avg(slowtenkansen, slowkijunsen)
//Fast LeadLine Calculation
lowesttenkansen_f = lowest(fasttenkansenvwapValue, fasttenkansenPeriod)
highesttenkansen_f = highest(fasttenkansenvwapValue, fasttenkansenPeriod)
lowestkijunsen_f = lowest(fastkijunsenvwapValue, fastkijunsenPeriod)
highestkijunsen_f = highest(fastkijunsenvwapValue, fastkijunsenPeriod)
fasttenkansen = avg(lowesttenkansen_f, highesttenkansen_f)
fastkijunsen = avg(lowestkijunsen_f, highestkijunsen_f)
fastleadLine = avg(fasttenkansen, fastkijunsen)
// BBleadLine Calculation
BBleadLine = avg(fastleadLine, slowleadLine)
// Bollinger Band Calculation
basis = sma(BBleadLine, BBlength)
dev = BBmult * stdev(BBleadLine, BBlength)
upper = basis + dev
lower = basis - dev
// TSV Calculation
tsv = sum(close>close[1]?volume*(close-close[1]):close<close[1]?volume*(close-close[1]):0,tsvlength)
tsvema = ema(tsv, tsvemaperiod)
// Rules for Entry & Exit
if(fastleadLine > fastleadLine[1] and slowleadLine > slowleadLine[1] and tsv > 0 and tsv > tsvema and close > upper and inDateRange)
strategy.entry("BUY", strategy.long)
if(fastleadLine < fastleadLine[1] and slowleadLine < slowleadLine[1])
strategy.close("BUY")
// Plots
colorsettingS = input(title="Solid Color Slow Leadline", defval=false, type=input.bool)
plot(slowleadLine, title = "Slow LeadLine", color = colorsettingS ? color.aqua : slowleadLine > slowleadLine[1] ? color.green : color.red, linewidth=3)
colorsettingF = input(title="Solid Color Fast Leadline", defval=false, type=input.bool)
plot(fastleadLine, title = "Fast LeadLine", color = colorsettingF ? color.orange : fastleadLine > fastleadLine[1] ? color.green : color.red, linewidth=3)
p1 = plot(upper, "Upper BB", color=#2962FF)
p2 = plot(lower, "Lower BB", color=#2962FF)
fill(p1, p2, title = "Background", color=color.blue)