이중 확인 양상 거래 전략

저자:차오장, 날짜: 2024-01-15 15:21:39
태그:

img

전반적인 설명

이중 확인 양 거래 전략은 거래 위험을 줄이기 위해 123 역전 전략과 퍼센티엄 오시레이터 (PVO) 하위 전략을 결합하여 거래 신호의 이중 확인을 실현합니다. 이 전략은 주로 중장기 포지션 보유 거래에 적합합니다.

거래 원칙

123 역전 전략

123 역전 전략은 스토카스틱 지표에 의해 구현된 K-라인 패턴을 기반으로합니다. 구체적으로, 종료 가격이 2 일 연속으로 전날의 종료 가격보다 낮고 9 일 느린 스토카스틱이 50 이하일 때 길어집니다. 종료 가격이 2 일 연속으로 전날의 종료 가격보다 높고 9 일 빠른 스토카스틱이 50 이상일 때 짧습니다.

% 부피 오시레이터 (PVO)

PVO는 볼륨에 기반한 모멘텀 오시레이터이다. 그것은 더 긴 기간 평균의 비율로 서로 다른 기간 동안 두 개의 기하급수적인 이동 평균의 차이를 측정한다. 짧은 기간 EMA가 더 긴 기간 EMA보다 높을 때 긍정적이며 짧은 기간 EMA가 아래에있을 때 부정적이다. 이 지표는 거래량의 상승과 하락을 반영한다.

이점 분석

이 전략은 가격 및 부피 지표를 결합하여 잘못된 브레이크를 효과적으로 필터합니다. 동시에 이중 확인 메커니즘을 사용하여 거래 빈도를 줄이고 거래 위험을 줄일 수 있습니다.

위험 분석

이 전략은 더 긴 보유 기간에 의존하며 마감 위험이 있습니다. 또한 잘못된 매개 변수 설정은 과도한 거래 또는 신호가 사라질 수도 있습니다.

최적화 방향

하위 전략의 성능은 스토카스틱 및 PVO의 매개 변수를 조정하여 최적화 할 수 있습니다. 또한 위험을 제어하기 위해 스톱 손실 메커니즘을 도입 할 수 있습니다. 또한 다른 지표와 신호를 필터링하면 전략의 안정성을 더욱 향상시킬 수 있습니다.

결론

이중 확인 양상 거래 전략은 좋은 백테스트 결과를 가진 가격 및 양량 요인을 모두 고려합니다. 매개 변수 조정 및 신호 필터링 최적화를 통해이 전략은 안정성을 더욱 향상시키고 양적 거래의 강력한 도구가 될 가능성이 있습니다.


/*backtest
start: 2024-01-07 00:00:00
end: 2024-01-14 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 14/04/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 Percentage Volume Oscillator (PVO) is a momentum oscillator for volume. 
// PVO measures the difference between two volume-based moving averages as a 
// percentage of the larger moving average. As with MACD and the Percentage Price 
// Oscillator (PPO), it is shown with a signal line, a histogram and a centerline. 
// PVO is positive when the shorter volume EMA is above the longer volume EMA and 
// negative when the shorter volume EMA is below. This indicator can be used to define 
// the ups and downs for volume, which can then be use to confirm or refute other signals. 
// Typically, a breakout or support break is validated when PVO is rising or positive. 
//
// 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


PVO(LengthShortEMA,LengthLongEMA,LengthSignalEMA) =>
    pos = 0.0
    xShortEMA = ema(volume , LengthShortEMA)
    xLongEMA = ema(volume , LengthLongEMA)
    xPVO = ((xShortEMA - xLongEMA) / xLongEMA) * 100
    xSignalEMA = ema(xPVO , LengthSignalEMA)
    xPVOHisto = xPVO - xSignalEMA
    pos := iff(xSignalEMA < xPVO, -1,
    	      iff(xSignalEMA > xPVO, 1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Percentage Volume Oscillator (PVO)", 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, "---- Percentage Volume OscillatorA ----")
LengthShortEMA = input(12, minval=1)
LengthLongEMA = input(26, minval=1)
LengthSignalEMA = input(9, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posPVO = PVO(LengthShortEMA,LengthLongEMA,LengthSignalEMA)
pos = iff(posReversal123 == 1 and posPVO == 1 , 1,
	   iff(posReversal123 == -1 and posPVO == -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 )

더 많은