
이 전략은 켄터 통로, CCI 지표, 그리고 RSI 지표와 거래량 조건을 결합하여 보다 완전한 트렌드 과다량화 거래 전략을 구현한다. 이 전략은 중요한 가격 영역을 뚫고, 지표가 거래 신호를 발산하고, 큰 거래량이 나타나면 구매 및 판매 신호를 생성할 수 있다. 동시에, 전략은 평행선으로 트렌드 판단을 하고, 명확한 트렌드가 없는 상황에서 거래를 피한다.
이 전략은 다음과 같은 몇 가지 지표와 조건에 따라 거래 결정을 내립니다.
켄터터 통로: 특정 주기 동안의 전형적인 가격과 ATR 계산에 따라 경로 상향과 하향을 판단하여 가격이 통로 영역 내에 있는지 판단한다.
CCI 지표: 가격 과매매를 판단하기 위해 사용된다.
RSI 지표: 가격 과매매 여부를 판단하는 보조지표
거래량: 거래량이 특정 평균값을 돌파하는 것을 요구한다.
평균선 트렌드 필터: SMA, EMA 등의 평균선 지표와 결합하여 가격의 전반적인 경향 방향을 판단한다.
트렌드 방향에 부합하는 조건에서, 가격이 켄트너 통로를 돌파하고 CCI와 RSI가 신호를 내면 거래량이 크게 증가하면 구매 및 판매 신호가 발생한다.
이 전략은 다양한 지표와 조건을 결합하여 불확실한 거래 신호를 효과적으로 제거하여 거래 결정을 더욱 안정적으로 신뢰할 수 있습니다. 주요 장점은 다음과 같습니다.
트렌드 필터링 메커니즘은 불분명하게 흔들리는 시장을 피할 수 있습니다.
켄터키 통로 판정 가격 돌파가 핵심 지역이다.
CCI와 RSI는 오버 바이 오버 셀 신호를 더 정확하게 발산한다.
거래량이 많을 경우 가짜 돌파구를 피할 수 있습니다.
이 전략에는 다음과 같은 위험들이 있습니다.
트렌드 판단 메커니즘이 완벽하지 않아 강한 트렌드 기회를 놓칠 수 있다. 다양한 평균선 변수를 테스트할 수 있다.
지표 매개 변수가 잘못 설정되어 중요한 거래 시기를 놓치거나 잘못된 신호를 생성할 수 있습니다. 매개 변수를 최적화 할 수 있습니다.
거래량이 확대되는 효과가 보이지 않을 때, 가짜 돌파구가 발생할 위험이 있다. 다양한 거래량이 확대되는 배수를 테스트할 수 있다.
이 전략은 다음과 같은 부분에서 최적화될 수 있습니다.
다른 타입과 길이의 평균선을 테스트하여 더 적합한 트렌드 필터링 파라미터를 찾습니다.
켄터키 통로, CCI, RSI 등의 지표의 매개 변수를 최적화하여 신호를 더 정확하게 한다.
다른 거래량을 확대해서 더 적합한 곱수를 찾아보세요.
단일 거래의 최대 손실을 제어하기 위해 Stop Loss 전략을 추가하는 것을 고려할 수 있습니다.
전체적으로, 이 전략은 켈트너 채널, 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)