この戦略は,価格反動振動器を基にした量的な取引戦略 (Detrended Price Oscillator Quantitative Trading Strategy) と呼ばれています.この戦略は,価格反動振動器の指標を構築し,その基礎で取引信号を発信することによって,典型的な技術指標戦略に属します.
この戦略の核心は,価格のトレンドオフの振動器 ((DPO) 指数である.DPO指数は,移動平均に似ており,価格のより長い周期のトレンドを除し,価格の周期的な変動をより顕著にします.具体的には,DPO指数は,価格をN日間のシンプル移動平均と対比するものです.価格が移動平均より高い場合,DPOは正であり,価格が移動平均より低い場合,DPOは負です.
この策略は,パラメータNを14に設定し,14日間のDPO指標を構築する.DPO指標が正であるとき,多信号が送信され,DPO指標が負であるとき,空信号が送信される.
リスクを下げるために,以下の分野を最適化することを検討できます.
この戦略は,価格のトレンドオフ振動器指標に基づいて取引シグナルを発信する.この指標は,移動平均と比較して,価格の長期周期的な傾向を排除し,価格の周期的な特性をより顕著にします.これは,容易には見られない取引機会を発見するのに役立ちます.同時に,パラメータ選択の敏感性,止損およびフィルターなどの問題もあります.継続的な最適化により,この戦略の効果は,大きく向上する余地があります.
/*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")