동력 역전 거래 전략

저자:차오장, 날짜: 2023-11-15 15:36:39
태그:

img

전반적인 설명

이 전략은 전환점에 거래하기 위해 123 역전 패턴과 움직임의 용이성 (EOM) 을 결합합니다. 123 역전 패턴은 가격이 3 일 연속으로 특정 패턴을 형성 할 때 신호를 생성합니다. EOM 전략은 시장 동력을 측정하기 위해 가격과 부피의 변화를 활용합니다. 두 전략의 조합은 기술 패턴뿐만 아니라 동력을 고려하여 거래 신호의 정확성을 향상시킵니다.

전략 논리

이 전략은 두 가지 구성 요소로 구성됩니다.

  1. 123 반전 패턴
  • 과잉 구매 및 과잉 판매 수준을 식별하기 위해 Stoch를 사용
  • 가격이 2 일 연속 하락하고 스톡 빠른 라인이 느린 라인의 위에있을 때 짧은 이동
  • 2 일 연속으로 가격이 상승하고 스톡 빠른 라인이 느린 라인의 아래에있을 때 긴 이동
  1. 가동 가 용이 하다
  • 전날의 범위의 중간점을 계산합니다.
  • 전날과 비교한 중간점의 변화를 계산합니다.
  • 중점 이동과 부피의 비율을 계산
  • 임계 이상의 비율은 상승, 임계 이하의 비율은 하락을 나타냅니다.

이 전략은 EOM와 123 신호가 긴 쪽에 정렬될 때 길게 가고, 신호가 짧은 쪽에 정렬될 때 짧게 됩니다.

이점 분석

이 전략의 장점:

  1. 더 나은 신호 정확성을 위해 가격 패턴과 추진력을 결합합니다.

  2. 123 패턴은 전환점을 잡습니다. EOM 가이드는 트렌드 모멘텀을 측정합니다. 둘은 서로를 보완합니다.

  3. 스톡은 통합 과정에서 위프사를 피합니다.

  4. 간단하고 쉽게 실행

  5. 다른 시장 환경에 맞게 사용자 정의 가능한 매개 변수

위험 분석

고려해야 할 위험:

  1. 패러미터 설정에 지나치게 의존하고, 부적절한 설정은 오버 트레이딩 또는 놓친 트레이드를 초래할 수 있습니다.

  2. 많은 필터는 신호가 너무 적을 수 있습니다.

  3. 변동성에 민감한 EOM, 잘못된 신호를 생성할 수 있습니다.

  4. 라이브 성능은 백테스트보다 약합니다. 위치 크기를 제어해야 합니다.

  5. 트렌딩 주식만 사용할 수 있습니다.

개선 방향

이 전략은 다음과 같이 개선될 수 있습니다.

  1. 신호의 주파수와 품질을 균형을 맞추기 위한 매개 변수 최적화

  2. 단일 거래 손실을 통제하는 데 Stop Loss를 추가합니다.

  3. 트렌드 필터를 추가하여 트렌드 반대 거래를 피합니다.

  4. 변동성에 기초한 포지션 크기를 포함합니다.

  5. 매개 변수를 동적으로 최적화하기 위해 기계 학습을 사용

결론

이 전략은 높은 실용적 가치를 위해 가격 패턴과 동력을 통합합니다. 그러나 거래 빈도, 손실 통제 및 역 트렌드 리스크를 관리해야합니다. 매개 변수, 스톱 로스, 트렌드 필터링의 추가 개선은 안정성과 수익성을 향상시킬 수 있습니다. 논리는 양 트레이더에게 명확하고 구현하기가 쉽습니다.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 14/04/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
// This indicator gauges the magnitude of price and volume movement. 
// The indicator returns both positive and negative values where a 
// positive value means the market has moved up from yesterday's value 
// and a negative value means the market has moved down. A large positive 
// or large negative value indicates a large move in price and/or lighter 
// volume. A small positive or small negative value indicates a small move 
// in price and/or heavier volume.
// A positive or negative numeric value. A positive value means the market 
// has moved up from yesterday's value, whereas, a negative value means the 
// market has moved down. 
//
// 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

EOM(BuyZone, SellZone) =>
    pos = 0
    xHigh = high
    xLow = low
    xVolume = volume
    xHalfRange = (xHigh - xLow) * 0.5
    xMidpointMove = mom(xHalfRange, 1)
    xBoxRatio = iff((xHigh - xLow) != 0, xVolume / (xHigh - xLow), 0)
    nRes = iff(xBoxRatio != 0, 1000000 * ((xMidpointMove - xMidpointMove[1]) / xBoxRatio), 0)
    pos := iff(nRes > BuyZone, 1,
             iff(nRes < SellZone, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Ease of Movement (EOM)", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
BuyZone = input(4000, minval=1)
SellZone = input(-4000)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posEOM = EOM(BuyZone, SellZone)
pos = iff(posReversal123 == 1 and posEOM == 1 , 1,
	   iff(posReversal123 == -1 and posEOM == -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 )

더 많은