콤보 모멘텀 역전 듀얼 레일 매칭 전략

저자:차오장, 날짜: 2023-11-24 10:17:15
태그:

img

전반적인 설명

이 전략은 트레이딩 신호를 생성하기 위해 모멘텀 역전 및 듀얼 레일 매칭을 구현하기 위해 여러 기술적 지표를 결합합니다. 이 전략은 역전 지점을 결정하고 트렌드를 추적하기 위해 에르고딕 CSI 지표와 신호를 일치시키는 123 패턴을 사용합니다. 중단기 트렌드를 캡처하고 높은 수익을 달성하는 것을 목표로합니다.

원칙

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

  1. 123 회전점을 결정하는 패턴
  2. 일치 신호를 생성하기 위한 에르고딕 CSI 표시기

123 패턴은 최근 3개의 바의 폐쇄 가격에 기초하여 가격 반전을 판단합니다. 구체적으로: 만약 3번 바의 닫기 가격이 이전 2번 바와 비교해서 상승하고, 빠른 스톡과 느린 스톡이 모두 50보다 낮다면, 그것은 구매 신호입니다. 만약 3번 바의 닫기 가격이 이전 2번 바와 비교해서 떨어지고, 빠른 스톡과 느린 스톡이 모두 50을 넘으면, 그것은 판매 신호입니다.

에르고딕 CSI 지표는 가격, 실제 범위, 트렌드 지표와 같은 여러 요소를 고려하여 시장 조건을 포괄적으로 결정하고 구매/판매 영역을 생성합니다. 인디케이터가 구매 구역 이상으로 올라가면 구매 신호를 생성합니다. 인디케이터가 판매 구역 아래로 떨어지면 판매 신호를 생성합니다.

마지막으로, 에르고딕 CSI의 123 패턴 및 구역 신호에서 반전 신호는 최종 전략 신호를 생성하기 위해 ANDed입니다.

장점

  1. 중·단기적 추세를 파악하고 높은 수익 잠재력
  2. 반전 패턴 결정 효과적으로 전환점을 잡습니다
  3. 듀얼 레일 매칭 은 거짓 신호 를 줄여 준다

위험성

  1. 개별 주식이 분산하여 스톱 로스로 이어질 수 있습니다.
  2. 범주형 시장의 영향을 받을 수 있는 반전 패턴
  3. 제한된 파라미터 최적화 공간, 높은 성능 변동

최적화 방향

  1. 전략 수익성 향상을 위해 매개 변수를 최적화
  2. 단일 거래 손실을 줄이기 위해 중지 손실 논리를 추가
  3. 수산물 선택의 개선을 위해 다중 요인 모델을 통합

결론

이 전략은 반전 패턴과 듀얼 레일 매칭을 결합하여 중단기 트렌드를 효과적으로 추적합니다. 단일 기술 지표와 비교하면 더 높은 안정성과 수익 수준을 가지고 있습니다. 다음 단계는 매개 변수를 더 최적화하고, 마감 손실을 줄이고 전반적인 성능을 향상시키기 위해 스톱 로스 및 주식 선택 모듈을 추가하는 것입니다.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 22/07/2020
// 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 is one of the techniques described by William Blau in his book 
// "Momentum, Direction and Divergence" (1995). If you like to learn more, 
// we advise you to read this book. His book focuses on three key aspects 
// of trading: momentum, direction and divergence. Blau, who was an electrical 
// engineer before becoming a trader, thoroughly examines the relationship between 
// price and momentum in step-by-step examples. From this grounding, he then looks 
// at the deficiencies in other oscillators and introduces some innovative techniques, 
// including a fresh twist on Stochastics. On directional issues, he analyzes the 
// intricacies of ADX and offers a unique approach to help define trending and 
// non-trending periods.
// This indicator plots Ergotic CSI and smoothed Ergotic CSI to filter out noise. 
//
// 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

fADX(Len) =>
    up = change(high)
    down = -change(low)
    trur = rma(tr, Len)
    plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, Len) / trur)
    minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, Len) / trur)
    sum = plus + minus 
    100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), Len)

ECSI(r,Length,BigPointValue,SmthLen,SellZone,BuyZone) =>
    pos = 0
    source = close
    K = 100 * (BigPointValue / sqrt(r) / (150 + 5))
    xTrueRange = atr(1) 
    xADX = fADX(Length)
    xADXR = (xADX + xADX[1]) * 0.5
    nRes = iff(Length + xTrueRange > 0, K * xADXR * xTrueRange / Length,0)
    xCSI = iff(close > 0,  nRes / close, 0)
    xSMA_CSI = sma(xCSI, SmthLen)
    pos := iff(xSMA_CSI > BuyZone, 1,
             iff(xSMA_CSI <= SellZone, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Ergodic CSI", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
r = input(32, minval=1)
LengthECSI = input(1, minval=1)
BigPointValue = input(1.0, minval=0.00001)
SmthLen = input(5, minval=1)
SellZone = input(0.06, minval=0.00001)
BuyZone = input(0.02, minval=0.001)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posECSI = ECSI(r,LengthECSI,BigPointValue,SmthLen,SellZone,BuyZone)
pos = iff(posReversal123 == 1 and posECSI == 1 , 1,
	   iff(posReversal123 == -1 and posECSI == -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 )

더 많은