양적 듀얼 팩터 역전 이너시아 거래 전략

저자:차오장, 날짜: 2024-01-12 14:38:02
태그:

img

전반적인 설명

양적 이중 요인 역전 이너시아 거래 전략 (Quantitative Dual Factor Reversal Inertia Trading Strategy) 은 가격 역전 신호와 시장 이너시아 신호를 결합한 양적 거래 전략이다. 이 전략은 먼저 스토카스틱 지표를 사용하여 가격 역전 신호를 생성하고, 그 다음 상대 변동성 지수 (RVI) 의 시장 이너시아 신호를 통합하고, 마지막으로 이중 요인에 의해 주도되는 거래 결정을 내린다.

원칙

이 전략은 크게 두 부분으로 구성됩니다.

  1. 가격 역전 부분은 울프 젠슨이 그의 책에서 제안한 아이디어를 채택합니다. 구체적으로: 닫기 가격이 2 일 동안 지속적으로 상승하고 9 일 슬로우 스토카스틱이 50 미만일 때, 길게 이동합니다. 닫기 가격이 2 일 동안 지속적으로 떨어지고 9 일 빠른 스토카스틱이 50 미만일 때, 짧게 이동합니다.

  2. 시장 관성 부분은 상대 변동성 지수 (RVI) 를 사용합니다. 이 지표의 값은 0에서 100 사이 변동합니다. 50 이상은 시장의 장기 트렌드가 상승하고 50 이하는 시장의 장기 트렌드가 하락하는 것을 나타냅니다.

요약하자면, 이 전략은 가격 반전 신호와 시장 관성 신호를 통합하여 현재 시장 방향을 최종적으로 결정합니다. 두 부분의 신호가 정렬되면 거래 신호가 생성됩니다.

이점 분석

이 전략의 가장 큰 장점은 두 가지 주요 거래 아이디어를 결합한다는 것입니다. 역전 및 트렌드 추종. 역전 신호는 단기 수정 사항을 캡처하고 거래 기회를 제공 할 수 있습니다. 관성 신호는 장기 트렌드가 소음을 효과적으로 필터하기 위해 정렬 될 때만 포지션을 개설 할 수 있습니다.

또한 이중 요인 구동 메커니즘은 신호 품질을 향상시킬 수 있습니다. 스토카스틱 매개 변수를 최적화하고 RVI를 매끄럽게하는 것도 전략 최적화에 대한 공간을 제공합니다.

위험 분석

이 전략에 직면한 주요 위험은 다음과 같습니다.

  1. 반전 신호가 부정확하게 식별되는 위험. 매개 변수들의 합리성을 확인해야 합니다.

  2. 관성 신호가 잘못된 신호를 생성 할 위험이 있습니다. RVI 자체는 평형 매개 변수를 조정해야하는 지연을 가지고 있습니다.

  3. 이중 요인 신호의 타이밍의 부적절한 조화로 인해 거래 기회를 놓칠 위험이 있습니다. 다른 매개 변수에서 일치하는 상황은 테스트가 필요합니다.

또한, 역전 전략은 트렌딩 시장에서 손실 위험이 증가합니다. 중단 손실 규칙을 엄격히 준수해야합니다.

최적화 방향

이 전략은 다음과 같은 측면에서 최적화 될 수 있습니다.

  1. 역전 신호를 식별하는 품질과 신속성을 향상시키기 위해 스토카스틱 지표의 매개 변수를 최적화하십시오.

  2. 관성 판단의 정확성을 높이기 위해 RVI 지표의 매끄러운 매개 변수를 최적화합니다.

  3. 최적의 유지 주기를 결정하기 위해 다른 유지 기간을 테스트합니다.

  4. 스톱 로스 메커니즘을 포함합니다. 최적의 스톱 로스 위치를 찾기 위해 다른 스톱 로스 포인트를 테스트합니다.

  5. 거래량 오차와 같은 다른 요인 신호를 통합하여 여러 요인 기반 전략을 형성하는 것을 고려하십시오.

요약

양적 듀얼 팩터 리버스 이너시아 트레이딩 전략 (Quantitative Dual Factor Reversal Inertia Trading Strategy) 은 트레이딩 신호를 생성하기 위해 스토카스틱 지표와 RVI 지표를 사용하여 리버스 및 트렌드 요인을 포괄적으로 고려합니다. 이 전략은 듀얼 팩터 구동, 리버스 기회 포착 및 신호 필터링과 같은 장점을 가지고 있습니다. 다면적 매개 변수 최적화를 통해 더욱 향상 될 수 있습니다. 엄격한 스톱 로스 강제로 위험을 통제하는 것도 중요합니다. 이 전략은 양적 거래에 좋은 아이디어를 제공합니다.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 27/11/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
// The inertia indicator measures the market, stock or currency pair momentum and 
// trend by measuring the security smoothed RVI (Relative Volatility Index). 
// The RVI is a technical indicator that estimates the general direction of the 
// volatility of an asset.
// The inertia indicator returns a value that is comprised between 0 and 100. 
// Positive inertia occurs when the indicator value is higher than 50. As long as 
// the inertia value is above 50, the long-term trend of the security is up. The inertia 
// is negative when its value is lower than 50, in this case the long-term trend is 
// down and should stay down if the inertia stays below 50.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
//
// 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

Inertia(Period, Smooth) =>
    pos = 0.0
    nU = 0.0
    nD = 0.0
    xPrice = close
    StdDev = stdev(xPrice, Period)
    d = iff(close > close[1], 0, StdDev)
    u = iff(close > close[1], StdDev, 0)
    nU := (13 * nz(nU[1],0) + u) / 14
    nD := (13 * nz(nD[1],0) + d) / 14
    nRVI = 100 * nU / (nU + nD)
    nRes = ema(nRVI, Smooth)
    pos :=iff(nRes > 50, 1,
    	   iff(nRes < 50, -1, nz(pos[1], 0))) 
    pos

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

더 많은