역삼체 양적 전략

저자:차오장, 날짜: 2023-12-01 14:14:46
태그:

img

전반적인 설명

리버스 트라이드 양적 전략은 트렌드 역전을 판단하고 더 정확한 거래 신호를 생성하기 위해 123 역전 전략과 가속기 오시레이터를 결합합니다. 이 전략은 주로 주식 지수, 외화, 귀금속 및 에너지 제품의 단기 및 중기 거래에 사용됩니다.

전략 논리

이 전략은 두 개의 독립적인 논리 코드들로 구성되어 있습니다.

첫 번째 부분은 123 리버설 전략이다. 리버설 신호를 판단하는 원리는 다음과 같습니다. 클로즈 가격이 2 일 연속으로 이전 클로즈보다 낮고 9 일 STOCH K 라인이 D 라인의 아래에있을 때 구매 신호가 생성됩니다. 클로즈 가격이 2 일 연속으로 이전 클로즈보다 높고 9 일 STOCH K 라인이 D 라인의 위에있을 때 판매 신호가 생성됩니다.

두 번째 부분은 가속자 오시일레이터 지표입니다. 이 지표는 오시일레이터와 5주기 이동 평균의 차이를 계산하여 오시일레이터의 변화 속도를 반영합니다. 이는 오시일레이터보다 더 일찍 트렌드 반전 지점을 식별하는 데 도움이 될 수 있습니다.

마지막으로, 이 전략은 두 지표의 신호를 결합합니다: 두 지표의 신호가 같은 방향으로 (둘 다 길거나 둘 다 짧은) 있을 때, 대응하는 방향 신호가 출력됩니다. 두 지표의 신호가 일치하지 않을 때, 0 신호가 출력됩니다.

이점 분석

이 전략은 일부 잘못된 신호를 필터링하기 위해 이중 지표 판단을 결합하여 신호를 더 정확하고 신뢰할 수 있습니다. 동시에 가속 변동을 반영하는 가속 오시레이터의 기능을 활용함으로써 잠재적 인 트렌드 역전 지점을 조기에 포착하여 더 큰 수익 공간을 포착 할 수 있습니다.

위험 분석

이 전략의 가장 큰 위험은 지표가 신호를 생성하기 전에 가격이 이미 크게 역전되어 가장 좋은 입구 지점을 놓치고 있다는 것입니다. 또한 급격한 시장 변동의 경우 지표 매개 변수를 최적화하고 조정해야합니다.

엔트리 포인트 리스크를 해결하기 위해 신호 신뢰성을 보장하기 위해 더 많은 반전 지표를 결합 할 수 있습니다. 매개 변수 최적화 문제에 대해 매개 변수 합리성을 보장하기 위해 동적 조정 메커니즘을 설정 할 수 있습니다.

최적화 방향

이 전략의 다음 측면은 최적화 될 수 있습니다.

  1. 높은 변동성 단계에서 잘못된 신호를 생성하지 않도록 필터링 조건을 추가합니다.

  2. 복수 검증 메커니즘을 형성하기 위해 더 많은 반전 지표를 결합합니다.

  3. 지표 매개 변수를 동적으로 조정하기 위한 매개 변수 자기 적응 메커니즘을 설정

  4. 단일 스톱 손실을 제어하기 위해 스톱 손실 전략을 최적화하십시오.

결론

리버스 트라이드 양적 전략은 이중 검증을 통해 신호 정확성을 향상시킵니다. 이는 시장의 주요 역전 지점을 파악하는 데 도움이 됩니다. 동시에, 지표 지연 및 매개 변수 실패와 같은 위험을 예방하는 데도주의를 기울여야 합니다. 끊임없이 변화하는 시장 환경에 적응하기 위해 전략의 지속적인 검증과 최적화가 필요합니다. 이 전략은 일부 양적 거래 경험이있는 투자자에게 적합합니다.


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

//@version=3
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 25/04/2019
// This is combo strategies for get 
// a cumulative signal. Result signal will return 1 if two strategies 
// is long, -1 if all strategies is short and 0 if signals of strategies is not equal.
//
// 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.
//
// Secon strategy
// The Accelerator Oscillator has been developed by Bill Williams 
// as the development of the Awesome Oscillator. It represents the 
// difference between the Awesome Oscillator and the 5-period moving 
// average, and as such it shows the speed of change of the Awesome 
// Oscillator, which can be useful to find trend reversals before the 
// Awesome Oscillator does.
//
// 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

AcceleratorOscillator(nLengthSlow, nLengthFast) =>
    xSMA1_hl2 = sma(hl2, nLengthFast)
    xSMA2_hl2 = sma(hl2, nLengthSlow)
    xSMA1_SMA2 = xSMA1_hl2 - xSMA2_hl2
    xSMA_hl2 = sma(xSMA1_SMA2, nLengthFast)
    nRes =  xSMA1_SMA2 - xSMA_hl2
    cClr = nRes > nRes[1] ? blue : red
    pos = 0.0
    pos := iff(nRes > 0, 1,
             iff(nRes < 0, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal and Accelerator Oscillator (AC)", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
nLengthSlow = input(34, minval=1, title="Length Slow")
nLengthFast = input(5, minval=1, title="Length Fast")
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posAcceleratorOscillator = AcceleratorOscillator(nLengthSlow, nLengthFast)
pos = iff(posReversal123 == 1 and posAcceleratorOscillator == 1 , 1,
	   iff(posReversal123 == -1 and posAcceleratorOscillator == -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 ? red: possig == 1 ? green : blue ) 

더 많은