モメンタム反転移動平均組み合わせ戦略


作成日: 2024-01-12 12:22:47 最終変更日: 2024-01-12 12:22:47
コピー: 0 クリック数: 639
1
フォロー
1617
フォロワー

モメンタム反転移動平均組み合わせ戦略

概要

この戦略は,123反転戦略とCMO均線戦略を組み合わせて,買入シグナルを組み合わせる.123反転戦略は,株価が2日連続で閉店し,新しい高点または低点を形成し,ランダムな指標と組み合わせて,市場の買入力を判断し,取引シグナルを生成する.CMO均線戦略は,CMO指標を使用して,価格動きを判断し,取引シグナルを生成する.シグナル 両戦略のシグナルが組み合わせて,より信頼性の高い組み合わせのシグナルを生成する.

戦略原則

123反転戦略は,以下の原理を用いて取引信号を生成する.

  1. 2日連続で値上がりし,その9日目でランダムな指標が50を下回ったとき,多額の取引を行う.
  2. 閉盤価格が2日連続で下落し,その9日のランダムな指標が50を超えると空白します.

この戦略は,価格が短期間に新しい高点または低点を形成するかどうかを判断し,ランダムな指標の多空指標と組み合わせて取引信号を生成する.

CMO均線戦略は,以下の原理を用いて取引信号を生成する.

  1. 5日目,10日目,20日目のCMO値を計算する
  2. 平均値を求めます.
  3. 平均的なCMOが70歳以上なら もっと働け
  4. 平均CMOが70以下なら 仕事を休む

この戦略は,異なる周期のCMO値の集合操作によって,価格動力の指標の多空性を判断し,取引信号を生成する.

組み合わせ戦略は2つの戦略の信号に対してAND操作を行います.つまり,2つの戦略の信号が同時に多額の取引をしたり,同時に空いているとき,組み合わせ戦略が実際の取引信号を生成するだけです.

戦略的優位性

この戦略の利点は以下の通りです.

  1. 組合せ信号はより信頼性があり,偽信号を減らす.
  2. 123 逆転策は短期的な調整後のトレンドを捉えるのに適しています
  3. CMOの平均線戦略は,大レベルの価格動向を判断する
  4. 異なる市場環境に対応できる

リスク分析

この戦略には以下のリスクもあります.

  1. 123反転策は価格の形状に依存し,効果が低下する可能性がある
  2. CMO指数は市場の変動に敏感で,誤ったシグナルを発信する可能性があります.
  3. 組合せ戦略のシグナルが保守的になり,取引の機会を逃す
  4. 周期や市場の状況に適したパラメータの調整が必要

対応策として:

  1. 逆転戦略を最適化する形状判定規則
  2. CMOの均等な戦略に他の補助指標を追加する
  3. 最近の戦略効果の評価,動的調整パラメータ

最適化の方向

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

  1. 機械学習アルゴリズムを使用して,組合せ重量を自動的に最適化
  2. ポリシーのパラメータを動的に最適化するために,自主調節モジュールを追加
  3. ストップ・モジュールを追加し,リスクを効果的にコントロールする
  4. 戦略の健全性を評価し,形状認識アルゴリズムを改良する
  5. 業界選択,基本面などの要素

要約する

この戦略は123反転とCMO均線の2つの相互補完的な戦略を用い,有効な組合せ取引戦略を形成する.リスクを制御する前提で,安定した余剰収益を生成できる.アルゴリズムとモデルの継続的な最適化とともに,この戦略の収益率と安定性がさらに向上することを期待する.

ストラテジーソースコード
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 19/09/2019
// 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 plots average of three different length CMO's. This indicator 
//    was developed by Tushar Chande. A scientist, an inventor, and a respected 
//    trading system developer, Mr. Chande developed the CMO to capture what he 
//    calls "pure momentum". For more definitive information on the CMO and other 
//    indicators we recommend the book The New Technical Trader by Tushar Chande 
//    and Stanley Kroll.
//    The CMO is closely related to, yet unique from, other momentum oriented 
//    indicators such as Relative Strength Index, Stochastic, Rate-of-Change, etc. 
//    It is most closely related to Welles Wilder?s RSI, yet it differs in several ways:
//    - It uses data for both up days and down days in the numerator, thereby directly 
//    measuring momentum;
//    - The calculations are applied on unsmoothed data. Therefore, short-term extreme 
//    movements in price are not hidden. Once calculated, smoothing can be applied to 
//    the CMO, if desired;
//    - The scale is bounded between +100 and -100, thereby allowing you to clearly see 
//    changes in net momentum using the 0 level. The bounded scale also allows you to 
//    conveniently compare values across different securities.
//
// 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

CMOav(Length1,Length2,Length3, TopBand, LowBand) =>
    pos = 0
    xMom = close - close[1]
    xMomabs = abs(close - close[1])
    nSum1 = sum(xMom, Length1)
    nSumAbs1 = sum(xMomabs, Length1)
    nSum2 = sum(xMom, Length2)
    nSumAbs2 = sum(xMomabs, Length2)
    nSum3 = sum(xMom, Length3)
    nSumAbs3 = sum(xMomabs, Length3)
    nRes = 100 * (nSum1 / nSumAbs1 + nSum2 / nSumAbs2 + nSum3 / nSumAbs3 ) / 3
    pos := iff(nRes > TopBand, 1,
    	     iff(nRes < LowBand, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & CMOav", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Length1 = input(5, minval=1)
Length2 = input(10, minval=1)
Length3 = input(20, minval=1)
TopBand = input(70, minval=1)
LowBand = input(-70, maxval=-1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posCMOav = CMOav(Length1,Length2,Length3, TopBand, LowBand)
pos = iff(posReversal123 == 1 and posCMOav == 1 , 1,
	   iff(posReversal123 == -1 and posCMOav == -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 )