이중 이동 평균 중재 전략

저자:차오장, 날짜: 2023-11-24 14:21:06
태그:

img

전반적인 설명

이 중재 전략은 중재 거래를 하기 위해 이중 이동 평균 형식을 이용하는 중재 전략이다. 123 반전 패턴과 유한량 요소 (FVE) 하위 전략을 결합하여 둘 다 구매 또는 판매 신호를 동시에 할 때 중재 거래를 한다.

전략 논리

123 반전 패턴

이 하위 전략은 울프 젠슨의 책에서 나온다.

  • 닫기 가격이 2일 연속 상승하고 9일 슬로우 스톡이 50보다 낮을 때 장면을 취합니다.
  • 닫기 가격이 2일 연속 하락하고 9일 패스트 스톡이 50보다 높을 때 쇼트를 합니다.

유한용량 요소 (FVE)

FVE는 순수한 거래량 지표입니다. 가격 이동 범위와 거래량에 따라 돈이 들어오고 있는지 여부를 판단합니다.

FVE 지표의 마지막 두 바가 함께 상승하거나 떨어질 때 신호를 줍니다.

이점 분석

이 전략은 시장 추세와 금전 흐름을 결정하기 위해 두 가지 유형의 지표를 결합하여 잘못된 신호를 효과적으로 피할 수 있습니다. 또한, 두 부 전략은 일부 반전 특성을 가지고 있으므로 중재 거래는 이익을 얻을 수 있습니다.

또한 이중 이동 평균 형식은 단기 및 중기 트렌드 사이의 일관성을 나타냅니다. 따라서 더 큰 안정성을 가지고 있습니다.

위험 분석

이 전략은 이동 평균 형식에 의존하며, 이는 쉽게 잘못된 신호를 생성하고 시장 변동에 손실로 이어질 수 있습니다. 역전 실패도 일반적인 위험입니다.

위험은 전략을 더 견고하게 만들기 위해 매개 변수를 적절히 조정하거나 위험을 제어하기 위해 스톱 로스를 설정함으로써 감소 할 수 있습니다.

최적화 방향

최적의 매치를 찾기 위해 더 많은 종류의 이동 평균을 테스트 할 수 있습니다. 잘못된 신호를 피하기 위해 강도 지수 및 변동성 지수와 같은 다른 보조 지표도 도입 할 수 있습니다.

또한 적응력을 향상시키기 위해 시장 조건에 따라 매개 변수를 동적으로 조정하는 방법에 대한 연구가 수행 될 수 있습니다. 기계 학습 및 신경 네트워크는 매개 변수 자기 적응성을 위해 탐구 할 수도 있습니다.

요약

이 이중 이동 평균 중재 전략은 판단을 위해 두 개의 반전 유형의 지표를 통합하여 어느 정도 위험을 완화 할 수 있습니다. 그러나 이동 평균 형식에 의존하는 것은 전략을 더 견고하게 만들기 위해 추가 최적화가 필요하다는 것을 의미합니다. 전반적으로 단기 중재 거래에 기본 프레임워크를 제공하며 추가 연구가 필요합니다.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 25/08/2020
// 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 FVE is a pure volume indicator. Unlike most of the other indicators 
// (except OBV), price change doesn?t come into the equation for the FVE (price 
// is not multiplied by volume), but is only used to determine whether money is 
// flowing in or out of the stock. This is contrary to the current trend in the 
// design of modern money flow indicators. The author decided against a price-volume 
// indicator for the following reasons:
// - A pure volume indicator has more power to contradict.
// - The number of buyers or sellers (which is assessed by volume) will be the same, 
//     regardless of the price fluctuation.
// - Price-volume indicators tend to spike excessively at breakouts or breakdowns.
//
// 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


FVE(Period,Factor) =>
    pos = 0
    nRes = 0.0
    xhl2 = hl2
    xhlc3 = hlc3
    xClose = close
    xVolume = volume
    xSMAV = sma(xVolume, Period)
    nMF = xClose - xhl2 + xhlc3 - xhlc3[1]
    nVlm = iff(nMF > Factor * xClose / 100,  xVolume, 
             iff(nMF < -Factor * xClose / 100, -xVolume, 0))
    nRes := nz(nRes[1],0) + ((nVlm / xSMAV) / Period) * 100
    pos := iff(nRes > nRes[1] and nRes > nRes[2], 1,
             iff(nRes < nRes[1] and nRes < nRes[2], -1, nz(pos[1], 0)))   
    pos

strategy(title="Combo Backtest 123 Reversal & Finite Volume Elements (FVE)", shorttitle="Combo", overlay = true)
Length = input(15, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Period = input(18, minval=1)
Factor = input(0.6, minval=0.1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posFVE = FVE(Period,Factor)
pos = iff(posReversal123 == 1 and posFVE == 1 , 1,
	   iff(posReversal123 == -1 and posFVE == -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 )

더 많은