複数の指標の検証に基づく定量的な取引戦略


作成日: 2023-09-15 11:55:04 最終変更日: 2023-09-15 11:55:04
コピー: 1 クリック数: 719
1
フォロー
1617
フォロワー

この記事では,複数の指標を検証して取引信号を形成する量化戦略について詳しく説明する.この戦略は,複数の指標の判断を総合的に適用して,信号の信頼性を高める.

戦略の原則

この戦略は2つの取引技術を組み合わせたものです.

(一) 123形状逆転戦略

  1. K線の収束価格関係を計算し,可能な底と頂点を判断する.

  2. ランダムな指標を組み合わせて反転信号を判断し,誤信号を回避する.

(二) 空多量指数平滑化

  1. 多空量指数とその移動平均の計算

  2. 指数と均等線による偏差の傾向を判断する

  3. 2つの技術の判断が一致する時のみ,最終的な取引信号が生成される.

複数の指標を検証することで,偽信号をフィルターし,信号の正確性を向上させることができます.

2 戦略的優位性

この戦略の最大の利点は,単一の指標の制限を回避し,信号の安定性を強化する多指標組み合わせの検証である.

判断の総合性をさらに高めることにより, 2つの異なるタイプの技術の組み合わせが別の優位性です.

最後に,組合せ使用は,最適化テストのためのより多くのパラメータスペースを提供します.

3 潜在的リスク

しかし,この戦略には問題もあります.

まず,多指標組合せはパラメータ最適化が難しくなり,不適切な設定により過最適化が起こりうる.

第二に,二つの技術的な信号の間で分歧が生じることから,明確な判断ルールを設定する必要がある.

最後に,ランダムな指標などの指標には遅れがあります.

内容と要約

この記事では,複数の指標を検証して取引を量化する戦略について詳しく説明する.これは,指標を組み合わせて信号の質を向上させるが,パラメータ最適化の難しさや指標の遅れなどの問題にも注意する必要がある.全体的に,この戦略は比較的安定した取引方法を提供する.

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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 21/07/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
// Accumulation is a term used to describe a market controlled by buyers;
// whereas distribution is defined by a market controlled by sellers.
// Williams recommends trading this indicator based on divergences:
//  Distribution of the security is indicated when the security is making 
//  a new high and the A/D indicator is failing to make a new high. Sell.
//  Accumulation of the security is indicated when the security is making 
//  a new low and the A/D indicator is failing to make a new low. Buy. 
//
// 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


SWAD(Length) =>
    pos = 0.0
    xWAD = 0.0
    xPrice = close
    xWAD:= iff(close > nz(close[1], 0), nz(xWAD[1],0) + close - low[1], 
             iff(close < nz(close[1],0), nz(xWAD[1],0) + close - high[1],0))
    xWADMA = sma(xWAD, Length)
    pos:= iff(xWAD > xWADMA, 1,
             iff(xWAD < xWADMA, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Smoothed Williams AD", 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, "---- Smoothed Williams AD ----")
LengthWillAD = input(14, step = 1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posSWAD = SWAD(LengthWillAD)
pos = iff(posReversal123 == 1 and posSWAD == 1 , 1,
	   iff(posReversal123 == -1 and posSWAD == -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 )