トレンド逆転波動性組み合わせ戦略

作者: リン・ハーンチャオチャン開催日:2023年10月24日 14:23:58
タグ:

img

概要

この戦略は,傾向逆転戦略と統計的変動戦略を組み合わせて,より強い取引信号を生成します.

働き方

戦略は2つの部分からなる.

  1. トレンド逆転戦略

    • 123 パターンを用いてトレンド逆転点を特定します.特に,ストーカスティックスローラインが50を下回り,9日ストーカスティックスローラインが50を超えると,ストーカスティックスローラインが2日下回り,9日ストーカスティックスローラインが50を超えると,ロングに行く.
  2. 統計的変動戦略

    • 極端値方法を使用して 30 日間の統計変動を計算します.変動が0.5%以上であれば長引く.変動が0.16%以下であれば短引く.

戦略は,両方の戦略が方向に合意するときにのみ取引信号を生成する (長または短の両方). そうでなければ,取引は行われない.

利点分析

コンボ戦略は,2種類の異なる戦略を組み合わせることで信号の信頼性を向上させる.

  1. 123パターンは 傾向の逆転点を正確に把握し 一回限りの価格上昇に惑わされないようにします

  2. 統計変動は,過去1ヶ月間の市場動向に基づいて,高い波動性,高機会期に重点を置いています.

この2つの戦略は互いに検証することで 市場の重要な転換点をより正確に把握し より正確な取引信号を生成します

リスク分析

  1. 123 パターンは 誤ったブレイクのリスクを完全に回避できません 不規則なウィップサウは 悪い信号を引き起こす可能性があります

  2. 統計変動は,過去のデータのみを考慮し,将来の変動変動を予測することはできません.突然の変動拡大または収縮は悪い信号につながる可能性があります.

  3. 両方の戦略はパラメータチューニングに大きく依存している.パラメータ設定が不十分である場合,信号品質が著しく低下する可能性がある.

  4. 総合的により信頼性があるものの,コンボアプローチは個々の戦略からの強い信号を見逃す可能性があります.

改善 の 分野

  1. ボリンジャーバンドやKDJなどの指標を 投票メカニズムに組み込む

  2. 機械学習アルゴリズムを追加して 傾向の逆転確率を 歴史的なデータを使って 決定します

  3. 信号強度の限界を設定してノイズをフィルタリングします.

  4. 異なる製品と時間枠のためのパラメータを最適化します.

  5. ストップ・ロスのメカニズムを追加し,組み合わせた戦略のリスクを制御します.

結論

この戦略は,トレンド逆転と統計的変動戦略を組み合わせることで信号品質を改善し,市場のターニングポイントの周りにより正確な取引信号を提供します.しかし,誤解のリスクとパラメータ最適化問題は残っています.より多くの指標や機械学習などのさらなる強化により,より堅牢で信頼性の高い取引信号につながる可能性があります.


/*backtest
start: 2023-09-23 00:00:00
end: 2023-10-23 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 31/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
// This indicator used to calculate the statistical volatility, sometime 
// called historical volatility, based on the Extreme Value Method.
// Please use this link to get more information about Volatility.
//
// 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


SV(Length,TopBand,LowBand) =>
    pos = 0.0
    xMaxC = highest(close, Length)
    xMaxH = highest(high, Length)
    xMinC = lowest(close, Length)
    xMinL = lowest(low, Length)
    SqrTime = sqrt(253 / Length)
    Vol = ((0.6 * log(xMaxC / xMinC) * SqrTime) + (0.6 * log(xMaxH / xMinL) * SqrTime)) * 0.5
    nRes = iff(Vol < 0,  0, iff(Vol > 2.99, 2.99, Vol))
    pos := iff(nRes > TopBand, 1,
    	     iff(nRes < LowBand, -1, nz(pos[1], 0)))
    pos

strategy(title="Combo Backtest 123 Reversal & Statistical Volatility", 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, "---- Statistical Volatility ----")
LengthSV = input(30, minval=1)
TopBand = input(0.005, step=0.001)
LowBand = input(0.0016, step=0.001)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posSV = SV(LengthSV,TopBand,LowBand)
pos = iff(posReversal123 == 1 and posSV == 1 , 1,
	   iff(posReversal123 == -1 and posSV == -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 )

もっと