듀얼 지표 양적 전략


생성 날짜: 2023-12-21 10:59:16 마지막으로 수정됨: 2023-12-21 10:59:16
복사: 1 클릭수: 658
avatar of ChaoZhang ChaoZhang
1
집중하다
1623
수행원

듀얼 지표 양적 전략

개요

이 전략은 123개의 반전 지표와 RAVI 지표를 결합하여 거래 신호를 생성한다. 이 중 123개의 반전은 반전 전략에 속하며, 주식 가격의 2일 연속 움직임을 사용하여 미래 가격 움직임을 판단한다. RAVI 지표는 가격이 초매 초매 영역에 들어갔는지 판단한다. 이 전략은 두 신호의 합성 판단을 통해 더 많은 공백을 결정한다.

전략 원칙

123 회전

이 지표는 무작위 지표 K값을 기반으로 한다. 구체적으로, 현재 하루의 종결값이 전날 2일보다 낮고, 9일 무작위 느린 선이 50보다 낮으면 더 한다. 현재 하루의 종결값이 전날 2일보다 높고, 9일 무작위 빠른 선이 50보다 높으면 공백한다. 이렇게 역전점을 통해 입장을 확인한다.

RAVI 지표

이 지표는 빠른 선과 느린 선의 오차를 통해 매매를 판단한다. 구체적으로 7일 평균선과 65일 평균선 오차는 특정 변수보다 큰 경우 더 많이 하고, 특정 변수보다 작은 경우 공백을 한다. 빠른 느린 선의 금 叉 死 叉를 통해 과매도 과매도 구간을 판단한다.

전략적 신호

123 회전과 RAVI 동방향 다중 공백을 할 때 신호를 생성한다. 다중 신호는 두 지표는 1이고, 공백 신호는 두 지표는 -1이다. 이렇게 쌍 지표로 확인하여 단일 지표의 잘못된 신호를 피한다.

우위 분석

  • 두 지표의 조합을 사용하여 신호의 정확성을 높이고 잘못된 신호를 피할 수 있습니다.
  • 123 역으로 K선 정보를 사용하고, RAVI는 일선 정보를 사용하여 여러 각도에서 시장을 판단한다
  • RAVI 매개 변수는 조정 가능하며, 다양한 품종과 시장 환경에 최적화 할 수 있습니다.
  • 역전 (反轉) 을 잡을 수 있고, 역전 (反轉) 을 따라갈 수 있습니다.

위험과 최적화

  • 이중 지표 조합, 신호 불일치 발생하기 쉽다. 가격차 변수를 고려할 수 있으며, 두 지표 가격이 특정 변수 내에 차이가 있을 때 신호를 낼 수 있다.
  • 123 회전 고주파 전략으로, 다른 저주파 전략과 결합하여 거래 빈도를 낮추는 것이 필요합니다.
  • RAVI는 중장선 트렌드를 잘 포착하고, Combine은 중장선 트렌드를 잘 포착하고, Combine은 중장선 트렌드를 잘 포착하고, Combine은 중장선 트렌드를 잘 포착하고,

요약하다

이 전략은 역전 요인과 트렌드 요인을 종합적으로 고려하고, 쌍방향 지표 확인을 통해 잘못된 신호 발송 가능성을 줄일 수 있다. 다음 단계로, 기계 학습 알고리즘을 도입하여, 자기 적응 파라미터 최적화를 실현할 수 있다. 또는 전략의 조합을 고려하여, 다른 전략 유형과 조합을 형성하여, 수익을 유지하면서 최대한의 회수를 줄일 수 있다.

전략 소스 코드
/*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 )