이중 드라이버 정량화 역전 추적 전략

저자:차오장, 날짜: 2024-02-18 10:03:14
태그:

img

전반적인 설명

듀얼 드라이버 양자화 역전 추적 전략은 간단한 이동 평균 지표와 무작위 지표를 결합하여 효율적이고 안정적인 단기 거래 전략을 달성하여 빠른 시장 역전을 포착하고 놓친 신호의 기회 비용을 줄일 수 있습니다.

전략 원칙

이 전략은 두 부분으로 구성된다. 123 역전 패턴 부분과 적응적인 이동 평균 부분. 123 역전 패턴 부분은 이전 두 거래 날 사이의 폐쇄 가격 관계를 계산하여 역전 기회가 있는지 판단한다. 전날의 종료 가격이 2 전날의 종료 가격보다 낮고, 현재 거래 날의 종료 가격이 전날보다 높고, 느린 무작위 라인이 50 이하라면 구매 신호가 생성된다. 전날의 종료 가격이 2 전날의 종료 가격보다 높고, 현재 거래 날의 종료 가격이 전날보다 낮고, 빠른 라인이 50 이상이라면 판매 신호가 생성된다. 이것은 단기적 역전 기회를 포착할 수 있다. 다른 부분은 이동 평균이며, 시장이 비활동할 때 빠르게 반응하고 효과적으로 반응하며, 트렌드 시그널과 주요 진입 시그널의 시그널이 잘 일치할 때 시그널을 빠르게 조절하고 빠르게 대응할 수 있다.

전략 의 장점

듀얼 드라이버 정량화 역전 추적 전략의 가장 큰 장점은 역전 패턴과 트렌드 필터링을 결합하여 쇼크 시장에 갇히지 않는 동안 빠른 역전을 포착 할 수 있다는 것입니다. 두 가지 주요 수입원이 있습니다. 첫째, 123 패턴을 식별하면 많은 안정적인 전략이 할 수없는 가격의 빠르게 역전 방향의 기회를 신속하게 추적 할 수 있습니다. 둘째, 적응형 이동 평균의 적용은 거래 방향이 주요 트렌드에 일치하여 소음을 효과적으로 필터링하고 불필요한 손실을 줄여줍니다.

전략 의 위험

이 전략의 주요 위험은 부적절한 매개 변수 설정으로 인해 거래 빈도가 과도하게 높거나 신호 식별 능력이 부족할 수 있다는 것입니다. 123 패턴의 매개 변수가 너무 민감하다면 더 많은 폐쇄 손실을 초래하는 변동성 시장 조건에서 빈번한 거래로 이어질 수 있습니다. 적응형 이동 평균 매개 변수가 너무 느리게 설정되면 역전 기회가 놓칠 수 있습니다. 또한 트렌딩 시장에서 새로운 최고치를 추구하고 낮은 판매도 더 큰 자본 변동으로 이어질 수 있습니다.

전략 최적화

전략은 여러 가지 방법으로 최적화 될 수 있습니다. 첫째, 잘못된 신호를 생성하지 않고 명확한 반전을 식별하기 위해 123 패턴의 매개 변수를 조정합니다. 둘째, 안정성과 민감성 사이의 최상의 균형을 찾기 위해 적응적인 이동 평균 매개 변수를 최적화합니다. 셋째, 단일 손실을 제어하기 위해 스톱 로스 전략을 도입할 수 있습니다. 넷째, 시장 정서 지표가 결합되어 의사 결정 품질을 향상시킬 수 있습니다.

요약

듀얼 드라이버 양자화된 역전 추적 전략은 역전 거래와 트렌드 필터링의 두 가지 필수적인 부분을 성공적으로 통합하고 있으며, 결합된 장점은 중요합니다. 매개 변수 설정을 지속적으로 최적화하고 스톱 로스 및 리스크 제어 메커니즘을 개선함으로써이 전략은 수익을 내기 쉽고 통제 가능한 위험을 가진 효율적인 양적 거래 전략이 될 가능성이 있습니다.


/*backtest
start: 2024-01-18 00:00:00
end: 2024-02-17 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 08/12/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
// Everyone wants a short-term, fast trading trend that works without large
// losses. That combination does not exist. But it is possible to have fast
// trading trends in which one must get in or out of the market quickly, but
// these have the distinct disadvantage of being whipsawed by market noise
// when the market is volatile in a sideways trending market. During these
// periods, the trader is jumping in and out of positions with no profit-making
// trend in sight. In an attempt to overcome the problem of noise and still be
// able to get closer to the actual change of the trend, Kaufman developed an
// indicator that adapts to market movement. This indicator, an adaptive moving
// average (AMA), moves very slowly when markets are moving sideways but moves
// swiftly when the markets also move swiftly, change directions or break out of
// a trading range.
//
// 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

KAMA(Length) =>
    pos = 0.0
    nAMA = 0.0
    xPrice = close
    xvnoise = abs(xPrice - xPrice[1])
    nfastend = 0.666
    nslowend = 0.0645
    reverse = input(false, title="Trade reverse")
    nsignal = abs(xPrice - xPrice[Length])
    nnoise = sum(xvnoise, Length)
    nefratio = iff(nnoise != 0, nsignal / nnoise, 0)
    nsmooth = pow(nefratio * (nfastend - nslowend) + nslowend, 2) 
    nAMA := nz(nAMA[1]) + nsmooth * (xPrice - nz(nAMA[1]))
    pos := iff(close[1] > nAMA, 1,
    	     iff(close[1] < nAMA, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Kaufman Moving Average Adaptive", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthKAMA = input(21, minval=2)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posKAMA = KAMA(LengthKAMA)
pos = iff(posReversal123 == 1 and posKAMA == 1 , 1,
	   iff(posReversal123 == -1 and posKAMA == -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 )

더 많은