동력 역전 거래 전략

저자:차오장, 날짜: 2023-10-09 17:21:27
태그:

전반적인 설명

모멘텀 리버스 거래 전략은 이변과 모멘텀 전략의 장점을 결합하여 두 유형의 지표의 신호를 활용하여 수익을 위해 전환점에 반대 방향으로 거래를합니다.

전략 논리

이 전략은 두 부분으로 구성됩니다.

첫 번째 부분은 123 역전 전략입니다.

  • 클로즈 가격이 2일 연속으로 이전 클로즈보다 높고, 9일 느린 스토카스틱 오시레이터가 50보다 낮을 때 롱으로 이동합니다.

  • 마감 가격이 2일 연속 마감보다 낮고 9일 빠른 스토카스틱 오시레이터가 50보다 높을 때 마감합니다.

두 번째 부분은 필터링 된 운동량 지표입니다. 계산 단계는 다음과 같습니다.

  1. 가격 변화 xMom = 닫기 - 닫기 계산 [1]

  2. 절대 가격 변화 xMomAbs = abs를 계산합니다 ((결결 - 종료 [1])

  3. 임계치보다 작으면 xMom 필터 0으로 필터

  4. 임계치 이하인 경우 xMomAbs를 필터링합니다 0으로 필터링합니다

  5. n일 동안 필터링된 xMom의 합을 계산합니다. nSum

  6. n 일 동안 필터링된 xMomAbs의 합을 계산합니다. nAbsSum

  7. 운동량 값을 계산합니다: nRes = 100 * nSum / nAbsSum

  8. nRes 및 대역 TopBand, LowBand를 기반으로 신호를 생성

이 지표는 작은 변동을 필터링하고 주요 트렌드에서 모멘텀 정보를 추출합니다.

마지막으로, 거래 신호는 두 지표의 신호가 길거나 짧게 정렬될 때 생성됩니다.

이점 분석

이 전략은 신호 품질을 향상시키기 위해 두 가지 다른 유형의 지표의 장점을 결합합니다.

  1. 123 역전 전략은 역전 트렌드를 전환점에 파악하여 함정에 빠지지 않도록 합니다.

  2. 필터링된 모멘텀 지표는 큰 움직임에만 초점을 맞추고 소음을 필터링하고 주요 트렌드를 잡습니다.

  3. 그것들을 결합하면 신호를 확인하고 잘못된 거래를 줄이고 승률을 향상시킵니다.

위험 분석

이 전략의 주요 위험은 다음과 같습니다.

  1. 단일 시간 프레임 분석은 더 큰 추세를 놓칠 수 있습니다.

  2. 정적 매개 변수 설정은 시장 변화에 적응할 수 없습니다.

  3. 이중 검증은 수익 잠재력을 감소시키는 몇 가지 기회를 놓칠 수 있습니다.

  4. 또한 낮은 품질의 신호가 확인되어 손실이 발생할 수 있습니다.

최적화 방향

이 전략은 몇 가지 측면에서 최적화 될 수 있습니다.

  1. 덫에 걸리지 않도록 여러 시간 프레임 검증을 추가합니다.

  2. 시장 조건에 따라 지표를 조정하기 위해 적응 매개 변수를 사용합니다.

  3. 잘못된 신호를 줄이기 위해 필터 문턱을 최적화합니다.

  4. 단일 거래 손실 금액을 제어하기 위해 Stop Loss를 추가합니다.

  5. 자본 활용 효율을 최적화하기 위해 포지션 크기를 조정합니다.

결론

결론적으로, 모멘텀 역전 전략은 신호 품질과 수익성을 어느 정도 향상시키기 위해 역전 및 필터 된 모멘텀 전략의 장점을 결합합니다. 그러나 더 큰 트렌드, 정적 매개 변수, 잘못된 신호 등을 무시하는 것과 같은 몇 가지 단점도 있습니다. 멀티 타임프레임 검증, 적응 매개 변수, 스톱 로스 같은 방법은 위험을 줄이고 안정적인 수익성을 향상함으로써 전략을 최적화 할 수 있습니다.


/*backtest
start: 2023-09-08 00:00:00
end: 2023-10-08 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 25/09/2019
// 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
// This indicator plots a CMO which ignores price changes which are less 
// than a threshold value. CMO was developed by Tushar Chande. A scientist, 
// an inventor, and a respected trading system developer, Mr. Chande developed 
// the CMO to capture what he calls "pure momentum". For more definitive 
// information on the CMO and other indicators we recommend the book The New 
// Technical Trader by Tushar Chande and Stanley Kroll.
// The CMO is closely related to, yet unique from, other momentum oriented 
// indicators such as Relative Strength Index, Stochastic, Rate-of-Change, etc. 
// It is most closely related to Welles Wilder`s RSI, yet it differs in several ways:
// - It uses data for both up days and down days in the numerator, thereby directly 
// measuring momentum;
// - The calculations are applied on unsmoothed data. Therefore, short-term extreme 
// movements in price are not hidden. Once calculated, smoothing can be applied to the 
// CMO, if desired;
// - The scale is bounded between +100 and -100, thereby allowing you to clearly see 
// changes in net momentum using the 0 level. The bounded scale also allows you to 
// conveniently compare values across different securities.
//
// 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

fFilter(xSeriesSum, xSeriesV, Filter) =>
    iff(xSeriesV > Filter, xSeriesSum, 0)

CMOfilt(Length,Filter, TopBand, LowBand) =>
    pos = 0
    xMom = close - close[1]
    xMomAbs = abs(close - close[1])
    xMomFilter = fFilter(xMom, xMomAbs, Filter)
    xMomAbsFilter = fFilter(xMomAbs,xMomAbs, Filter)
    nSum = sum(xMomFilter, Length)
    nAbsSum = sum(xMomAbsFilter, Length)
    nRes =   100 * nSum / nAbsSum
    pos := iff(nRes > TopBand, 1,
	         iff(nRes < LowBand, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & CMOfilt", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthCMO = input(9, minval=1)
Filter = input(3, minval=1)
TopBand = input(70, minval=1)
LowBand = input(-70, maxval=-1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posCMOfilt = CMOfilt(LengthCMO,Filter, TopBand, LowBand)
pos = iff(posReversal123 == 1 and posCMOfilt == 1 , 1,
	   iff(posReversal123 == -1 and posCMOfilt == -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 )

더 많은