二重逆転のCMOの量子戦略

作者: リン・ハーンチャオチャン,日付: 2024-01-04 14時35分23秒
タグ:

img

概要

この戦略は2重逆転戦略であり,123逆転指標とCMOWMA量子指標を組み合わせて,赤と緑のK線視覚効果で価格逆転信号の二重確認を達成する.

戦略原則

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

  1. 123 逆転指数

    • 価格上昇または減少を決定するために,前の閉じる価格と閉じる価格を使用します.
    • 逆転信号を確認するためにストカスティック指標の高速線と遅い線クロスオーバーを使用します.
    • 条件が満たされたときに長または短信号を生成する
  2. CMOWMA量子指標

    • 価格動向を測定するためにCMO指標を使用する
    • WMA 重度の移動平均値をCMO指標に適用する
    • CMO が WMA を超えたとき (以下) は長目 (短目) を参照

両方の部分が同じ方向で信号を出すときに位置を入力します.

戦略 の 利点

  1. 二重確認メカニズムは,偽ブレーキをフィルターし,不要な位置を減らすことができます.
  2. 赤と緑のK線色付けは,市場状況を容易に判断するための視覚効果を生成します
  3. 逆転指標と動力指標の組み合わせは,全体的な安定性を提供します.
  4. シンプルなパラメータ設定により,さまざまな製品に適しており,実装が簡単です

戦略 の リスク

  1. 価格が初回逆転後,再び逆転する可能性があります.
  2. ポジションの頻繁な変更は,過剰な取引手数料を生む
  3. 誤ったパラメータ設定は,信号が多すぎたり少すぎたりする可能性があります.
  4. 商品の特徴に基づいて CMO パラメータを調整する必要がある

逆転条件を緩和し,保持期間を延長し,パラメータの組み合わせを最適化することでリスクを軽減できます.

オプティマイゼーションの方向性

  1. 異なるストカスティックパラメータの試験影響
  2. MACD,KDJなど他の指標で確認を置き換える/追加する.
  3. 異なるCMOとWMA長さのテスト最適化
  4. 特定のレベルでストップ・ロスト/プロフィート・テイクを追加してみてください.
  5. 新しい位置の頻度を制御するフィルターを設定する

概要

この戦略は,シンプルなパラメータ,実装が簡単で,価格逆転とモメント指標を組み合わせて,誤った信号を排除するための効果的な二重信号フィルタリングメカニズムを形成する.K線カラーリングは直感的なビジュアルを提供します.パラメータ最適化とリスク管理からさらなるパフォーマンス改善がもたらされます.


/*backtest
start: 2023-12-04 00:00:00
end: 2024-01-03 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 19/08/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 Chandre Momentum Oscillator and its WMA on the 
//    same chart. This indicator plots the absolute value of CMO.
//    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

CMOWMA(Length, LengthWMA) =>
    pos = 0
    xMom = abs(close - close[1])
    xSMA_mom = sma(xMom, Length)
    xMomLength = close - close[Length]
    nRes = 100 * (xMomLength / (xSMA_mom * Length))
    xWMACMO = wma(nRes, LengthWMA)
    pos := iff(nRes > xWMACMO, 1,
    	   iff(nRes <= xWMACMO, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & CMO & WMA", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthCMO = input(14, minval=1)
LengthWMA = input(13, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posCMOWMA = CMOWMA(LengthCMO, LengthWMA)
pos = iff(posReversal123 == 1 and posCMOWMA == 1 , 1,
	   iff(posReversal123 == -1 and posCMOWMA == -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 )

もっと