デュアルファクター定量的反転追跡戦略


作成日: 2023-12-20 17:26:38 最終変更日: 2023-12-20 17:26:38
コピー: 0 クリック数: 328
1
フォロー
1166
フォロワー

デュアルファクター定量的反転追跡戦略

概要

この戦略は123形状逆転と超振動指標の2つの因子を組み合わせ,双因子の量化逆転追跡取引を実現する.その基本的構想は,トレードが逆転している時に判断し,超振動指標の多空信号と組み合わせ,より正確なエントリータイミングを実現する.

この戦略は中短線反転取引に主に適用され,多因子確認により,偽反転を効果的にフィルターして信号品質を向上させることができる.

戦略原則

  1. 123 形を逆転する

前2日間の閉盘価格と現在の閉盘価格の大きさの関係を判断すると”,高-高-低”または”低-低-高”の形状が形成され,反転信号が発生する可能性を示唆する.

また,ストキャスティック指標が超買超売り領域にあることを要求し,反転信号をさらに確認し,偽反転をフィルターする.

  1. 超振動指数 (Awesome Oscillator)

Awesome Oscillatorは,中短期平均線と短期平均線の差値に基づいて構築された動的指標である. 速い線が上から下へとゆっくりとした線を横切るときは,売点; 下から上へと横切るときは,買点である.

この戦略は,この指標の空白状態を,買い値と売り値の判断に用いる.

  1. 2つの要素による確認

123形反転とAwesome Oscillatorの二重確認により,偽反転を効果的にフィルターし,エントリータイミングの精度を向上させることができる.

戦略的優位性

  1. 二重因子を使用して反転点の決定により,偽反転信号を効果的にフィルターすることができる.

  2. Awesome Oscillatorは,動力の指標として,エントリータイミングの精度を向上させることができる.

  3. ストキャスティック指標の導入は,追尾・追尾のリスクを回避する.

  4. 逆転戦略自体は,高い勝率と利益比の優位性を持っています.

戦略リスク

  1. 逆転失敗のリスクは依然として存在します.二重因子を採用することで確率を下げることができますが,そのリスクを完全に回避することはできません.

  2. 過剰最適化リスク 過剰最適化を防ぐために,指標パラメータの設定は,異なる市場に対してテスト最適化が必要である.

  3. 逆市リスク。強勢の状況では,逆転戦略が逆転損失を生じやすい。リスクを管理するためにストップを設定することができる。

戦略最適化の方向性

  1. テストは,指標のパラメータの組み合わせを最適化し,パラメータの頑丈性を向上させる.

  2. 単一損失を抑えるためのストップ・ロース戦略を導入する.

  3. 業界やセクターの選択を組み合わせて,不適切な株の選択を避ける.

  4. ポジション保持サイクルを最適化し,盲目追跡を防止する.

  5. 異なる均線系を補助条件としてテストする.

要約する

以上をまとめると,この二要素定量反転追跡戦略は,一定の利益確率と利益損失比率を保証した上で,Awesome Oscillatorをエントリータイムリング補助ツールとして採用し,ストキャスティック指標によって追尾殺入を回避することで,反転取引のリスクを効果的にコントロールできる.

しかし,逆転策の危険性も無視できない.指標パラメータの最適化,ストップ・ロスの条件の設定などにより,リスクをコントロールする必要がある.適切な操作であれば,この戦略は,投資家に安定した余剰利益をもたらすことができる.

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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 12/08/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
//    This indicator is based on Bill Williams` recommendations from his book 
//    "New Trading Dimensions". We recommend this book to you as most useful reading.
//    The wisdom, technical expertise, and skillful teaching style of Williams make 
//    it a truly revolutionary-level source. A must-have new book for stock and 
//    commodity traders.
//    The 1st 2 chapters are somewhat of ramble where the author describes the 
//    "metaphysics" of trading. Still some good ideas are offered. The book references 
//    chaos theory, and leaves it up to the reader to believe whether "supercomputers" 
//    were used in formulating the various trading methods (the author wants to come across 
//    as an applied mathemetician, but he sure looks like a stock trader). There isn't any 
//    obvious connection with Chaos Theory - despite of the weak link between the title and 
//    content, the trading methodologies do work. Most readers think the author's systems to 
//    be a perfect filter and trigger for a short term trading system. He states a goal of 
//    10%/month, but when these filters & axioms are correctly combined with a good momentum 
//    system, much more is a probable result.
//    There's better written & more informative books out there for less money, but this author 
//    does have the "Holy Grail" of stock trading. A set of filters, axioms, and methods which are 
//    the "missing link" for any trading system which is based upon conventional indicators.
//    This indicator plots the oscillator as a histogram where periods fit for buying are marked 
//    as blue, and periods fit for selling as red. If the current value of AC (Awesome Oscillator) 
//    is over the previous, the period is deemed fit for buying and the indicator is marked blue. 
//    If the AC values is not over the previous, the period is deemed fir for selling and the indicator 
//    is marked red.
//
// 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


BWAO(nLengthSlow,nLengthFast) =>
    pos = 0.0
    xSMA1_hl2 = sma(hl2, nLengthFast)
    xSMA2_hl2 = sma(hl2, nLengthSlow)
    xSMA1_SMA2 = xSMA1_hl2 - xSMA2_hl2
    pos := iff(xSMA1_SMA2 > xSMA1_SMA2[1], 1,
    	      iff(xSMA1_SMA2 < xSMA1_SMA2[1], -1, nz(pos[1], 0)))   
    pos

strategy(title="Combo Backtest 123 Reversal & Awesome Oscillator (AO)", 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, "---- Awesome Oscillator (AO) ----")
nLengthSlow = input(34, minval=1, title="Length Slow")
nLengthFast = input(5, minval=1, title="Length Fast")
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posBWAO = BWAO(nLengthSlow,nLengthFast)
pos = iff(posReversal123 == 1 and posBWAO == 1 , 1,
	   iff(posReversal123 == -1 and posBWAO == -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 )