쇼피니스 K-라인 돌파구 전략

저자:차오장, 날짜: 2023-10-07 15:59:26
태그:

전반적인 설명

쇼피니스 K-라인 돌파구 전략 (Choppiness K-line Breakthrough Strategy) 은 주식 거래의 입출구를 결정하기 위해 K-라인 패턴과 모멘텀 지표를 활용하는 양적 거래 전략이다. 이 전략은 여러 기술적 지표를 결합하여 가격 추세와 모멘텀 신호를 식별하고, 돌파구 지점에서 포지션을 취하고 스톱 로스를 설정하고 수익을 취하여 거래 위험을 효과적으로 제어합니다.

전략 논리

피니스 K-라인 돌파구 전략의 핵심 개념은 다음과 같습니다.

  1. 상품 채널 지표 (CCI) 를 사용하여 가격이 과잉 구매 또는 과잉 판매 구역에 있는지 여부를 결정합니다. CCI가 100을 넘으면 과잉 구매 신호로 간주되며 -100 아래를 넘으면 과잉 판매 신호로 간주됩니다.

  2. 돌파 신호를 감지하기 위한 K-라인 패턴을 식별합니다. 오픈보다 높은 닫는 빨간 K-라인은 상승 추세를 나타냅니다. 오픈보다 낮은 닫는 녹색 K-라인은 하락 추세를 나타냅니다.

  3. 거래량이 증가할 때만 구매 및 판매 신호를 고려하기 위해 거래량을 포함합니다.

  4. 상승 추세가 확인되고 CCI가 과잉 판매를 나타낼 때 긴 포지션을 취하고 하락 추세가 확인되고 CCI가 과잉 구매를 나타낼 때 짧은 포지션을 취합니다.

  5. 스톱 로스 및 수익점 설정으로 위험을 통제하고 수익을 확보합니다.

특히, 전략은 과잉 구매/ 과잉 판매 분석을 위해 CCI, 트렌드 방향에 대한 K-라인 패턴, 동력을위한 볼륨을 사용합니다. 기준이 충족되면 긴 또는 짧은 포지션을 입력합니다. 스톱 손실과 수익을 취하는 것은 위험과 이익을 관리하는 데 사용됩니다.

이점 분석

쇼피니스 K-라인 돌파구 전략은 다음과 같은 장점을 가지고 있습니다.

  1. 여러 지표를 결합하면 거래 신호의 신뢰성이 향상됩니다. CCI는 거래 지역을 식별하고 K 라인은 트렌드 방향을 결정하며 볼륨은 시장 동력을 반영합니다.

  2. K-라인 패턴을 활용하면 트렌드 반전을 정확하게 식별 할 수 있습니다. 예를 들어, CCI 과판된 빨간 K-라인은 구매 기회를 제공합니다.

  3. 스톱 로스 및 수익을 취하는 것은 위험과 수익을 효과적으로 제어합니다.

  4. 부피가 증가하는 신호만 고려하면 잘못된 신호를 피할 수 있습니다.

  5. 전략 논리는 명확하고 매개 변수는 주식과 시장 환경에 최적화를 위해 유연합니다.

  6. 이 전략은 더 많은 요소, 기계 학습 등을 통해 더욱 개선될 수 있으며 안정성과 수익성을 높일 수 있습니다.

위험 분석

전략의 잠재적 위험은 다음과 같습니다.

  1. CCI 신호가 지연되어 최적의 입력 지점을 놓칠 수 있습니다. CCI 매개 변수는 더 높은 민감성을 위해 조정 할 수 있습니다.

  2. K-라인 패턴의 가짜 브레이크는 불필요한 손실을 유발할 수 있습니다. 확인을 위해 더 많은 지표가 추가 될 수 있습니다. 또는 중지 손실 비율을 조정할 수 있습니다.

  3. 또한 부피의 급증도 조작될 수 있으므로 부피와 가격의 차이를 관찰하는 것이 중요합니다.

  4. 정적 스톱 로스/프로피트 취업은 더 빨리 종료되거나 더 많은 트렌드를 놓칠 수 있습니다. 동적 조정 고려하십시오.

  5. 한 스톡에 장착 된 매개 변수는 다른 스톡에 적합하지 않을 수 있습니다. 특정 조정이 필요합니다.

  6. 백테스트 결과는 라이브 공연을 나타내지 않을 수 있습니다. 실행 위험을 조심하십시오.

최적화 방향

이 전략은 다음을 통해 강화될 수 있습니다.

  1. CCI 매개 변수를 최적화하여 신호를 더 빠르게 생성합니다.

  2. 신호 정확성을 높이기 위해 MACD, 볼링거 밴드 같은 더 많은 지표를 추가합니다.

  3. 역사적인 데이터로 훈련된 기계 학습 모델을 사용하여 입구/출구 지점을 예측합니다.

  4. 동적 스톱 로스를 사용해서 시장 변동성에 따라 수익을 취합니다.

  5. 부피와 가격의 오차를 감지하기 위한 부피 급증 논리 개선

  6. 안정성 향상을 위해 다른 주식과 시장 체제에 대한 매개 변수 조정.

  7. 추세에 따른 메커니즘을 통합하여 시장 단계에서 더 나은 성능을 제공합니다.

  8. 더 많은 유연성과 확장성을 위해 전략을 모듈화합니다.

