트렌드 역전 및 Ehlers 선도 지표 컴보 전략

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

img

전반적인 설명

이 전략은 트렌드 역전 전략과 Ehlers 선도 지표 전략을 결합하여 더 신뢰할 수있는 거래 신호를 생성합니다. 트렌드 역전 전략은 트렌드 역전 지점을 식별하고 Ehlers 선도 지표 전략은 순환적 전환점을 식별합니다. 결합 된 신호는 시장 진입 시기를 더 잘 결정할 수 있습니다.

전략 논리

트렌드 역전 전략

이 전략은 울프 젠슨의 저서 How I Tripled My Money in the Futures Market, 183. 페이지에서 나온다. 이 전략은 역전형 전략이다. 클로즈는 2일 연속으로 이전 클로즈보다 높고 9일 스토카스틱 슬로우 라인이 50보다 낮을 때 길게, 클로즈는 2일 연속으로 이전 클로즈보다 낮고 9일 스토카스틱 패스트 라인이 50보다 높을 때 짧게 된다.

에일러스의 선도적 지표 전략

이 전략은 일간 데이터를 사용하여 단일 일일 유동 합성 가격 (DSP) 및 일일 에일러스 선도 지표 (ELI) 를 그래프화합니다. DSP는 지배적인 가격 주기를 캡처하고 2 폴 필터에서 3 폴 버터워스 필터를 빼어 계산합니다. ELI는 순환 전환점을 고급 표시하고 DSP 자체에서 DSP의 간단한 이동 평균을 빼어 계산합니다. ELI가 DSP 위 또는 아래를 넘을 때 구매 및 판매 신호가 생성됩니다.

이점 분석

이 콤보 전략의 가장 큰 장점은 더 신뢰할 수 있는 신호를 위해 트렌드 역전 식별과 순환 전환점 검출을 결합하는 것입니다. 트렌드 역전 전략은 브레이크 이후 반전을 식별하고 Ehlers 선도 지표는 순환적 하락과 고도를 조기에 나타냅니다. 둘을 결합하면 시장 진입을 더 정확하게 확인할 수 있습니다.

또 다른 장점은 매개 변수 조정의 유연성이다. 스토카스틱 지표의 매개 변수는 시장 조건에 따라 조정될 수 있다. 에헬러스 선도 지표의 주기 길이는 또한 다른 주기에 맞게 조정된다.

위험 분석

이 전략의 가장 큰 위험은 지속적인 트렌드를 놓치는 것입니다. 전략이 반전 신호가 들어오기를 기다리기 때문에 강력한 초기 트렌드 움직임을 놓칠 수 있습니다. 반전 신호는 또한 함락되는 결과를 초래하는 잘못된 브레이크로 판명 될 수 있습니다.

해결책은 트렌드 반전을 적시에 포착하기 위해 반전 탐지 기간을 단축하기 위해 매개 변수를 조정하는 것입니다. 손실을 제어하기 위해 스톱 손실도 도입 할 수 있습니다.

최적화 방향

이 전략은 다음과 같은 측면에서 개선될 수 있습니다.

  1. 단일 트레이드 손실을 통제하기 위해 스톱 로스를 도입합니다.

  2. 다른 시장 환경에 대한 반전 신호 기간을 조정하기 위해 매개 변수를 최적화합니다.

  3. 신호 품질을 향상시키고 잘못된 신호를 줄이기 위해 다른 표시 필터를 추가하십시오.

  4. 포지션 크기와 리스크 관리 모듈을 추가합니다.

  5. 최적화된 적합성을 찾기 위해 다양한 제품에서 매개 변수를 테스트합니다.

  6. 적응적인 매개 변수 조정을 위한 기계 학습 모듈을 추가합니다.

요약

이 전략은 트렌드 반전과 순환적 전환점 검출을 결합하여 보다 신뢰할 수 있는 시장 진출을 제공합니다. 가장 큰 장점은 높은 신호 품질과 유연성입니다. 주요 위험은 매개 변수 조정 및 스톱 로스로 완화 될 수있는 초기 트렌드를 놓치고 있습니다. 미래 개선은 매개 변수 최적화, 신호 필터링 등에 초점을 맞추어 전략이 시장 환경에서 견고하게 할 수 있습니다.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 26/11/2019
// 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
// This Indicator plots a single
// Daily DSP (Detrended Synthetic Price) and a Daily ELI (Ehlers Leading
// Indicator) using intraday data.
// Detrended Synthetic Price is a function that is in phase with the dominant
// cycle of real price data. This one is computed by subtracting a 3 pole Butterworth
// filter from a 2 Pole Butterworth filter. Ehlers Leading Indicator gives an advanced
// indication of a cyclic turning point. It is computed by subtracting the simple
// moving average of the detrended synthetic price from the detrended synthetic price.
// Buy and Sell signals arise when the ELI indicator crosses over or under the detrended
// synthetic price.
// See "MESA and Trading Market Cycles" by John Ehlers pages 64 - 70. 
//
// 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

D_ELI(Length) =>
    pos = 0.0
    xHL2 = security(syminfo.tickerid, 'D', hl2)
    xEMA1 = ema(xHL2, Length)
    xEMA2 = ema(xHL2, 2 * Length)
    xEMA1_EMA2 = xEMA1 - xEMA2
    xResultEMA = ema(xEMA1_EMA2, Length)
    nRes = xEMA1_EMA2 - xResultEMA
    pos:= iff(nRes > 0, 1,
	       iff(nRes < 0, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & D_ELI (Ehlers Leading Indicator)", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthELI = input(7, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posD_ELI = D_ELI(LengthELI)
pos = iff(posReversal123 == 1 and posD_ELI == 1 , 1,
	   iff(posReversal123 == -1 and posD_ELI == -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 )

더 많은