추세 반전 모멘텀 복합 전략


생성 날짜: 2024-01-05 14:06:21 마지막으로 수정됨: 2024-01-05 14:06:21
복사: 0 클릭수: 603
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

추세 반전 모멘텀 복합 전략

개요

트렌드 반전량 복합전략은 트렌드 반전전략과 동력 돌파전략을 결합한 복합 거래 전략이다. 이 전략은 가격 반전 신호와 동력 지표 신호를 동시에 사용하여 시장 전환점을 더 정확하게 포착하여 가격이 반전이 시작될 때 적시에 진입한다.

전략 원칙

이 전략은 두 부분으로 구성되어 있습니다.

  1. 123 역전 전략: 2일 연속으로 종전 가격보다 낮은 종전 가격에 이어 상향 상승, 9일 연속으로 느린 K선 50보다 낮은 종전 가격에 따라 상향 하락, 9일 연속으로 빠른 K선 50보다 높은 종전 가격에 이어 상향 하락.

  2. DAPD 동력 돌파 전략: DAPD는 최근 21일 최고점과 최근 21일 낮은점의 평균 차이이며, DAPD 상하의 돌파점을 기준으로 entry 및 exit 포인트를 판단한다.

두 가지 전략 신호가 동방향일 때, 출전 신호를 발산한다; 신호 방향이 반대일 때, 일시적으로 정지한다.

전략적 이점

이 전략은 역전 전략과 동력 전략의 장점을 결합하여 가격 전환점을 더 정확하게 포착할 수 있다. 주요 장점은 다음과 같다:

  1. 이중 필터는 신호의 신뢰성을 증가시킨다. 동방향 신호의 경우 성공률이 높다.

  2. 123 형식 판단은 포지션 반전의 위험을 줄일 수 있다.

  3. DAPD 동력 지표 판단, 트렌드형 품종에 적합하다.

전략적 위험

  1. 신호 시점 일치 위험. 두 가지 전략 신호 발생 시간에 오차가 있을 수 있다.

  2. 이중 거래 비용 위험. 포지션을 열 때마다 두 가지 전략에 대한 수수료를 동시에 지불해야 한다.

최적화 방향

  1. 두 가지 전략의 매개 변수 일치도를 최적화하여 신호를 최대한 동시화한다.

  2. 다양한 품종에 대해 다른 변수 조합의 효과를 연구한다.

  3. 전략적 신호가 강할 때만 포지션을 열고, 약한 신호를 필터링하십시오.

요약하다

트렌드 반전량 복합 전략은 반전 전략과 동력 전략의 장점을 활용하여 가격이 반전하기 시작했을 때 정확하게 적시에 진입할 수 있다. 듀얼 필터링 메커니즘은 신호의 성공률을 높인다. 매개 변수 매칭을 최적화함으로써 성과를 더욱 향상시킬 수 있다. 이 전략은 어느 정도의 자본력과 거래 경험이 있는 투자자에게 적합하다.

전략 소스 코드
/*backtest
start: 2023-12-28 00:00:00
end: 2024-01-04 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 10/12/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 is similar to Bollinger Bands. It based on DAPD - Daily
// Average Price Delta. DAPD is based upon a summation for each of the
// highs (hod) for the 21 days prior to today minus the summation for
// each of the lows (lod) for the last 21 days prior to today. The result
// of this calculation would then be divided by 21.
// It will be buy when high above previos DAPD high and sell if low below previos DAPD low
//
// 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

DAPD(Length) =>
    pos = 0.0
    xHighSMA = sma(high, Length)
    xLowSMA = sma(low, Length)        
    nDAPD = xHighSMA - xLowSMA
    nTop = high + nDAPD
    nBottom = low - nDAPD
    pos :=  iff(high > nTop[1], 1,
    	     iff(low < nBottom[1], -1, nz(pos[1], 0)))    
    pos

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