
この戦略の名前は融合二重トレンド信号の反転指数化策略である.これは,ランダムな指標に基づく短期反転信号と,取引量に基づく長期トレンド信号の2つの異なる戦略信号を融合し,両者は安定した入場信号を形成する.
この戦略は2つの部分で構成されている. 第”部は,9日のストホ指数を使用して短期逆転信号を生成する. 具体的には,閉盘価格が前日より高調で,同時に9日の快線が50より低く,遅線が50より高い時に多調する. もし閉盘価格が前日より低調で,同時に9日の快線が50より高く,そして遅線が50より低い時に空調する. このように,ストホ指数の金叉死叉を使用して短期逆転信号を生成する.
第2部では,負の取引量指数 ((NVI) を用いて長期トレンドシグナルを形成する.NVIの計算式は,当日の取引量が前日より少ない場合は,当日の閉盘価格の変化率を累積する.当日の取引量が前日より大きいまたは等しい場合は,前日の値を維持する.NVI指標の移動平均線を通じて長期トレンドシグナルを形成する.
最後に,この戦略は2種類の信号を組み合わせます. 短期反転信号と長期トレンド信号が同方向である場合にのみ,入場信号が形成されます. これは偽信号をフィルターして,安定性を高めるのに役立ちます.
この戦略の最大の利点は,信号の安定性にある.短期的な反転信号は,市場の短期的な調整を捉え,長期的なトレンド信号は,大トレンドの不変化を保証する.この両者の組み合わせは,信号の安定性を大きく強化し,誤報率が高い短期信号を効果的にフィルターする.
また,この戦略はパラメータが少なく,簡単に最適化できます. ユーザーはNVIのパラメータを調整するだけで,異なる市場の特徴に適応できます.
この戦略の最大のリスクは,2つの信号の間に時間差がある可能性があることにある.短期的な反転信号と長期のトレンド信号の間に一定の遅れがある可能性があるため,これは2つの信号が一定期間不一致になり,安定した入場信号が形成できないことにつながります.
また,NVI指標は,長期トレンドの判断に誤りをもたらす可能性のある,異常な巨額の取引量変化にも敏感である.
これらのリスクを軽減するために,NVI指標のパラメータを適切に調整するか,単一損失を制御するためにストップを増加させることができます.
この戦略は,以下のような点で最適化できます.
ストーフ指標のパラメータを最適化し,反転捕捉能力を向上させる.
NVI指標の長周期を最適化し,長期トレンドの識別能力を強化する.
取引量フィルタリング条件を追加し,取引量異常の偽信号を排除する.
単一損失をコントロールするストップ・ロース戦略を導入する.
この戦略は,短期逆転と長期のトレンドを思いついて安定した入場機構を設計し,誤報率を効果的に制御し,信号の安定性を強化する.次のステップは,パラメータの調整,フィルタ条件の追加などから最適化され,戦略の安定性をさらに向上させることができる.
/*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 )