Chiến lược định lượng dao động theo lưu lượng truy cập


Ngày tạo: 2023-12-05 11:35:50 sửa đổi lần cuối: 2023-12-05 11:35:50
sao chép: 0 Số nhấp chuột: 763
1
tập trung vào
1619
Người theo dõi

Chiến lược định lượng dao động theo lưu lượng truy cập

Đây là một chiến lược giao dịch dựa trên chỉ số định lượng Klinger. Chiến lược này nắm bắt sự thay đổi của lực lượng mua và bán trong biến động giá để phát hiện các điểm chuyển đổi của xu hướng thị trường. Ưu điểm của nó là nhạy cảm và chính xác, có thể áp dụng cho phân tích ngắn hạn và dài hạn.

Nguyên tắc chiến lược

Chiến lược này dựa trên lý thuyết sau:

  1. Phạm vi giá ((giá cao nhất - giá thấp nhất) phản ánh mức độ biến động của giá, và khối lượng giao dịch là động lực của biến động giá.
  2. Giá cao nhất + giá thấp nhất + giá đóng cửa tổng cộng với giá lớn hơn ngày trước, cho thấy đặc điểm tăng cường sức mạnh của người mua, tích lũy; ngược lại là đặc điểm phân phối.
  3. Sự thay đổi liên tục về khối lượng giao dịch phản ánh sự thay đổi về sức mạnh của các bên mua và bán.

Theo các lý thuyết này, chiến lược này tính toán Klinger Quantifier bằng cách so sánh tổng giá đóng cửa với quy mô của ngày trước, tổng hợp sự thay đổi khối lượng giao dịch. Khi chỉ số vượt qua đường trung bình của chính nó, hãy làm nhiều hơn, và khi đi qua, hãy làm trống.

Cụ thể, chiến lược này bao gồm ba chỉ số:

  1. xTrend: Phản ánh sức mạnh của xu hướng biến động giá, dựa trên tổng giá đóng cửa trong ngày so với ngày trước.
  2. xFast: Đường trung bình nhanh của xTrend, tham số là 34 ngày.
  3. xSlow: Đường trung bình tốc độ chậm của xTrend, tham số là 55 ngày.

Sau đó tính toán chênh lệch xKVO như là một chỉ số giao dịch. Khi nó đi trên đường trung bình 13 ngày xTrigger làm nhiều, khi đi xuống là trống.

Lợi thế chiến lược

Ưu điểm lớn nhất của chiến lược này là nó phù hợp cho cả phân tích ngắn hạn và dài hạn. Cài đặt tham số của đường trung bình chậm và nhanh cho phép nó nắm bắt sự thay đổi trong xu hướng ngắn hạn một cách nhạy cảm. Đồng thời, nó cũng có thể lọc ra tiếng ồn thị trường ngắn hạn và nắm bắt xu hướng dài hạn.

Ngoài ra, chiến lược này chỉ dựa trên tính toán giá cả và khối lượng giao dịch. Không cần tính toán các chỉ số toán học phức tạp, tính toán hiệu quả và phù hợp với ứng dụng thực tế.

Rủi ro và biện pháp đối phó

Rủi ro lớn nhất của chiến lược này là chỉ số khối lượng giao dịch có khả năng phân biệt yếu về phá vỡ giả. Chiến lược này có thể phát ra tín hiệu làm nhiều sai khi có sự điều chỉnh ngắn hạn của giá lên phía trên để phá vỡ đường trung bình.

Ngoài ra, chiến lược này rất nhạy cảm với các tham số. Các tham số của đường trung bình nhanh và đường trung bình giao dịch cần được kiểm tra và tối ưu hóa nhiều lần để có được hiệu suất tốt nhất.

Tối ưu hóa chiến lược

Dựa trên phân tích rủi ro, chúng tôi có thể tối ưu hóa chiến lược này hơn nữa ở những khía cạnh sau:

  1. Tăng cơ chế dừng lỗ. Khi giá giảm xuống một tỷ lệ nhất định, dừng lỗ và rút ra, có thể giảm nhiễu nhiễu tiếng ồn trong điều chỉnh ngắn hạn.

  2. Thêm các chỉ số lọc xu hướng. Kết hợp với các chỉ số như MACD và chỉ số trung bình di chuyển để đánh giá xu hướng chung của thị trường, tránh bị lạc hướng trong tình huống biến động.

  3. Cài đặt tham số tối ưu. Tìm kiếm các tham số kết hợp tốt nhất thông qua dữ liệu truy lại lịch sử để tăng sự ổn định của chiến lược.

  4. Tối ưu hóa quản lý tiền trước, chẳng hạn như điều chỉnh vị trí động theo tình huống dừng lỗ.

Tóm tắt

Chiến lược này có thể đạt được hiệu suất tốt bằng cách so sánh mối quan hệ giữa tổng giá và khối lượng giao dịch, nắm bắt sự thay đổi của sức mạnh mua và bán trên thị trường, đồng thời cân nhắc sự nhạy cảm và ổn định. Với các tham số tối ưu hóa được đặt và kết hợp với phán đoán xu hướng, có thể đạt được hiệu suất tốt.

||

This is a trading strategy based on the Klinger Volume Oscillator. It captures the shifts in buying and selling forces during price fluctuations to identify turning points in market trends. The advantages are sensitivity and accuracy for both short-term and long-term analysis. However, some risks need to be noticed.

Strategy Logic

The strategy is built on the following assumptions:

  1. The price range (high-low) reflects the amplitude of price swings, while volume is the driving force behind price movements.
  2. If today’s sum of high + low + close is greater than yesterday’s, it indicates strengthened buying forces and accumulation; the opposite suggests distribution.
  3. Continuous changes in volume reflect shifts in the forces of buyers and sellers.

Based on the theories, the strategy calculates the Klinger Volume Oscillator by comparing the relationship between today’s sum of closing prices and yesterday’s, combined with changes in volume. It goes long when the indicator crosses above its moving average line, and goes short on crosses below.

Specifically, there are three main indicators involved:

  1. xTrend: reflects the force of price trend based on comparison of sum of prices between days.
  2. xFast: fast EMA of xTrend with period of 34.
  3. xSlow: slow EMA of xTrend with period of 55.

The difference xKVO is then calculated as the trading indicator. Go long on crossing above 13-day EMA xTrigger, and short on crossing below.

Advantages

The greatest advantage is being suitable for both short-term and long-term analysis simultaneously. The fast and slow EMA settings make it sensitive to catch short-term swings, while also filtering out market noise and capturing long-term trends, which most price-based indicators struggle with.

In addition, it is purely based on price and volume data without complex math. This makes it highly efficient for actual trading applications.

Risks & Solutions

The main risk is weaker ability to distinguish false breakouts. Short-term price adjustments may generate wrong long signals. Other factors should be considered to determine the trend.

Also, the strategy is sensitive towards parameter tuning. Optimization is required on the EMAs and trigger line to find best performance.

Strategy Optimization

Some aspects that could further optimize the strategy according to the risks:

  1. Add stop loss mechanisms. Exiting at some percentage retracement reduces noise interference.

  2. Add trend filtering with indicators like MACD to avoid directional mistakes in ranging markets.

  3. Optimize parameter sets through backtests to improve robustness.

  4. Capital management optimization such as dynamic position sizing based on stop loss/take profit levels.

Conclusion

Overall, the strategy captures shifts in market forces by comparing price quantities and volumes for both sensitivity and stability. It can perform well given optimized parameters and trend validation, but inherent limitations of volume indicators can still pose risks for traders.

[/trans]

Mã nguồn chiến lược
/*backtest
start: 2022-11-28 00:00:00
end: 2023-12-04 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 30/08/2017
// The Klinger Oscillator (KO) was developed by Stephen J. Klinger. Learning 
// from prior research on volume by such well-known technicians as Joseph Granville, 
// Larry Williams, and Marc Chaikin, Mr. Klinger set out to develop a volume-based 
// indicator to help in both short- and long-term analysis.
// The KO was developed with two seemingly opposite goals in mind: to be sensitive 
// enough to signal short-term tops and bottoms, yet accurate enough to reflect the 
// long-term flow of money into and out of a security.
// The KO is based on the following tenets:
// Price range (i.e. High - Low) is a measure of movement and volume is the force behind 
// the movement. The sum of High + Low + Close defines a trend. Accumulation occurs when 
// today's sum is greater than the previous day's. Conversely, distribution occurs when 
// today's sum is less than the previous day's. When the sums are equal, the existing trend 
// is maintained.
// Volume produces continuous intra-day changes in price reflecting buying and selling pressure. 
// The KO quantifies the difference between the number of shares being accumulated and distributed 
// each day as "volume force". A strong, rising volume force should accompany an uptrend and then 
// gradually contract over time during the latter stages of the uptrend and the early stages of 
// the following downtrend. This should be followed by a rising volume force reflecting some 
// accumulation before a bottom develops.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. 
////////////////////////////////////////////////////////////
strategy(title="Klinger Volume Oscillator (KVO)", shorttitle="KVO")
TrigLen = input(13, minval=1)
FastX = input(34, minval=1)
SlowX = input(55, minval=1)
reverse = input(false, title="Trade reverse")
hline(0, color=gray, linestyle=line)
xTrend = iff(hlc3 > hlc3[1], volume * 100, -volume * 100)
xFast = ema(xTrend, FastX)
xSlow = ema(xTrend, SlowX)
xKVO = xFast - xSlow
xTrigger = ema(xKVO, TrigLen)
pos = iff(xKVO > xTrigger, 1,
	   iff(xKVO < xTrigger, -1, nz(pos[1], 0))) 
possig = iff(reverse and pos == 1, -1,
          iff(reverse and pos == -1, 1, pos))	   
if (possig == 1) 
    strategy.entry("Long", strategy.long)
if (possig == -1)
    strategy.entry("Short", strategy.short)	   	    
barcolor(possig == -1 ? red: possig == 1 ? green : blue )  
plot(xKVO, color=blue, title="KVO")
plot(xTrigger, color=red, title="Trigger")