결론

쇼피니스 K-라인 돌파구 전략은 비교적 직선적인 단기 거래 전략이다. 스톱 로스 및 영리를 통해 명확한 논리와 위험 통제를 위한 일반적인 기술적 지표를 결합한다. 전략은 단기 역전과 중장기 트렌드를 포착하기 위한 필요에 따라 유연하게 최적화될 수 있다. 그러나 지표 지연 및 거짓 브레이크아웃을 포함한 위험은 관리되어야 한다. 강력한 최적화와 위험 관리로 기본 양적 거래 전략을 형성할 수 있다.


/*backtest
start: 2023-09-06 00:00:00
end: 2023-10-06 00:00:00
period: 2h
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/
// © vikris

//@version=4
strategy("[VJ]War Machine PAT Intra", overlay=true, calc_on_every_tick = false)

// ********** Strategy inputs - Start **********

// Used for intraday handling
// Session value should be from market start to the time you want to square-off 
// your intraday strategy
// Important: The end time should be at least 2 minutes before the intraday
// square-off time set by your broker
var i_marketSession = input(title="Market session", type=input.session, 
     defval="0915-1455", confirm=true)

// Make inputs that set the take profit % (optional)
longProfitPerc = input(title="Long Take Profit (%)",
     type=input.float, minval=0.0, step=0.1, defval=5.0) * 0.01

shortProfitPerc = input(title="Short Take Profit (%)",
     type=input.float, minval=0.0, step=0.1, defval=5.0) * 0.01
     
// Set stop loss level with input options (optional)
longLossPerc = input(title="Long Stop Loss (%)",
     type=input.float, minval=0.0, step=0.1, defval=5.0) * 0.01

shortLossPerc = input(title="Short Stop Loss (%)",
     type=input.float, minval=0.0, step=0.1, defval=5.0) * 0.01    

trendFactor = input(title="Trend Factor(Lower means trending)", type=input.integer, minval=1, step=1, defval=50)

oversold = input(title="Oversold", type=input.integer, minval=1, step=1, defval=25)

overbought = input(title="Overbought", type=input.integer, minval=1, step=1, defval=75)

// ********** Strategy inputs - End **********


// ********** Supporting functions - Start **********

// A function to check whether the bar or period is in intraday session
barInSession(sess) => time(timeframe.period, sess) != 0
// Figure out take profit price
longExitPrice  = strategy.position_avg_price * (1 + longProfitPerc)
shortExitPrice = strategy.position_avg_price * (1 - shortProfitPerc)

// Determine stop loss price
longStopPrice  = strategy.position_avg_price * (1 - longLossPerc)
shortStopPrice = strategy.position_avg_price * (1 + shortLossPerc)


// ********** Supporting functions - End **********


// ********** Strategy - Start **********
// See if intraday session is active
bool intradaySession = barInSession(i_marketSession)

// Trade only if intraday session is active

//=================Strategy logic goes in here===========================
//Vol Confirmation
vol = volume > volume[1]

//Engulfing candle confirm
bullishEC = close > open[1] and close[1] < open[1]
bearishEC = close < open[1] and close[1] > open[1]

//Candles colors
greenCandle = (close > open)
redCandle = (close < open)

length = input(title="Length", type=input.integer, defval=14, minval=1, maxval=2000)
src = hlc3
upper = sum(volume * (change(src) <= 0 ? 0 : src), length)
lower = sum(volume * (change(src) >= 0 ? 0 : src), length)
_rsi(upper, lower) =>
    100.0 - (100.0 / (1.0 + upper / lower))
mf = _rsi(upper, lower)
ci = 100 * log10(sum(atr(1), length) / (highest(length) - lowest(length))) / log10(length)

//tradeSignal = ((rsiOS or rsiOS[1]) and bullishEC) or ((rsiOB or rsiOB[1]) and bearishEC)




//Final Long/Short Condition
longCondition =  redCandle and mf < oversold and ci <trendFactor and vol
shortCondition = greenCandle and mf >overbought and ci <trendFactor and vol
 
//Long Strategy - buy condition and exits with Take profit and SL
if (longCondition and intradaySession)
    stop_level = longStopPrice
    profit_level = longExitPrice
    strategy.entry("My Long Entry Id", strategy.long)
    strategy.exit("TP/SL", "My Long Entry Id", stop=stop_level, limit=profit_level)


//Short Strategy - sell condition and exits with Take profit and SL
if (shortCondition and intradaySession)
    stop_level = shortStopPrice
    profit_level = shortExitPrice
    strategy.entry("My Short Entry Id", strategy.short)
    strategy.exit("TP/SL", "My Short Entry Id", stop=stop_level, limit=profit_level)
 
 
// Square-off position (when session is over and position is open)
squareOff = (not intradaySession) and (strategy.position_size != 0)
strategy.close_all(when = squareOff, comment = "Square-off")

// ********** Strategy - End **********

더 많은