価格トレンド除去オシレーターに基づく定量取引戦略


作成日: 2023-11-24 11:22:30 最終変更日: 2023-11-24 11:22:30
コピー: 2 クリック数: 697
1
フォロー
1617
フォロワー

戦略概要

この戦略は,価格反動振動器を基にした量的な取引戦略 (Detrended Price Oscillator Quantitative Trading Strategy) と呼ばれています.この戦略は,価格反動振動器の指標を構築し,その基礎で取引信号を発信することによって,典型的な技術指標戦略に属します.

戦略原則

この戦略の核心は,価格のトレンドオフの振動器 ((DPO) 指数である.DPO指数は,移動平均に似ており,価格のより長い周期のトレンドを除し,価格の周期的な変動をより顕著にします.具体的には,DPO指数は,価格をN日間のシンプル移動平均と対比するものです.価格が移動平均より高い場合,DPOは正であり,価格が移動平均より低い場合,DPOは負です.

この策略は,パラメータNを14に設定し,14日間のDPO指標を構築する.DPO指標が正であるとき,多信号が送信され,DPO指標が負であるとき,空信号が送信される.

戦略的優位性

  • DPO指標は本質的に波指標であり,価格の中短線周期を効果的に識別できる.これは,比較的隠された取引機会の発見に役立ちます.
  • DPO指標はシンプルで分かりやすい構造で,パラメータの選択も柔軟です.
  • 価格そのものに対して,DPO指標の形は比較基準であり,判断が容易で,ルール制定に適している.

戦略リスク

  • 多くの技術指標戦略と同様に,DPO戦略は,無意味な取引信号を何度も発生させやすい.これは,不必要な滑り点と取引コストをもたらす可能性があります.
  • DPO指標はパラメータNに敏感であり,異なるパラメータの選択は,戦略効果の大きな差を招く.多くのテストを経て最適なパラメータを見つけなければならない.
  • トレンドの状況では,DPO戦略の保有時間は長すぎ,時効的に止まらない可能性があり,一定の血流の危険性がある.

リスクを下げるために,以下の分野を最適化することを検討できます.

  1. 単一損失を抑えるために, Stop Loss メカニズムに参加する.
  2. 参数Nの値を調整して,最適な参数を探します.
  3. トレンド指数と組み合わせて,明確なトレンドがある場合でも,元の戦略で取引することを避ける.

要約する

この戦略は,価格のトレンドオフ振動器指標に基づいて取引シグナルを発信する.この指標は,移動平均と比較して,価格の長期周期的な傾向を排除し,価格の周期的な特性をより顕著にします.これは,容易には見られない取引機会を発見するのに役立ちます.同時に,パラメータ選択の敏感性,止損およびフィルターなどの問題もあります.継続的な最適化により,この戦略の効果は,大きく向上する余地があります.

ストラテジーソースコード
/*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")