이중 지표 평균 반전 추세 전략

저자:차오장, 날짜: 2024-02-01 10:55:30
태그:

img

전반적인 설명

이 전략은 이동 평균 지표와 시장 촉진 지표를 결합하여 구매 및 판매 신호를 생성합니다. 그것은 평균 반전 거래 전략 범주에 속합니다.

원칙

이 전략은 신호를 생성하기 위해 두 가지 지표를 사용합니다. 첫 번째는 이동 평균 지표입니다. 특히 스토카스틱 오시레이터의 빠른 라인과 느린 라인의 조합입니다. 가격이 2 일 연속으로 닫히고 빠른 라인이 느린 라인의 위에있을 때 판매 신호를 생성합니다. 가격이 2 일 연속으로 닫히고 빠른 라인이 느린 라인의 아래에있을 때 구매 신호를 생성합니다. 가격 역전 및 빠른 라인과 느린 라인의 관계를 모니터링함으로써 가격 트렌드의 잠재적 전환점을 예측하는 것을 목표로합니다.

두 번째 지표는 시장 촉진 지표이다. 가격 범위와 부피 사이의 관계를 계산함으로써 가격 움직임의 효율성을 측정한다. 지표가 상승하면 시장 유동성 향상과 더 높은 운영 효율성을 나타내고 트렌딩 시장을 신호한다. 지표가 감소하면 유동성 악화와 효율성 감소를 나타내고 잠재적인 옆으로 변화하는 시장 또는 트렌드 역전을 암시한다.

이 전략은 두 지표가 동시에 일치하는 거래 신호를 발행할 때 실제 구매 및 판매 명령을 생성합니다.

장점

  • 두 개의 표시기에서 확인을 요구하여 잘못된 신호를 피함으로써 신호 정확성을 향상시킵니다.
  • 평균 반전 지표와 트렌드 판단 지표의 조합은 주요 트렌드에 반하는 거래를 피하는 데 도움이됩니다.
  • 매개 변수를 자주 조정하고 수동 개입을 줄이는 필요

위험 과 해결책

  • 장기적인 일방적 상승 추세 또는 하락 추세로 전환 기회를 활용하기 어렵고 시장 진출이 불가능합니다.

  • 매입 및 판매 신호를 캡처 할 수있는 기회를 높이기 위해 평균 반전 지표의 매개 변수를 풀 수 있습니다

  • 또한 수익을 보상하기 위해 트렌드를 타고 위치 크기를 확장 할 수 있습니다

  • 부정확한 반전 신호는 전략을 무효화 할 수 있습니다.

  • 매개 변수를 최적화하거나 잘못된 신호를 필터링하기 위해 신호 확인 단계를 추가 할 수 있습니다.

개선 영역

  • 최적 설정을 찾기 위해 더 많은 매개 변수 조합을 테스트
  • 더 많은 평균 회귀 지표를 탐구하고 다른 지표의 성능을 평가합니다.
  • 단일 거래 손실을 제한하기 위해 스톱 손실을 도입
  • 더 정확한 반전 신호를 생성하기 위해 빅 데이터에 훈련된 기계 학습 모델을 통합합니다.

요약

이 전략은 평균 반전 지표와 트렌드 판단 지표를 결합하여 주요 트렌드 방향을 존중하면서 반전 신호가 나타나면 시장에 진출합니다. 이중 지표 확인을 사용하면 잘못된 신호를 효과적으로 제거합니다. 장기적인 일방적인 트렌드와 잘못된 반전 신호 중에도 위험이 있습니다. 파라미터 튜닝, 스톱 로스, 지표 업그레이드 및 기계 학습 모델을 통해 추가 최적화가 가능합니다.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 02/02/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 Market Facilitation Index is an indicator that relates price range to 
// volume and measures the efficency of price movement. Use the indicator to 
// determine if the market is trending. If the Market Facilitation Index increased, 
// then the market is facilitating trade and is more efficient, implying that the 
// market is trending. If the Market Facilitation Index decreased, then the market 
// is becoming less efficient, which may indicate a trading range is developing that 
// may be a trend reversal.
//
// 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


MFI(BuyZone,SellZone) =>
    pos = 0.0
    xmyVol = volume
    xmyhigh = high
    xmylow = low
    nRes = (xmyhigh - xmylow) / xmyVol * 10000
    pos := iff(nRes > BuyZone, 1,
             iff(nRes < SellZone, -1, nz(pos[1], 0)))
    pos

strategy(title="Combo Backtest 123 Reversal & Market Facilitation Index", 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, "---- MFI ----")
SellZone = input(6.2, minval=0.01, step = 0.01)
BuyZone = input(1, minval=0.01, step = 0.01)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posMFI = MFI(BuyZone,SellZone)
pos = iff(posReversal123 == 1 and posMFI == 1 , 1,
	   iff(posReversal123 == -1 and posMFI == -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 )

더 많은