다중 지표 확인을 가진 양적 거래 전략

저자:차오장, 날짜: 2023-09-15 11:55:04
태그:

이 문서에서는 신호를 생성하기 위해 다중 지표 확인을 활용하는 양적 거래 전략을 자세히 설명합니다. 신뢰성을 향상시키기 위해 다양한 기술을 결합합니다.

I. 전략 논리

이 전략은 두 가지 기술을 합성합니다.

(1) 123 반전 패턴

  1. 촛불과 밀접한 관계를 바탕으로 잠재적인 바닥과 꼭대기를 식별합니다.

  2. 역전 신호를 검증하고 잘못된 신호를 피하기 위해 스토카스틱을 사용하세요.

(2) 평탄 한 축적/분배

  1. 축적/분배 및 이동 평균을 계산합니다.

  2. 지표와 MA 사이의 오차를 기반으로 동향을 결정합니다.

  3. 양쪽 기술에서 받아들일 수 있는 신호만 채취합니다.

여러 번 확인을 요구함으로써, 특정 잘못된 신호를 필터링하여 정확도를 향상시킬 수 있습니다.

II. 전략의 장점

가장 큰 장점은 단일 지표의 한계를 극복하고 안정성을 향상시키는 다중 지표 확인입니다.

또 다른 장점은 더 많은 포괄성을 위해 두 가지 다른 기술 유형을 결합하는 것입니다.

마지막으로, 조합은 또한 더 많은 조율 옵션을 제공합니다.

III. 잠재적 위험

그러나 다음과 같은 위험 요소가 있습니다.

첫째, 다중 지표 조합은 최적화 어려움이 증가하고 과도한 적합성 위험이 증가합니다.

둘째, 지표들 사이의 오차는 명확한 판단 규칙을 요구합니다.

마지막으로, 일부 지표는 여전히 문제점을 가지고 있습니다.

IV. 요약

요약적으로,이 기사는 다중 지표 확인을 활용한 양적 거래 전략을 설명했습니다. 그것은 합성을 통해 신호를 향상하지만 최적화 어려움과 지표 지연을 관리해야합니다. 전반적으로 비교적 견고한 접근 방식을 제공합니다.


/*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 )

더 많은