골든 크로스 켈트너 채널 트렌드 전략

저자:차오장, 날짜: 2023-11-02 14:31:10
태그:

img

전반적인 설명

골든 크로스 켈트너 채널 트렌드 추적 전략은 트렌드 방향으로만 거래하는 전략입니다. 트렌드 방향을 파악하기 위해 이동 평균 골든 크로스와 켈트너 채널을 입력 신호로 결합합니다.

원칙

이 전략은 두 개의 이동 평균, 단기 및 장기 이동 평균을 사용하여 금색 십자가와 죽음의 십자가를 형성하여 트렌드 방향을 결정합니다. 동시에 사용자 정의 곱셈을 사용하여 켈트너 채널의 상부 및 하부 레일을 그래프화하고 가격이 채널을 통과 할 때 거래 신호를 생성합니다.

구체적으로, 전략은 먼저 장기 이동 평균이 단기 이동 평균보다 높는지 확인하고, 황금 십자가와 상승 추세를 나타냅니다. 단기 MA가 장기 MA보다 낮다면, 그것은 사망 십자가이며, 하락 추세를 나타냅니다.

트렌드 결정에 따라 가격이 상단 레일 이상으로 돌파하면 긴 신호가 생성됩니다. 가격이 하단 레일 아래로 돌파하면 짧은 신호가 생성됩니다. 사용자는 MA 기간과 채널 폭을 조정하여 전략 매개 변수를 사용자 정의 할 수 있습니다.

진입 후, 전략은 사용자 정의 ATR 곱셈을 사용하여 수익을 취하고 손실을 중지합니다. 또한 더 유연한 위치 통제를 위해 추가적인 손익분기 및 손실을 중지 조건을 제공합니다.

이점 분석

이 전략은 트렌드 추적과 채널 브레이크업의 장점을 결합하여 효과적인 트렌드 식별과 기회를 포착 할 수 있습니다. 주요 장점은 다음과 같습니다.

  1. 황금 십자가는 주요 추세와 일치하지 않는 잘못된 신호를 필터링합니다.

  2. 트렌드 방향의 채널 브레이크오프가 입력 정확성을 향상시킵니다.

  3. 이윤을 취하고 손해를 멈추는 것은 이윤을 보존하고 위험을 통제합니다.

  4. 유연한 매개 변수 조절은 다양한 제품과 환경에 적합합니다.

  5. 길고 짧게 적용 가능성을 넓혀줍니다.

위험 분석

이점에도 불구하고, 몇 가지 위험 요소는 주의가 필요합니다.

  1. 역행할 기회를 놓치고

  2. 트렌드 변화는 손실로 이어질 수 있습니다.

  3. 부적절한 매개 변수들은 과도한 거래 또는 희박한 거래로 이어질 수 있습니다.

  4. 하루가 지나면 위험할 수 있습니다.

  5. 곡선 적응 위험.

해결책은 매개 변수 최적화, 적절한 MA 기간 조정 및 위치 사이징 제어입니다.

최적화 방향

추가 개선의 여지가 있습니다.

  1. 더 많은 지표를 추가하여 다인자 모델을 구축하고 정확도를 향상시킵니다. 예를 들어 MACD, RSI.

  2. 시장 적응력을 위한 기계 학습을 통한 매개 변수 최적화

  3. 이윤과 보상을 균형을 맞추기 위한 동적 취득 및 중단 손실 규칙

  4. 변동성에 기초한 역동적 위치 크기

  5. 다양한 제품에 대한 최적의 매개 변수를 연구합니다.

  6. 수수료를 최소화하기 위해 거래 빈도를 줄이세요.

결론

골든 크로스 켈트너 채널 트렌드 추적 전략은 일반적으로 안정적이고 신뢰할 수 있는 트렌드 추적 시스템이다. 트렌드 필터링과 채널 브레이크오웃을 결합함으로써 트렌드 방향과 일치하는 높은 확률의 기회를 식별한다. 추가 최적화와 향상으로 강력한 거래 프레임워크가 될 수 있다.


