이중 지표 양적 전략

저자:차오장, 날짜: 2023-12-21 10:59:16
태그:

img

전반적인 설명

이 전략은 123 리버설 지표와 RAVI 지표를 결합하여 거래 신호를 생성한다. 123 리버설은 리버설 유형의 전략에 속하며, 지난 2 일 동안의 가격 움직임을 사용하여 미래의 가격 추세를 결정한다. RAVI 지표는 가격이 과소매 또는 과소매 구역에 진입했는지 결정한다. 전략은 두 지표의 결합 신호에 따라 길거나 짧을 결정한다.

전략 논리

123 반전

이 지표는 스토카스틱 지표의 K 값을 기반으로 합니다. 구체적으로, 오늘 닫는 가격이 이전 두 일보다 낮고 9일 느린 스토카스틱 라인이 50보다 낮을 때 긴 거리로 이동합니다. 오늘 닫는 가격이 이전 두 일보다 높고 9일 빠른 스토카스틱 라인이 50보다 높을 때 짧은 거리로 이동합니다. 따라서 반전 포인트 확인을 기반으로 입력합니다.

RAVI 지표

이 지표는 빠른 이동 평균과 느린 이동 평균의 차이를 계산하여 신호를 생성합니다. 구체적으로 7 일 MA와 65 일 MA 사이의 차이입니다. 차이가 임계치보다 높을 때 길고 임계치보다 낮을 때 짧습니다. 따라서 빠른 및 느린 MA가 교차할 때 과반 구매 및 과반 판매 영역을 식별 할 수 있습니다.

전략 신호

123 리버서스와 RAVI가 방향에 동의할 때 신호가 생성됩니다. 두 지표가 모두 1을 표시할 때 긴 신호가 발생하고 두 지표 모두 -1을 표시할 때 짧은 신호가 발생합니다. 이 이중 확인은 단일 지표에서 잘못된 신호를 피합니다.

장점 분석

  • 두 개의 표시기를 결합하면 신호 정확도가 향상되고 잘못된 신호가 발생하지 않습니다.
  • 123 리버설은 가격 데이터를 사용하며 RAVI는 이동 평균 데이터를 사용하여 여러 관점에서 동향을 결정합니다.
  • RAVI의 매개 변수는 조정 가능하며 다른 제품과 시장 환경에 최적화 될 수 있습니다.
  • 역전과 트렌드의 조합은 역전과 트렌드를 모두 잡을 수 있습니다.

위험 과 최적화

  • 이중 지표의 조합은 때때로 충돌 신호로 이어질 수 있습니다. 두 지표 사이의 가격 오차가 한 임계치 내에있을 때 가격 오차 매개 변수를 도입하여 신호를 유발할 수 있습니다.
  • 123 반전은 높은 주파수 전략입니다. 그것은 다른 낮은 주파수 전략과 결합되어 거래 주파수를 낮추어야합니다.
  • RAVI는 중장기 동향을 잘 파악합니다. 단기 지표와 결합하면 위험 관리를 향상시킬 수 있습니다.

결론

이 전략은 역전 및 트렌드 요인을 모두 고려합니다. 이중 확인은 잘못된 신호를 피하는 데 도움이됩니다. 다음 단계는 적응적 매개 변수 최적화를위한 기계 학습 알고리즘을 도입하는 것입니다. 또는 이 전략을 다른 전략 유형과 결합하여 수익을 유지하고 최대 인출을 줄이는 동시에 포트폴리오 다각화를 달성 할 수 있습니다.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 31/05/2021
// 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 indicator represents the relative convergence/divergence of the moving 
// averages of the financial asset, increased a hundred times. It is based on 
// a different principle than the ADX. Chande suggests a 13-week SMA as the 
// basis for the indicator. It represents the quarterly (3 months = 65 working days) 
// sentiments of the market participants concerning prices. The short moving average 
// comprises 10% of the one and is rounded to seven.
//
// 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


RAVI(LengthMAFast, LengthMASlow, TradeLine) =>
    pos = 0.0
    xMAF = sma(close, LengthMAFast)
    xMAS = sma(close, LengthMASlow)
    xRAVI = ((xMAF - xMAS) / xMAS) * 100
    pos:= iff(xRAVI > TradeLine, 1,
    	   iff(xRAVI < TradeLine, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Range Action Verification Index (RAVI)", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Range Action Verification Index (RAVI) ----")
LengthMAFast = input(title="Length MA Fast", defval=7)
LengthMASlow = input(title="Length MA Slow", defval=65)
TradeLine = input(0.14, step=0.01)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posRAVI = RAVI(LengthMAFast, LengthMASlow, TradeLine)
pos = iff(posReversal123 == 1 and posRAVI == 1 , 1,
	   iff(posReversal123 == -1 and posRAVI == -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 )

더 많은