Chiến lược này được gọi là chiến lược giao dịch định lượng dựa trên dao động giá giảm. Chiến lược này thuộc về chiến lược chỉ số kỹ thuật điển hình bằng cách xây dựng chỉ số dao động giá giảm và phát ra tín hiệu giao dịch dựa trên nó.
Cốt lõi của chiến lược này là giá đi xu hướng dao động ((DPO) chỉ số. Chỉ số DPO tương tự như đường trung bình di chuyển, có thể loại bỏ xu hướng trong chu kỳ dài hơn trong giá, làm cho sự biến động định kỳ trong giá trở nên rõ ràng hơn. Cụ thể, chỉ số DPO là so sánh giá với đường trung bình di chuyển đơn giản N ngày của nó.
Chính sách này đặt tham số N là 14, để xây dựng chỉ số DPO 14 ngày. Khi chỉ số DPO là tích cực, sẽ phát ra một tín hiệu nhiều; Khi chỉ số DPO là âm, sẽ phát ra một tín hiệu trống.
Để giảm thiểu rủi ro, bạn có thể xem xét tối ưu hóa các khía cạnh sau:
Chiến lược này phát tín hiệu giao dịch dựa trên chỉ số dao động giá theo xu hướng. Chỉ số này được so sánh với đường trung bình di chuyển, loại bỏ xu hướng chu kỳ dài trong giá, làm cho đặc điểm chu kỳ của giá trở nên rõ ràng hơn. Điều này giúp phát hiện ra một số cơ hội giao dịch không dễ dàng nhận thấy. Ngoài ra còn có các vấn đề như chọn tham số nhạy cảm, dừng lỗ và lọc.
/*backtest
start: 2023-11-16 00:00:00
end: 2023-11-20 08:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 31/03/2017
// The Detrend Price Osc indicator is similar to a moving average,
// in that it filters out trends in prices to more easily identify
// cycles. The indicator is an attempt to define cycles in a trend
// by drawing a moving average as a horizontal straight line and
// placing prices along the line according to their relation to a
// moving average. It provides a means of identifying underlying
// cycles not apparent when the moving average is viewed within a
// price chart. Cycles of a longer duration than the Length (number
// of bars used to calculate the Detrend Price Osc) are effectively
// filtered or removed by the oscillator.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="Detrended Price Oscillator", shorttitle="DPO")
Length = input(14, minval=1)
Series = input(title="Price", defval="close")
reverse = input(false, title="Trade reverse")
hline(0, color=green, linestyle=line)
xPrice = close
xsma = sma(xPrice, Length)
nRes = xPrice - xsma
pos = iff(nRes > 0, 1,
iff(nRes < 0, -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(nRes, color=red, title="Detrended Price Oscillator")