二重トレンドシグナルを統合する定量逆転指数戦略

作者: リン・ハーンチャオチャン, 日付: 2023-12-26 15:47:36
タグ:

img

概要

この戦略は"二重トレンドシグナルを統合する定量逆転指数戦略"と呼ばれる.これは,2つの異なる戦略からのシグナルを統合する.ストカスタス指標に基づく短期逆転信号とボリュームに基づく長期トレンド信号,それらを安定したエントリー信号に組み合わせる.

原則

この戦略は2つの部分から構成される.最初の部分は,短期的な逆転信号を生成するために9日ストックを使用する.特に,ストック9日急速線が50を超え,ストック9日急速線が50を超えるとき,閉じるが前回の閉じるよりも高くなったとき,ロングに行く.閉じるが前回の閉じるより低く,ストック9日急速線が50を超え,スローラインが50を超えたとき,ショートに行く.この方法で,ストックの黄金十字と死亡十字は短期的な逆転信号を形成する.

第2部では,負のボリュームインデックス (NVI) を使って長期トレンドシグナルを形成する.NVI計算式では,当日のボリュームが前日よりも小さい場合,当日の閉店価格の変動率は蓄積される.当日のボリュームが前日より大きいまたは同等である場合,前日の値が変化しない.長期トレンドシグナルはNVI指標の移動平均によって形成される.

この戦略は,短期の逆転信号と長期のトレンド信号が同じ方向にある場合にのみ,エントリー信号が形成される.これは誤った信号をフィルタリングし,安定性を高めるのに役立ちます.

利点分析

この戦略の最大の利点は,シグナルの安定性である.短期的な逆転シグナルは,短期的な市場調整を捉え,長期的トレンドシグナルは,大きなトレンドが変化しないことを保証する.両者の組み合わせは,シグナルの安定性を大幅に高め,短期的なより高いレートを持つ偽信号を効果的にフィルタリングすることができます.

さらに,この戦略にはパラメータが少なく,最適化が容易です.ユーザーは,異なる市場の特徴に適応するためにNVIのパラメータを調整するだけです.

リスク分析

この戦略の最大のリスクは,二つのタイプの信号の間に時間遅れがある可能性があること.短期的な逆転信号と長期的トレンド信号の間に一定の遅れがある可能性があります.これは,安定したエントリー信号を形成できず,一定の期間不一致な信号につながります.

さらに,NVI指標は,長期動向の誤った判断につながる取引量の異常な急上昇にも敏感です.

これらのリスクを軽減するために,NVI指標のパラメータをそれに応じて調整したり,取引ごとに損失を制御するためにストップロスを追加することもできます.

最適化

この戦略を最適化するための主な側面は以下の通りである.

  1. ストック指標のパラメータを最適化して逆転の検出能力を向上させる.

  2. NVI指標のサイクル長さを最適化し,長期的なトレンド識別能力を強化する.

  3. 取引量フィルターを追加して,異常な取引量から誤った信号を排除します.

  4. ストップ・ロスの戦略を 1 取引の損失を制御するために追加します.

結論

戦略は,短期的な逆転と長期的トレンドの考えに基づいた安定したエントリーメカニズムで設計されており,偽陽性率を効果的に制御し,信号安定性を向上させる.最適化のための次のステップには,パラメータを調整し,フィルター条件を追加し,戦略の安定性をさらに向上させるなどが含まれます.


/*backtest
start: 2023-12-18 00:00:00
end: 2023-12-21 05:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 29/03/2021
// 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 theory behind the indexes is as follows: On days of increasing 
// volume, you can expect prices to increase, and on days of decreasing 
// volume, you can expect prices to decrease. This goes with the idea of 
// the market being in-gear and out-of-gear. Both PVI and NVI work in similar 
// fashions: Both are a running cumulative of values, which means you either 
// keep adding or subtracting price rate of change each day to the previous day`s 
// sum. In the case of PVI, if today`s volume is less than yesterday`s, don`t add 
// anything; if today`s volume is greater, then add today`s price rate of change. 
// For NVI, add today`s price rate of change only if today`s volume is less than 
// yesterday`s.
//
// 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


NVI(EMA_Len) =>
    pos = 0.0
    nRes = 0.0
    xROC = roc(close, EMA_Len)
    nRes := iff(volume < volume[1], nz(nRes[1], 0) + xROC, nz(nRes[1], 0))
    nResEMA = ema(nRes, EMA_Len)
    pos := iff(nRes > nResEMA, 1,
    	     iff(nRes < nResEMA, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Negative Volume Index", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Negative Volume Index ----")
EMA_Len = input(50, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posNVI = NVI(EMA_Len)
pos = iff(posReversal123 == 1 and posNVI == 1 , 1,
	   iff(posReversal123 == -1 and posNVI == -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 )

もっと