
この戦略は,商品通路指数 (CCI) の指標に基づいて市場の周期性および季節性特性を識別し,サイクルの始まりと終わりを捉えます.それは,移動平均と可能と実際の取引範囲を反映する除数を組み合わせて最終的な指数を形成し,それによって通常のレベルからの偏差を測定し,主要なトレンドの変化を示します.
商品通路指数 (CCI) 値は,その平均価格に対する取引方法を示すツールである.CCI値が高いときは,平均価格よりも高い価格を示す;CCI値が低いときは,平均価格よりも低い価格を示す.CCI値は,通常,300から300の範囲を超えない.
この戦略は,長さ10のCCI指数と,長さ10と20の単純な移動平均を使用する. 遅い移動平均が速い移動平均より低くなるときは多行し,遅い移動平均が速い移動平均より高くなるときは空白する. 入力設定で多行を空白して反転させることができる.
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")