더블 K 크로스보 전략

저자:차오장, 날짜: 2023-10-18 11:19:07
태그:

img

개요: 더블 K 크로스보 전략은 123 역전 전략과 마틴 프링의 특수 K 전략을 결합하여 역전 신호와 주기 지표를 활용합니다. 두 전략의 장점을 활용하여 더 정확한 구매 및 판매 신호를 생성하는 것을 목표로합니다.

전략 논리:

더블 K 크로스보우는 두 부분으로 구성됩니다.

  1. 123 반전 전략: 종결 가격 반전 2 일 연속으로 종결 가격 반전을 기반으로 구매 및 판매 신호를 식별하고, 스토카스틱 오시레이터 판독과 결합합니다. 종결이 2 일 동안 이전 종결보다 높고 스토카스틱이 50 미만일 때 구매 신호를 생성하여 통합을 나타냅니다. 종결이 2 일 동안 이전 종결보다 낮고 스토카스틱이 50 미만일 때 판매 신호를 생성하여 분포를 나타냅니다.

  2. 마틴 프링의 특수 K 전략: 다른 시간 프레임에서 변화 값의 비율을 쌓아 형성 된 복합 순환 지표를 사용합니다. 지표가 이동 평균 이상으로 넘어가면 구매 신호를 생성하고 아래로 넘어가면 판매 신호를 생성합니다.

이중 K 크로스보우 (Double K Crossbow) 는 양 전략의 신호를 통합하여 실제 거래를 촉발하기 위해 동의가 필요합니다. 이것은 각 전략의 타이밍 강점을 활용하고 잘못된 신호를 피합니다.

이점 분석:

  • 더 신뢰할 수 있는 거래 입출입을 위해 두 가지 전략의 신호를 결합합니다. 잘못된 거래를 피합니다.

  • 123 반전은 단기적 반전을 포착하고, 특수 K는 장기적 경향을 판단합니다. 조합은 단기적과 장기적 모두를 고려합니다.

  • 다중 시간 프레임 변화율은 시장 주기에 대한 통찰력을 제공합니다.

  • 최적화 가능한 스토카스틱 매개 변수는 다른 시장 조건에 적응합니다.

위험 분석:

  • 통합 신호는 일부 구매/판매 지점을 놓치고 단기 움직임을 늦출 수 있습니다.

  • 외질적인 상황에서는 전략이 일치하지 않을 수 있고, 방향에 대한 판단이 필요합니다.

  • 양쪽 전략의 매개 변수를 모니터링하고 최적화해야 합니다. 복잡성을 높여줍니다.

  • 단기 및 장기적인 매개 변수들의 잘못된 최적화는 주기의 전환점을 놓칠 수 있습니다.

발전 가능성:

  • 최적의 설정을 찾기 위해 다른 매개 변수 조합을 테스트합니다.

  • 손실을 제한하기 위해 Stop Loss 모듈을 추가합니다.

  • 위치 크기를 조정하는 모듈을 추가합니다. 시장 조건에 맞게.

  • 더 강력한 신호 모델링을 위해 기계 학습을 통합합니다.

  • 동적으로 시장 리듬을 추적하기 위해 적응 최적화를 추가합니다.

결론:

이중 K 크로스보우는 품질 신호와 다중 시간 프레임 수익 기회를위한 역전 및 순환 전략의 장점을 성공적으로 결합합니다. 이 새로운 접근법은 안정적인 전략으로 추가 테스트 및 최적화에 가치가 있습니다. 그러나 위험 관리 및 매개 변수 조정은 끊임없이 변화하는 시장에서 일관성있는 이익을 위해 필수적입니다.


/*backtest
start: 2023-09-17 00:00:00
end: 2023-10-17 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 17/02/2021
// This is combo strategies for get a cumulative signal. 
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The 
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close 
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50. 
// The strategy sells at market, if close price is lower than the previous close price 
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// Pring's Special K is a cyclical indicator created by Martin Pring. 
// His method combines short-term, intermediate and long-term velocity 
// into one complete series. Useful tool for Long Term Investors
// Modified for any source.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
    vFast = sma(stoch(close, high, low, Length), KSmoothing) 
    vSlow = sma(vFast, DLength)
    pos = 0.0
    pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
	         iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0))) 
	pos


MPSK(a, sources) =>
    pos = 0.0
    roc1 = (sma(roc(sources,10),10)*1)
    roc2 = (sma(roc(sources,15),10)*2)
    roc3 = (sma(roc(sources,20),10)*3)
    roc4 = (sma(roc(sources,30),15)*4)
    roc5 = (sma(roc(sources,40),50)*1)
    roc6 = (sma(roc(sources,65),65)*2)
    roc7 = (sma(roc(sources,75),75)*3)
    roc8 = (sma(roc(sources,100),100)*4)
    roc9 = (sma(roc(sources,195),130)*1)
    roc10 = (sma(roc(sources,265),130)*2)
    roc11 = (sma(roc(sources,390),130)*3)
    roc12 = (sma(roc(sources,530),195)*4)
    osc = roc1+roc2+roc3+roc4+roc5+roc6+roc7+roc8+roc9+roc10+roc11+roc12
    oscsmt = sma(osc,a)
    pos := iff(osc > oscsmt, 1,
    	     iff(osc < oscsmt, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Martin Pring's Special K", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Martin Pring`s ----")
a = input(10, title = "Smooth" )
sources = input(title="Source", type=input.source, defval=close)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posMPSK = MPSK(a,sources)
pos = iff(posReversal123 == 1 and posMPSK == 1 , 1,
	   iff(posReversal123 == -1 and posMPSK == -1, -1, 0)) 
possig = iff(reverse and pos == 1, -1,
          iff(reverse and pos == -1 , 1, pos))	   
if (possig == 1 ) 
    strategy.entry("Long", strategy.long)
if (possig == -1 )
    strategy.entry("Short", strategy.short)	 
if (possig == 0) 
    strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )

더 많은