/*backtest
start: 2022-10-26 00:00:00
end: 2023-11-01 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © OversoldPOS

//@version=5
// strategy("Keltner Channel Strategy by OversoldPOS", overlay=true,initial_capital = 100000,default_qty_type = strategy.percent_of_equity,default_qty_value = 10, commission_type = strategy.commission.cash_per_order, commission_value = 7)

// Parameters
length = input(21, title="MA Length")
Entrymult = input(1, title="Entry ATR")
profit_mult = input(4, title="Profit Taker")
exit_mult = input(-1, title="Exit ATR")

// Moving Average Type Input
ma_type = input.string("SMA", title="Moving Average Type", options=["SMA", "EMA", "WMA"])

// Calculate Keltner Channels for different ATR multiples
atr_value = ta.atr(length)

basis = switch ma_type
    "SMA" => ta.sma(close, length)
    "EMA" => ta.ema(close, length)
    "WMA" => ta.wma(close, length)
 

//
EntryKeltLong = basis + Entrymult * ta.atr(10)
EntryKeltShort = basis - Entrymult * ta.atr(10)
upper_channel1 = basis + 1 * ta.atr(10)
lower_channel1 = basis - 1 * ta.atr(10)
upper_channel2 = basis + 2 * ta.atr(10)
lower_channel2 = basis - 2 * ta.atr(10)
upper_channel3 = basis + 3 * ta.atr(10)
lower_channel3 = basis - 3 * ta.atr(10)
upper_channel4 = basis + 4 * ta.atr(10)
lower_channel4 = basis - 4 * ta.atr(10)

// Entry condition parameters
long_entry_condition = input(true, title="Long Positions")
short_entry_condition = input(true, title="Enable Short Positions")

// Additional conditions for long and short entries
is_long_entry = ta.ema(close, 20) > ta.ema(close, 50)
is_short_entry = ta.ema(close, 20) < ta.ema(close, 50)

// Additional conditions for long and short entries
MAShort =  input(50, title="Short MA for Golden Cross")
MALong =  input(200, title="Long MA for Golden Cross")
is_long_entry2 = ta.ema(close, MAShort) > ta.ema(close, MALong)
is_short_entry2 = ta.ema(close, MAShort) < ta.ema(close, MALong)

// Exit condition parameters
long_exit_condition1_enabled = input(true, title="Enable Long Profit Taker")
long_exit_condition2_enabled = input(true, title="Enable Long Stop")
short_exit_condition1_enabled = input(true, title="Enable Short Profit Taker")
short_exit_condition2_enabled = input(true, title="Enable Short Stop")

// Take Profit condition parameters
take_profit_enabled = input(true, title="Enable Take Profit Condition")

Takeprofit = basis + profit_mult * atr_value
STakeprofit = basis - profit_mult * atr_value

// Long entry condition
long_condition = long_entry_condition and ta.crossover(close, EntryKeltLong) and is_long_entry2

// Short entry condition
short_condition = short_entry_condition and ta.crossunder(close, EntryKeltShort) and is_short_entry2

// Exit conditions
long_exit_condition1 = long_exit_condition1_enabled and close > Takeprofit
long_exit_condition2 = long_exit_condition2_enabled and close < basis + exit_mult * atr_value
short_exit_condition1 = short_exit_condition1_enabled and close < STakeprofit
short_exit_condition2 = short_exit_condition2_enabled and close > basis - exit_mult * atr_value

// Strategy logic
if (long_condition)
    strategy.entry("Long", strategy.long)
if (short_condition)
    strategy.entry("Short", strategy.short)

if (long_exit_condition1 or long_exit_condition2)
    strategy.close("Long")

if (short_exit_condition1 or short_exit_condition2)
    strategy.close("Short")

// Moving Averages
var float MA1 = na
var float MA2 = na

if (ma_type == "SMA")
    MA1 := ta.sma(close, MAShort)
    MA2 := ta.sma(close, MALong)
else if (ma_type == "EMA")
    MA1 := ta.ema(close, MAShort)
    MA2 := ta.ema(close, MALong)
else if (ma_type == "WMA")
    MA1 := ta.wma(close, MAShort)
    MA2 := ta.wma(close, MALong)

// Plotting Keltner Channels with adjusted transparency
transparentColor = color.rgb(255, 255, 255, 56)

plot(upper_channel1, color=transparentColor, title="Upper Channel 1")
plot(lower_channel1, color=transparentColor, title="Lower Channel 1")
plot(upper_channel2, color=transparentColor, title="Upper Channel 2")
plot(lower_channel2, color=transparentColor, title="Lower Channel 2")
plot(upper_channel3, color=transparentColor, title="Upper Channel 3")
plot(lower_channel3, color=transparentColor, title="Lower Channel 3")
plot(upper_channel4, color=transparentColor, title="Upper Channel 4")
plot(lower_channel4, color=transparentColor, title="Lower Channel 4")
plot(basis, color=color.white, title="Basis")
plot(MA1, color=color.rgb(4, 248, 216), linewidth=2, title="Middle MA")
plot(MA2, color=color.rgb(220, 7, 248), linewidth=2, title="Long MA")


더 많은