定量的な二重要素逆転慣性取引戦略

作者: リン・ハーンチャオチャン開催日:2024年01月12日 14:38:02
タグ:

img

概要

定量的な二重因子逆転慣性取引戦略は,価格逆転信号と市場慣性信号を組み合わせる定量的な取引戦略である.この戦略は,まずストーカスティック指標を使用して価格逆転信号を生成し,その後,相対波動性指数 (RVI) から市場慣性信号を組み込み,最終的に二重因子によって動かされる取引決定を下す.

原則

戦略は主に2つの部分から構成されています.

  1. 価格逆転の部分は,Ulf Jensenが彼の本で提案したアイデアを採用しています.特に:閉店価格が2日間連続して上昇し,9日間のスローストカスティックは50を下回ると,ロング;閉店価格が2日間連続して低下し,9日間のファストストカスティックは50を超えると,ショートします.

  2. 市場慣性部分では,相対変動指数 (RVI) を使用する.この指標の値は0から100の間変動する.50を超えると市場の長期的傾向が向上し,50を下回ると市場の長期的傾向が低下することを示します.

要約すると,この戦略は,価格逆転信号と市場慣性信号を統合して,現在の市場方向性を決定します. 両方の部分からの信号が一致すると取引信号が生成されます.

利点分析

この戦略の最大の利点は,2つの主要な取引アイデアを組み合わせることである.逆転とトレンドフォロー.逆転信号は短期的な訂正を捉え,取引機会を提供することができる.慣性信号は,長期的トレンドがノイズを効果的にフィルタリングするために調整された場合にのみポジションを開設することを保証する.

さらに,二要素駆動メカニズムは信号品質を改善することができる.ストカストティックパラメータを最適化し,RVIを平滑化することで,戦略の最適化も可能である.

リスク分析

この戦略が直面する主なリスクは以下のとおりです.

  1. 逆転信号が誤って識別されるリスク パラメータの合理性を検証する必要があります

  2. 慣性信号が誤った信号を生成するリスク.RVI自体には,滑らかなパラメータを調整する必要がある遅延があります.

  3. 双要素信号のタイミングの調整が不十分であるため,取引機会が失われるリスク.異なるパラメータでマッチング状況がテストする必要があります.

さらに,逆転戦略は,トレンド市場での損失リスクが増加しています.ストップ損失規則を厳格に遵守することが必要です.

オプティマイゼーションの方向性

戦略は以下の側面で最適化できます.

  1. ストカスティック指標のパラメータを最適化し,反転信号の質とタイミングを向上させる.

  2. 慣性判断の精度を高めるため,RVI指標の滑らかなパラメータを最適化する.

  3. 最適な保持サイクルを決定するために,異なる保持期間を試験する.

  4. ストップ・ロスのメカニズムを組み込む.最適なストップ・ロスの位置を見つけるために,異なるストップ・ロスのポイントをバックテストする.

  5. 取引量異常などの他の要因信号を組み込むことを検討し,多因子主導戦略を形成する.

概要

定量的な二重因子逆転慣性取引戦略は,ストーカスティック指標とRVI指標を使用して取引シグナルを生成する逆転およびトレンド要因を包括的に考慮する.この戦略には,二重因子駆動,逆転機会の捉え,シグナルフィルタリングなどの利点があります.多面的なパラメータ最適化によってさらに改善することができます.厳格なストップ損失執行によるリスク管理も重要です.この戦略は定量的な取引に良いアイデアを提供します.


/*backtest
start: 2023-12-12 00:00:00
end: 2024-01-11 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 27/11/2020
// This is combo strategies for get a cumulative signal. 
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The 
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close 
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
// The strategy sells at market, if close price is lower than the previous close price 
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// The inertia indicator measures the market, stock or currency pair momentum and 
// trend by measuring the security smoothed RVI (Relative Volatility Index). 
// The RVI is a technical indicator that estimates the general direction of the 
// volatility of an asset.
// The inertia indicator returns a value that is comprised between 0 and 100. 
// Positive inertia occurs when the indicator value is higher than 50. As long as 
// the inertia value is above 50, the long-term trend of the security is up. The inertia 
// is negative when its value is lower than 50, in this case the long-term trend is 
// down and should stay down if the inertia stays below 50.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
    vFast = sma(stoch(close, high, low, Length), KSmoothing) 
    vSlow = sma(vFast, DLength)
    pos = 0.0
    pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
	         iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0))) 
	pos

Inertia(Period, Smooth) =>
    pos = 0.0
    nU = 0.0
    nD = 0.0
    xPrice = close
    StdDev = stdev(xPrice, Period)
    d = iff(close > close[1], 0, StdDev)
    u = iff(close > close[1], StdDev, 0)
    nU := (13 * nz(nU[1],0) + u) / 14
    nD := (13 * nz(nD[1],0) + d) / 14
    nRVI = 100 * nU / (nU + nD)
    nRes = ema(nRVI, Smooth)
    pos :=iff(nRes > 50, 1,
    	   iff(nRes < 50, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Inertia Strategy", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Period = input(10, minval=1)
Smooth = input(14, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posInertia = Inertia(Period, Smooth)
pos = iff(posReversal123 == 1 and posInertia == 1 , 1,
	   iff(posReversal123 == -1 and posInertia == -1, -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)	 
if (possig == 0) 
    strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )

もっと