定量的反転とボリューム戦略の組み合わせ


作成日: 2023-09-21 21:07:09 最終変更日: 2023-09-21 21:07:09
コピー: 2 クリック数: 748
1
フォロー
1702
フォロワー

概要

この戦略は,2つの量化取引戦略の組み合わせで,より正確な信頼性の高い取引シグナルを生成することを目的としています.最初の戦略は価格反転に基づいており,第二の戦略は取引量分析に基づいています.組み合わせのシグナルは,利益の確率を効果的に向上させます.

戦略原則

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

  1. 逆転戦略

STO指数を使用して逆転信号を判断する. 2日間の閉盘価格が上昇し,STOスローラインが50を下回ったときに多行; 2日間の閉盘価格が低下し,STOスローラインが50を超えたときに空行する.

  1. 取引量戦略

周期内での取引量と価格の関係を計算し,多空方向を判断し,均線平滑処理を行う.

この2つの戦略は,多ければ多,空ければ空である.

組合せ信号は信号の質を向上させ,いずれの戦略も偽信号の発生確率を大幅に低減する.

戦略的優位性

  • 2つの独立した戦略を組み合わせて,信号の正確性を向上させる
  • 逆転戦略は機会を捉え,取引量戦略は未来を判断する
  • 2つの異なるタイプの戦略が相互検証され,誤信号が減少する
  • 組み合わせはシンプルで直接的で 実行しやすい
  • 独立に最適化可能な各戦略のパラメータ

戦略リスク

  • 逆転策は簡単に騙され,厳格な退出が必要
  • 取引量分析の遅れの可能性
  • 統計学的な分析を基に
  • 平均線を計算するために,trained1より長いデータシリーズ
  • 異なる品種のパラメータは必ずしも一般的ではなく,個別に最適化する必要があります.

リスクは以下の方法で軽減できます.

  • STOパラメータを最適化し,反転認識能力を向上させる
  • 他の指標と組み合わせた取引量突破を確認
  • 平均線周期パラメータを最適化
  • グラフィック技術による形状判断
  • 品種別テストパラメータ

最適化の方向

この戦略は以下の点で最適化できます.

  1. STO指標のテストに最適なパラメータ

K値,D値などのパラメータを調整して最適の組み合わせを見つける

  1. 取引量突破の二次検証

MACD,BOLLなどの指標の補助判断

  1. 平均線周期パラメータを最適化

異なる周期パラメータをテストすることで,より安定した判断が得られます.

  1. 組合せ信号に基づいてグラフィック形式を導入する

例えば 変形が起きた時に再入場

  1. 品種別テストパラメータの組み合わせ

異なる品種のパラメータは必ずしも同じではないので,別々にテストする必要があります.

要約する

この戦略は,反転と交差量の2つの異なるタイプの戦略を組み合わせて,相互検証することで,信号の質と正確性を効果的に向上させることができる.しかし,パラメータ最適化,補助技術指標などの戦略効果を改善するために,注意が必要である.私たちは,リターン結果を継続的にテストし,パラメータルールを調整し,実用で検証することで,真に安定した信頼性の高い組み合わせの戦略を得ることができます.これは多くの時間と精力を投入する必要がありますが,リターンも顕著になります.

ストラテジーソースコード
/*backtest
start: 2023-09-13 00:00:00
end: 2023-09-20 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 21/10/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
// This is another version of FVE indicator that we have posted earlier 
// in this forum.
// This version has an important enhancement to the previous one that`s 
// especially useful with intraday minute charts.
// Due to the volatility had not been taken into account to avoid the extra 
// complication in the formula, the previous formula has some drawbacks:
// The main drawback is that the constant cutoff coefficient will overestimate 
// price changes in minute charts and underestimate corresponding changes in 
// weekly or monthly charts.
// And now the indicator uses adaptive cutoff coefficient which will adjust to 
// all time frames automatically.
//
// 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


FVI(Samples,Perma,Cintra,Cinter) =>
    pos = 0
    xhl2 = hl2
    xhlc3 = hlc3
    xClose = close
    xIntra = log(high) - log(low)
    xInter = log(xhlc3) - log(xhlc3[1])
    xStDevIntra = stdev(sma(xIntra, Samples) , Samples)
    xStDevInter = stdev(sma(xInter, Samples) , Samples)
    xVolume = volume
    TP = xhlc3
    TP1 = xhlc3[1]
    Intra = xIntra
    Vintra = xStDevIntra
    Inter = xInter
    Vinter = xStDevInter
    CutOff = Cintra * Vintra + Cinter * Vinter
    MF = xClose - xhl2 + TP - TP1
    FveFactor =  iff(MF > CutOff * xClose, 1, 
                  iff(MF < -1 * CutOff * xClose, -1,  0))
    xVolumePlusMinus = xVolume * FveFactor
    Fvesum = sum(xVolumePlusMinus, Samples)
    VolSum = sum(xVolume, Samples)
    xFVE = (Fvesum / VolSum) * 100
    xEMAFVE = ema(xFVE, Perma)
    pos :=iff(xFVE > xEMAFVE, 1,
    	   iff(xFVE < xEMAFVE, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Volatility Finite Volume Elements", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Samples = input(22, minval=1)
Perma = input(40, minval=1)
Cintra = input(0.1)
Cinter = input(0.1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posFVI = FVI(Samples,Perma,Cintra,Cinter)
pos = iff(posReversal123 == 1 and posFVI == 1 , 1,
	   iff(posReversal123 == -1 and posFVI == -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 )