트렌드 필터 켈트너 채널과 CCI 지표에 기초한 양적 전략

저자:차오장, 날짜: 2024-02-27 15:47:20
태그:

img

전반적인 설명

이 전략은 켈트너 채널, CCI 지표 및 RSI 지표를 거래량 조건과 결합하여 상대적으로 완전한 트렌드 필터링 양적 거래 전략을 만듭니다. 가격이 주요 영역을 넘어서고, 지표가 거래 신호를 제공하며, 큰 거래량이 나타나면 구매 및 판매 신호를 생성합니다. 동시에 명확한 트렌드가없는 거래를 피하기 위해 이동 평균을 트렌드 판단에 사용합니다.

전략 논리

전략은 주로 다음의 지표와 조건에 기초하여 거래 결정을 합니다.

  1. 켈트너 채널: 통상 가격과 기간 동안의 ATR을 기반으로 상위 및 하위 대역을 계산하여 가격이 채널 내에 있는지 여부를 결정합니다.

  2. CCI 지표: 가격의 과잉 구매 또는 과잉 판매 여부를 결정하는 데 사용됩니다.

  3. RSI 인디케이터: 과잉 구매/ 과잉 판매 수준을 판단하는 데 도움이 됩니다.

  4. 거래 부피: 특정 이동 평균 값의 파업이 필요합니다.

  5. MAs와 트렌드 필터: 전체 트렌드 방향을 결정하기 위해 SMA, EMA 등을 사용합니다.

트렌드 방향 조건이 충족되면, 가격 파기 켈트너 채널 대역, CCI 및 RSI가 신호를 주고 거래량이 급증하면 구매 및 판매 신호가 생성됩니다.

장점

이 전략은 여러 지표와 조건을 결합하여 불확실한 신호를 필터링하고 더 신뢰할 수있는 결정을 내립니다.

  1. 트렌드 필터는 불분명한 변동성 시장을 피합니다.

  2. 켈트너 채널이 주요 탈출 수치를 확인했습니다.

  3. CCI와 RSI 신호는 비교적 정확합니다.

  4. 부피가 증가하면 가짜 발진을 예방할 수 있습니다.

위험성

주요 위험:

  1. 잘못된 트렌드 판단은 더 강한 트렌드를 놓칠 수 있습니다. 다른 MA 매개 변수를 테스트하십시오.

  2. 잘못된 지표 매개 변수는 누락되거나 잘못된 신호를 일으킬 수 있습니다. 매개 변수를 최적화하십시오.

  3. 비효율적인 부피 확대로 인해 잘못된 발사 위험이 있습니다.

최적화 방향

잠재적인 최적화 방향:

  1. 더 나은 트렌드 필터를 위해 다른 MA 유형과 길이를 테스트합니다.

  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)

더 많은