다중 지표 검증을 기반으로 한 양적 거래 전략


생성 날짜: 2023-09-15 11:55:04 마지막으로 수정됨: 2023-09-15 11:55:04
복사: 1 클릭수: 719
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

이 문서에서는 다중 지표 검증을 통해 거래 신호를 형성하는 양적 전략에 대해 자세히 설명합니다. 이 전략은 신호의 신뢰성을 높이기 위해 여러 지표 판단을 통합적으로 사용합니다.

1 전략

이 전략은 두 가지의 거래 기술을 사용합니다.

123 형태 역전 전략

  1. K 선의 종전 가격 관계를 계산하여 가능한 바닥과 꼭대기 형태를 판단합니다.

  2. 회전 신호를 판단하고 잘못된 신호를 피하기 위해 무작위 지표와 결합합니다.

(2) 평평한 공중량 지표

  1. 다공량 지표와 이동 평균을 계산합니다.

  2. 지표와 평평선에서 벗어난 경향을 판단하는 것.

  3. 최종 거래 신호는 두 기술의 판단이 일치했을 때만 생성된다.

이렇게 하면, 다중 지표 검증을 통해, 특정 가짜 신호를 필터링할 수 있고, 신호의 정확성을 향상시킬 수 있다.

2 전략적 장점

이 전략의 가장 큰 장점은 여러 지표의 조합 검증입니다. 이것은 단일 지표의 한계를 피하고 신호의 안정성을 강화합니다.

또 다른 장점은 두 가지 다른 유형의 기술을 조합하여 판단의 포괄성을 더욱 높이는 것입니다.

마지막으로, 조합 사용은 또한 최적화 테스트를 위한 더 많은 매개 변수 공간을 제공합니다.

  1. 잠재적인 위험

그러나 이 전략에는 다음과 같은 문제점이 있습니다.

첫째, 다중 지표 조합은 파라미터를 최적화하는 데 어려움을 증가시키고, 잘못 설정하면 과대 최적화가 발생할 수 있다.

두 번째, 두 가지 기술 신호 사이에 차이가 발생할 수 있으므로 명확한 판단 규칙을 설정해야합니다.

마지막으로, 일부 지표들, 예를 들어 무작위 지표들에는 지연 문제가 있다.

네 가지 내용

이 글은 다중 지표 검증을 통해 거래량을 측정하는 전략을 자세히 소개한다. 이 전략은 지표를 조합하여 신호 품질을 향상시키지만, 파라미터 최적화의 어려움과 지표 지연과 같은 문제도 주의해야 한다. 전체적으로 이 전략은 비교적 안정적인 거래 방법을 제공한다.

전략 소스 코드
/*backtest
start: 2023-08-15 00:00:00
end: 2023-09-14 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 21/07/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
// Accumulation is a term used to describe a market controlled by buyers;
// whereas distribution is defined by a market controlled by sellers.
// Williams recommends trading this indicator based on divergences:
//  Distribution of the security is indicated when the security is making 
//  a new high and the A/D indicator is failing to make a new high. Sell.
//  Accumulation of the security is indicated when the security is making 
//  a new low and the A/D indicator is failing to make a new low. Buy. 
//
// 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


SWAD(Length) =>
    pos = 0.0
    xWAD = 0.0
    xPrice = close
    xWAD:= iff(close > nz(close[1], 0), nz(xWAD[1],0) + close - low[1], 
             iff(close < nz(close[1],0), nz(xWAD[1],0) + close - high[1],0))
    xWADMA = sma(xWAD, Length)
    pos:= iff(xWAD > xWADMA, 1,
             iff(xWAD < xWADMA, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Smoothed Williams AD", 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, "---- Smoothed Williams AD ----")
LengthWillAD = input(14, step = 1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posSWAD = SWAD(LengthWillAD)
pos = iff(posReversal123 == 1 and posSWAD == 1 , 1,
	   iff(posReversal123 == -1 and posSWAD == -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 )