프로그레시브 BB KC 트렌드 전략


생성 날짜: 2024-01-26 15:10:41 마지막으로 수정됨: 2024-01-26 15:10:41
복사: 0 클릭수: 725
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

프로그레시브 BB KC 트렌드 전략

개요

이 전략은 브린띠와 케이트 라인 신호의 조합을 사용하여 시장의 흐름을 식별합니다. 브린띠는 가격 변동 범위에 따라 통로를 정의하는 기술적 분석 도구입니다. 케이트 라인 신호는 가격 변동성과 경향성을 결합하여 지지 또는 압력을 판단하는 기술적 지표입니다. 이 전략은 두 가지 지표의 장점을 통합하여 브린띠와 케이트 라인이 금색으로 교차하는지 여부를 판단하여 다중 공백 기회를 찾고, 동시에 합성 거래 상황을 검증하는 신호를 사용하여 트렌드의 시작을 효과적으로 식별하고 무효 신호를 최대한 압축합니다.

전략 원칙

  1. 20주기의 브린 중궤도, 상궤도 및 하궤도를 계산하고, 대역폭은 표준차의 2배를 통과하도록 규정한다.
  2. 20주기의 케이트 중궤도, 상궤도 및 하궤도를 계산하고, 실제 진동범위의 2.2배로 대역폭을 규정한다.
  3. 케이트가 오프라인에서 브린을 통과하고 10주기 평균보다 더 많은 거래량이 있을 때 더 많이 한다.
  4. 케이트가 오프라인 궤도 아래에서 브린带 아래 궤도를 뚫고 10주기 평균보다 큰 거래량이 있을 때, 공백한다.
  5. 포지션 개설 후 20 K 라인이 퇴출되지 않으면 강제적으로 정지 손실 퇴출한다.
  6. 더할 때 1.5%의 스톱로스, 코카이도 1.5%의 스톱로스; 더할 때 2%의 추적 스톱로스, 코카이도 2%의 추적 스톱로스.

이 전략은 주로 브린 대역의 진동 범위와 강도를 판단하는 데 의존하며, 케이트 라인 보조 검증을 이용한다. 두 가지의 다른 파라미터의 하지만 특성상 유사한 지표가 함께 사용되어 신호의 정확도를 높일 수 있으며, 교류량의 도입도 무효 신호를 효과적으로 줄일 수 있다.

우위 분석

  1. 브린 띠와 케이트 라인 두 가지 지표의 장점을 종합적으로 활용하여 거래 신호의 정확도를 높였습니다.
  2. 합성 거래량 지표는 시장의 빈번한 충돌선 무효 신호를 효과적으로 줄일 수 있다.
  3. 스톱로스 및 스톱로스 추적 메커니즘을 설정하여 위험을 효과적으로 제어합니다.
  4. 무효 신호 이후의 강제 스톱 스톱 손실 설정은 스톱 스톱을 빠르게 중지 할 수 있습니다.

위험 분석

  1. 브린 밴드 (Brin Band) 와 케이트 선 (Kate Line) 은 모두 이동 평균선 (moving average line) 에 기반하여 변동성 계산을 결합한 지표이며, 진동상황에서 잘못된 신호가 발생하기 쉽다.
  2. 이득이 없는 제도, 여러번의 수축으로 인해 과도한 손실이 발생할 수 있다.
  3. 반전 신호는 더 흔하며, 변수를 조정하면 트렌드 기회를 잃을 수 있다. 적절히 느슨한 스톱 로즈 폭을 허용하거나, MACD와 같은 보조 지표 필터링 신호를 추가하여 잘못된 신호의 위험을 줄일 수 있다.

최적화 방향

  1. 전략의 수익률에 대한 다양한 변수의 영향을 테스트 할 수 있습니다. 조정 평균선 길이, 표준 차이의 배수 등과 같은 변수입니다.
  2. KDJ 지수 또는 MACD 지수와 같은 신호를 결정하기 위해 다른 지수 판단에 추가될 수 있다.
  3. 기계학습을 통해 자동으로 최적화할 수 있다.

요약하다

