ケルトナーチャネルとCCI指標に基づくトレンドフィルタリング定量戦略


作成日: 2024-02-27 15:47:20 最終変更日: 2024-02-27 15:47:20
コピー: 0 クリック数: 715
1
フォロー
1617
フォロワー

ケルトナーチャネルとCCI指標に基づくトレンドフィルタリング定量戦略

概要

この戦略は,ケントナー・チャネル,CCI指標,およびRSI指標と取引量の条件を組み合わせて,より完全なトレンド過量化取引戦略を実現する.この戦略は,重要な価格領域,指標の取引信号,および大規模な取引量の出現を突破したときに,買入と売却の信号を生成することができる.同時に,戦略は,均等な傾向判断を加え,明確な傾向がない場合に取引を避ける.

戦略原則

この戦略は,以下の指標と条件に基づいて取引決定を行います.

  1. ケンター通路:特定の周期における典型的な価格とATRの計算により,価格が通路区域内にあるかどうかを判断する.

  2. CCI指数:価格が過買過売であるかどうかを判断する.

  3. RSI指数:価格が過買過売であるかを判断する補助指標.

  4. 取引量:取引量が一定平均値を突破して取引が生成される.

  5. 平均線トレンドフィルター:SMA,EMAなどの平均線指標を組み合わせて,価格全体のトレンド方向を判断する.

トレンド方向に適合する条件で,価格がケンターン通路を突破して上下すると,CCIとRSIが信号を発し,取引量が大きく増加すると,買入と売却の信号が生じます.

戦略的優位性

この戦略は,複数の指標と条件を組み合わせて,いくつかの不確実な取引信号を効果的に除し,取引決定をより安定して信頼できるようにします.主な利点は:

  1. トレンドフィルタリングは,不透明な市場の波動を回避します.

  2. ケンタナ・チャネルは,価格が重要な領域を突破したと判断した.

  3. CCIとRSIは,超買超売のシグナルを発信するタイミングがより正確である.

  4. 取引量が大きい場合,偽の破綻を避けることができます.

戦略リスク

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

  1. トレンド判断の仕組みは不完全で,より強いトレンドの機会を逃す可能性がある。異なる平均線パラメータをテストすることができる。

  2. 指数パラメータの設定が不適切で,重要な取引のタイミングを逃したり,誤ったシグナルを生成したりする可能性があります.パラメータを最適化できます.

  3. 取引量増幅の効果が目立たない場合,偽の突破のリスクはある.異なる取引量増幅の倍数をテストすることができる.

戦略最適化の方向性

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

  1. 異なるタイプと長さの平均線をテストし,より適切なトレンドフィルタリングパラメータを見つけます.

  2. ケンター通路,CCI,RSIなどの指標のパラメータを最適化し,信号をより正確にする.

  3. 異なる取引量を拡大倍数でテストし,より適切な倍数を見つけます.

  4. 単一取引の最大損失を制御するために,ストップ・ロスの策略を導入することを検討することができます.

要約する

全体として,この戦略は,ケルトナーチャネル,CCI,RSI指標と取引量条件を組み合わせて,比較的完全なトレンド過量化取引戦略を作成する.価格が重要な領域を突破すると,指標は取引信号を与え,大きな取引量が発生すると,それは買入と売却のシグナルを生成する.同時に,移動平均を使用して,明確なトレンドがない取引を避けるためにトレンド判断を行う.この戦略は,不明確な波動的な市場を避ける,重要な突破点を識別する,比較的正確なオーバーバイ/オーバーセール信号を取得する,そしていくつかの偽の突破を防ぐなどの利点を持っています.パラメータの設定が不適切であり,ボリューム効果の拡大が不平等であるリスクがあります.

ストラテジーソースコード
/*backtest
start: 2024-01-27 00:00:00
end: 2024-02-26 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("Custom Keltner CCI Strategy with Trend Filter", overlay=true )
// Input Parameters for allowing long and short trades
allowLong = input(true, title="Allow Long Trades")
allowShort = input(true, title="Allow Short Trades")
// Trend Filter Inputs
maType = input(title="MA Type", options=["OFF", "SMA", "EMA", "SMMA", "CMA", "TMA"], defval="OFF")
trendFilterMethod = input(title="Trend Filter Method", options=["OFF", "Normal", "Reversed"], defval="OFF")
maLength = input(14, title="MA Length")
// Other Input Parameters
lengthKC = input(30, title="Keltner Channels Length")
multKC = input(0.7, title="Keltner Channels Multiplier")
lengthCCI = input(5, title="CCI Length")
overboughtCCI = input(75, title="CCI Overbought Level")
oversoldCCI = input(-75, title="CCI Oversold Level")
rsiPeriod = input(30, title="RSI Period")
rsiOverbought = input(60, title="RSI Overbought Level")
rsiOversold = input(60, title="RSI Oversold Level")
volumeMultiplier = input(0, title="Volume Multiplier", type=input.float, step=0.1, minval=0)
// Define Moving Averages
var float maValue = na
if (maType == "SMA")
    maValue := sma(close, maLength)
else if (maType == "EMA")
    maValue := ema(close, maLength)
else if (maType == "SMMA")
    maValue := na(maValue[1]) ? sma(close, maLength) : (maValue[1] * (maLength - 1) + close) / maLength
else if (maType == "CMA")
    maValue := na(maValue[1]) ? sma(close, maLength) : (sma(close, maLength) + (sma(close, maLength) - maValue[1])) / 2
else if (maType == "TMA")
    maValue := sma(sma(close, round(maLength/2)), round(maLength/2)+1)
// Entry Conditions with Trend Filter
longCondition = allowLong and (trendFilterMethod == "OFF" or (trendFilterMethod == "Normal" and close > maValue) or (trendFilterMethod == "Reversed" and close < maValue))
shortCondition = allowShort and (trendFilterMethod == "OFF" or (trendFilterMethod == "Normal" and close < maValue) or (trendFilterMethod == "Reversed" and close > maValue))
// Keltner Channels
typicalPrice = hlc3
middleLine = sma(typicalPrice, lengthKC)
range = multKC * atr(lengthKC)
upperChannel = middleLine + range
lowerChannel = middleLine - range
// CCI
cci = cci(close, lengthCCI)
// RSI
rsi = rsi(close, rsiPeriod)
// Volume
volCondition = volume > sma(volume, 50) * volumeMultiplier
// Combined Entry Conditions with Trend Filter
longCondition := longCondition and cci < oversoldCCI and low < lowerChannel and rsi < rsiOversold and volCondition
shortCondition := shortCondition and cci > overboughtCCI and high > upperChannel and rsi > rsiOverbought and volCondition
// Execute orders at the open of the new bar after conditions are met
if (longCondition)
    strategy.entry("Long", strategy.long)
if (shortCondition)
    strategy.entry("Short", strategy.short)
// Exit Conditions
strategy.close("Long", when = cci > 0)
strategy.close("Short", when = cci < 0)
// Plotting
plot(upperChannel, color=color.red, linewidth=1)
plot(lowerChannel, color=color.green, linewidth=1)
hline(overboughtCCI, "Overbought", color=color.red)
hline(oversoldCCI, "Oversold", color=color.green)