コモディティチャネルインデックス逆転取引戦略

作者: リン・ハーンチャオチャン開催日:2024年1月29日 16:18:35
タグ:

img

概要

この戦略は,コモディティチャネルインデックス (CCI) をベースに,サイクルの開始と終了を検出するために,市場の周期的および季節的な特徴を特定します.これは,主要なトレンド変化を示す,通常のレベルからの偏差を測定するために,可能なおよび実際の取引範囲の両方を反映する移動平均値と除数を含めて,最終インデックスを形成します.

戦略の論理

コモディティチャネルインデックス (CCI) の値は,その平均価格との関係で取引されている方法を示しています.CCI値が高いとき,価格は平均価格よりも高いことを意味します.CCI値が低いとき,価格は平均価格よりも低いことを意味します.CCI値は通常 -300〜300範囲を超えて落ちません.

この戦略は,長さ10のCCI指標と長さ10と20の単純な移動平均を用い,スロームービング平均が速い平均を下回るとロングになり,スロームービング平均が速い平均を下回るとショートになります.長と短は入力設定で逆転することができます.

利点分析

  • CCI指標は周期的特徴と転換点を効果的に特定できる
  • 偽信号を減らすため,二重移動平均値でフィルタリング
  • 異なる市場環境で長または短方向を選択することができます.
  • 制御可能なリスクと明確なストップ・ロストレベル

リスク分析

  • 価格変動が大きい株ではCCIがうまく機能しないかもしれない
  • 移動平均値は遅れて,ターニングポイントを見逃す可能性があります.
  • 基本的要素は考慮されていない.価格が過大評価されているか過大評価されているかを判断できない.
  • ストップ・ロスは,より長い時間枠で割り切れます.

最適化は,CCIパラメータや移動平均期間の調整,または基礎を判断するための他の技術指標を追加することによって行なわれる.より大きな周期に閉じ込まれるのを避けるために,より大きなタイムフレームの傾向も使用することができる.

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

  • CCI パラメータを異なるサイクルと変動に最適化する
  • 遅延とノイズのバランスをとるために移動平均期を最適化
  • 実際のブレイクアウトを判断するためにボリュームのような指標を追加します
  • より長い時間枠における全体的な傾向を決定する

概要

この戦略は,CCIと二重移動平均を用い,周期的特徴を判断するために短期的傾向を特定する.その利点は,シンプルで明確なルール,柔軟なパラメータ調整,制御可能なリスクである.しかし,遅れや誤判の可能性は依然としてある.指標パラメータを調整し,より技術的または根本的な分析を組み込むことでより良い結果が得られる.


/*backtest
start: 2023-01-22 00:00:00
end: 2024-01-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version = 2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 30/11/2016
// The Commodity Channel Index (CCI) is best used with markets that display cyclical or 
// seasonal characteristics, and is formulated to detect the beginning and ending of these 
// cycles by incorporating a moving average together with a divisor that reflects both possible 
// and actual trading ranges. The final index measures the deviation from normal, which indicates 
// major changes in market trend.
// To put it simply, the Commodity Channel Index (CCI) value shows how the instrument is trading 
// relative to its mean (average) price. When the CCI value is high, it means that the prices are 
// high compared to the average price; when the CCI value is down, it means that the prices are low 
// compared to the average price. The CCI value usually does not fall outside the -300 to 300 range 
// and, in fact, is usually in the -100 to 100 range.
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="CCI Strategy Reversed Backtest", shorttitle="CCI Strategy")
FastMA = input(10, minval=1)
SlowMA = input(20, minval=1)
reverse = input(true, title="Trade reverse")
hline(0, color=purple)
xCCI = cci(close, 10)
xSMA = sma(xCCI,SlowMA)
xFMA = sma(xCCI,FastMA)
pos = iff(xSMA < xFMA , 1,
	   iff(xSMA > xFMA, -1, nz(pos[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)	   	    
barcolor(pos == -1 ? red: pos == 1 ? green : blue)
plot(xSMA, color=red, title="CCI MA Slow")
plot(xFMA, color=blue, title="CCI MA FAST")


もっと