이 전략은 시장의 추세를 식별하기 위해 브린 밴드 및 케이트 라인 지표를 종합적으로 사용하며, 거래량 지표로 신호를 검증합니다. 파라미터를 최적화하고, 다른 기술 지표를 추가하는 등의 방법으로이 전략을 더욱 강화하여 보다 광범위한 시장 상황에 적응할 수 있도록 할 수 있습니다. 이 전략은 전체적으로 실행성이 강하며, 쉽게 파악하고 조정할 수 있는 정량 거래 전략 중 하나입니다.

전략 소스 코드
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
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/
// © jensenvilhelm

//@version=5
strategy("BB and KC Strategy", overlay=true)

// Define the input parameters for the strategy, these can be changed by the user to adjust the strategy
kcLength = input.int(20, "KC Length", minval=1) // Length for Keltner Channel calculation
kcStdDev = input.float(2.2, "KC StdDev") // Standard Deviation for Keltner Channel calculation
bbLength = input.int(20, "BB Length", minval=1) // Length for Bollinger Bands calculation
bbStdDev = input.float(2, "BB StdDev") // Standard Deviation for Bollinger Bands calculation
volumeLength = input.int(10, "Volume MA Length", minval=1) // Length for moving average of volume calculation
stopLossPercent = input.float(1.5, "Stop Loss (%)") // Percent of price for Stop loss 
trailStopPercent = input.float(2, "Trail Stop (%)") // Percent of price for Trailing Stop
barsInTrade = input.int(20, "Bars in trade before exit", minval = 1) // Minimum number of bars in trade before considering exit

// Calculate Bollinger Bands and Keltner Channel
[bb_middle, bb_upper, bb_lower] = ta.bb(close, bbLength, bbStdDev) // Bollinger Bands calculation
[kc_middle, kc_upper, kc_lower] = ta.kc(close, kcLength, kcStdDev) // Keltner Channel calculation

// Calculate moving average of volume
vol_ma = ta.sma(volume, volumeLength) // Moving average of volume calculation

// Plotting Bollinger Bands and Keltner Channels on the chart
plot(bb_upper, color=color.red) // Bollinger Bands upper line
plot(bb_middle, color=color.blue) // Bollinger Bands middle line
plot(bb_lower, color=color.red) // Bollinger Bands lower line
plot(kc_upper, color=color.rgb(105, 255, 82)) // Keltner Channel upper line
plot(kc_middle, color=color.blue) // Keltner Channel middle line
plot(kc_lower, color=color.rgb(105, 255, 82)) // Keltner Channel lower line

// Define entry conditions: long position if upper KC line crosses above upper BB line and volume is above MA of volume
// and short position if lower KC line crosses below lower BB line and volume is above MA of volume
longCond = ta.crossover(kc_upper, bb_upper) and volume > vol_ma // Entry condition for long position
shortCond = ta.crossunder(kc_lower, bb_lower) and volume > vol_ma // Entry condition for short position

// Define variables to store entry price and bar counter at entry point
var float entry_price = na // variable to store entry price
var int bar_counter = na // variable to store bar counter at entry point

// Check entry conditions and if met, open long or short position
if (longCond)
    strategy.entry("Buy", strategy.long) // Open long position
    entry_price := close // Store entry price
    bar_counter := 1 // Start bar counter
if (shortCond)
    strategy.entry("Sell", strategy.short) // Open short position
    entry_price := close // Store entry price
    bar_counter := 1 // Start bar counter

// If in a position and bar counter is not na, increment bar counter
if (strategy.position_size != 0 and na(bar_counter) == false)
    bar_counter := bar_counter + 1 // Increment bar counter

// Define exit conditions: close position if been in trade for more than specified bars
// or if price drops by more than specified percent for long or rises by more than specified percent for short
if (bar_counter > barsInTrade) // Only consider exit after minimum bars in trade
    if (bar_counter >= barsInTrade)
        strategy.close_all() // Close all positions
    // Stop loss and trailing stop
    if (strategy.position_size > 0)
        strategy.exit("Sell", "Buy", stop=entry_price * (1 - stopLossPercent/100), trail_points=entry_price * trailStopPercent/100) // Set stop loss and trailing stop for long position
    else if (strategy.position_size < 0)
        strategy.exit("Buy", "Sell", stop=entry_price * (1 + stopLossPercent/100), trail_points=entry_price * trailStopPercent/100) // Set stop loss and trailing stop for short position