CCI+이중 이동 평균 교차 수정 매수 전략

CCI MA
생성 날짜: 2024-05-24 17:45:49 마지막으로 수정됨: 2024-05-24 17:45:49
복사: 3 클릭수: 680
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

CCI+이중 이동 평균 교차 수정 매수 전략

개요

CCI+ 쌍평평선 교차 반입 구매 전략은 전진 지표 ((CCI) 와 쌍평평선 교차 신호를 종합적으로 활용하는 양적 거래 전략이다. 이 전략은 쌍평평선 금포가 형성된 후, 가격이 패스트 라인 근처에 반입하는 동안 CCI 지표가 초매할 때 구매하고, 사다리 형성된 후 가격이 패스트 라인 근처에 반입하는 동안 CCI 지표가 초매할 때 판매한다. CCI와 쌍평평선 교차 신호를 결합함으로써, 이 전략은 트렌드 기회를 더 잘 포착할 수 있으며, 동시에 반입 구매 및 반입 판매를 기다리는 동안 더 나은 입출 및 출출 기회를 얻을 수 있으며, 이를 통해 전략의 위험 수익률을 높일 수 있다.

전략 원칙

  1. CCI 지표를 계산합니다. 사용자 설정 CCI 매개 변수 (원 데이터, 주기, 이동 평균 유형, 오버 구매 오버 판매 마이너스) 에 따라 현재 CCI 값을 계산합니다.
  2. CCI를 과매매하는 것을 판단하기 위해 CCI가 과매매한 지점보다 크면 배경색을 빨간색으로, 과매매한 지점보다 작은 경우 배경색을 초록색으로 설정한다.
  3. 급속도 평균을 계산합니다. 사용자 설정된 급속도 평균 파라미터 (원 데이터, 주기, 이동 평균 유형) 에 따라 현재 급속도 평균을 계산합니다.
  4. 황금포크를 판단하여, 빠른 선에서 느린 선이 황금포크를 형성할 때 다단 신호를 그리고, 빠른 선 아래 느린 선이 죽은 포크를 형성할 때 공백 신호를 그리는 것이다.
  5. 거래 결정:
    • 다단 입시: 빠른 선이 느린 선 위에 있고, 이전 K 선의 종료 가격이 빠른 선 아래에 있고, 현재 K 선은 양선이며, CCI가 초과한 경치보다 작을 때 다단 입장을 구입합니다.
    • 공백 입시: 빠른 라인이 느린 라인의 아래에 있고, 이전 K 라인이 빠른 라인의 상단에서 종료되는 가격, 현재의 K 라인이 음선이며, CCI가 초과 구매 경계를 초과 할 때 공백을 판매합니다.

전략적 이점

  1. 트렌드 추적: 트렌드 방향을 판단하기 위해 쌍평선 교차 신호를 사용하여 시장 추세에 더 잘 부응할 수 있습니다.
  2. 역행 입시: 트렌드가 확립된 후 가격이 회수되어 구매하거나 반발하여 판매하는 것을 기다린다면 상대적으로 더 우수한 입시 가격을 얻을 수 있으며, 위험과 수익률을 높일 수 있다.
  3. 허위 신호를 감소: CCI 지표와 평균선 교차 신호를 결합하여 단일 지표에서 발생하는 허위 신호를 효과적으로 감소시킬 수 있다.
  4. 매개 변수 유연성: 사용자는 자신의 취향에 따라 CCI와 평균선 매개 변수를 유연하게 설정하여 전략의 성능을 최적화할 수 있다.

전략적 위험

  1. 흔들리는 시장 위험: 흔들리는 시장에서, 자주 금 포크의 사각지대가 전략이 더 많은 손실 거래를 초래할 수 있다.
  2. 변수 위험: 부적절한 변수 설정으로 인해 전략이 좋지 않을 수 있으며, 다양한 시장 조건에서 최적의 변수 조합에 대한 충분한 피드백과 분석이 필요합니다.
  3. 트렌드 리스크: 시장 추세가 역전될 때, 전략은 출전을 지연하여 더 큰 철회 위험을 감수할 수 있다.

전략 최적화 방향

  1. 포지션 관리를 도입하여, 현재 시장 추세의 강도와 변동률에 따라 각 거래의 포지션을 동적으로 조정하여 위험을 더 잘 제어합니다.
  2. 진입 조건을 최적화하여 거래량 지표 또는 기타 보조 판단 지표를 추가하여 진입 신호의 신뢰성을 향상시킵니다.
  3. 이동 중지 또는 시간 중지 설정과 같은 출구 조건을 최적화하여 단일 거래의 최대 손실을 줄입니다.
  4. 다양한 시장과 품종에 대한 변수 최적화, 전략의 적응성과 안정성을 향상 시키십시오.

요약하다

CCI+ 쌍평선 교차 반납 구매 전략은 트렌드 추적과 역전입의 장점을 겸비한 양적 거래 전략이다. 쌍평선으로 트렌드 방향을 포착하고 CCI 지표를 사용하여 오버 구매 오버 판매 범위를 구별하고 가격 반납과 반발을 기다리면서 더 우수한 진입 가격을 얻을 수 있습니다. 전략의 수익 잠재력과 위험 수익률을 어느 정도 높일 수 있습니다. 그러나 이 전략은 또한 지수 최적화, 시장의 흔들림 및 트렌드 돌파 등의 위험에 직면해 있으며, 전략의 안정성과 수익 능력을 강화하기 위해 추가적인 최적화 및 개선이 필요합니다. 전략 아이디어는 명확하고, 코드 구조는 완전하며, 전체적으로 실제 거래에 적합합니다.

전략 소스 코드
/*backtest
start: 2024-04-01 00:00:00
end: 2024-04-30 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tradedots

//@version=5
strategy("CCI + MA Crossover Pullback Buy Strategy [TradeDots]", overlay=true)


ma(source, length, type) =>
  type == "SMA" ? ta.sma(source[1], length) :
  type == "EMA" ? ta.ema(source[1], length) :
  type == "SMMA (RMA)" ? ta.rma(source[1], length) :
  type == "WMA" ? ta.wma(source[1], length) :
  type == "VWMA" ? ta.vwma(source[1], length) :
  na

//CCI settings
cci_coloring  = input.bool(true, "CCI Background Color", group = "Commodity channel index")
cci_length    = input.int(20,"CCI Length", group = "Commodity channel index")
cci_ma_type   = input.string("EMA","CCI MA Type", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group = "Commodity channel index")
cci_soruce    = input(hlc3, "CCI Source", group = "Commodity channel index")
cci_threshold = input.int(100, "CCI Threshold", group = "Commodity channel index")
cci_ma = ma(cci_soruce, cci_length, cci_ma_type)
cci = (cci_soruce - cci_ma) / (0.015 * ta.dev(cci_soruce, cci_length))

bgcolor(cci > cci_threshold and cci_coloring ? color.new(#f9396a, 80) : cci < -cci_threshold and cci_coloring? color.new(#9cff87, 80) : na, title = "CCI Overbought / Oversold")

//ma crossover settings
input_crossover_labels = input.bool(true, "Show Crossover Labels", group="Moving average")

fastma_type   = input.string("EMA","", inline="fastma", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Moving average")
fastma_source = input(close, "", inline="fastma", group="Moving average")
fastma_length = input.int(10, "", inline="fastma", minval=1,group="Moving average")
fastma_color  = input(#e2fdff, "", inline="fastma",group="Moving average")
fastma = ma(fastma_source, fastma_length, fastma_type)
fastmaPlot = plot(fastma, color = #b7e4c7, linewidth = 2, title = "Fast MA")

slowma_type   = input.string("EMA","", inline="slowma", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Moving average")
slowma_source = input(close, "", inline="slowma", group="Moving average")
slowma_length = input.int(30, "", inline="slowma", minval=1,group="Moving average")
slowma_color  = input(#e2fdff, "", inline="slowma",group="Moving average")
slowma = ma(slowma_source, slowma_length, slowma_type)
slowmaPlot = plot(slowma, color = #2d6a4f, linewidth = 2, title = "Slow MA")

bullish_crossover = ta.crossover(fastma, slowma)
bearish_crossover = ta.crossunder(fastma, slowma)

// // strategy
// if bullish_crossover and input_crossover_labels
//     line.new(bar_index, close, bar_index, close * 1.01, extend = extend.both, color = color.new(#9cff87, 30), style = line.style_dotted, width = 3)
//     label.new(bar_index,low, "Bullish Crossover", style = label.style_label_up, color = #9cff87)

// else if bearish_crossover and input_crossover_labels
//     line.new(bar_index, close, bar_index, close * 1.01, extend = extend.both, color = color.new(#f9396a, 30), style = line.style_dotted, width = 3)
//     label.new(bar_index, high, "Bearish Crossover", style = label.style_label_down, color = #f9396a, textcolor = color.white)

if fastma > slowma and close[1] < fastma and close > open and cci < -cci_threshold
    strategy.entry("Long", strategy.long)
    // if strategy.opentrades == 0 or strategy.opentrades.size(strategy.opentrades -1) < 0
    //     label.new(bar_index,low, "🟢 Long", style = label.style_label_up, color = #9cff87)

if fastma < slowma and close[1] > fastma and close < open and cci > cci_threshold
    strategy.entry("Short", strategy.short)
    // if strategy.opentrades == 0 or strategy.opentrades.size(strategy.opentrades -1) > 0
    //     label.new(bar_index, high, "🔴 Short", style = label.style_label_down, color = #f9396a, textcolor = color.white)