모멘텀 풀백 전략

저자:차오장, 날짜: 2024-01-23 15:23:14
태그:

img

전반적인 설명

이 전략은 시장에서 잠재적 인 인퇴의 기회를 식별하는 것을 목표로합니다. 그것은 장기 이동 평균 (MA1) 및 단기 이동 평균 (MA2) 와 함께 이중 이동 평균 시스템을 사용합니다. 주요 목표는 폐쇄 가격이 MA1 이하이지만 MA2 이상일 때 긴 거리로 이동하여 전반적인 추세 내에서 잠재적 인 인퇴를 신호합니다.

전략 논리

이 전략은 MA1 (장기) 와 MA2 (단기) 라는 두 개의 이동 평균을 이용한다. 논리는 가격이 장기 트렌드의 지원을 테스트하기 위해 잠시 후퇴하면 긴 기회를 제시할 수 있다는 것이다. 구체적으로, 닫기 가격이 장기 지원 (MA1) 이상으로 유지되면 주요 트렌드가 그대로 유지된다. 그러나 닫기 가격이 단기 MA (MA2) 이하로 깨지만 여전히 장기 MA (MA1) 이상으로 유지되면 교과서적 인 인회 설정을 신호한다. 여기서 스톱 로스로 장기적으로 이동하여 가격이 짧은 MA 이상으로 돌아가는 것을 목표로 할 수 있다.

이점 분석

이 전략의 장점은 다음과 같습니다.

  1. 적용하기 쉽고 이해하기 쉬운 유연한 매개 변수 조정
  2. 주요 트렌드를 식별하고 트렌드 반대 거래를 피하기 위해 이중 MA를 활용합니다.
  3. 비정상적인 월경을 피하기 위해 사용자 정의 가능한 시간 필터
  4. 각기 다른 리스크 선호도에 맞게 조정할 수 있는 포지션 크기
  5. 하락위험을 제한하기 위한 스톱 로스 메커니즘

위험 분석

주의해야 할 위험:

  1. 가격 하락이 계속되고 스톱 로스가 발생하면 실패한 회귀
  2. 주요 지원 영역이 깨지면 주요 트렌드 반전
  3. 휘프사와 변동적인 가격 행동으로 인한 오차
  4. 부적절한 시간 필터에서 빠진 거래

위험을 최적화하고 완화 할 수있는 몇 가지 방법:

  1. 신호 품질을 향상시키기 위해 MA 매개 변수를 최적화합니다.
  2. 수익을 극대화하면서 위험을 최소화하기 위해 스톱 로스 레벨을 세밀하게 조정
  3. 가장 좋은 거래 기간에 초점을 맞추기 위해 시간 필터를 조정
  4. 다른 도구와 시장 환경에서 테스트

더 나은 기회

전략을 강화하는 몇 가지 방법:

  1. 가장 좋은 조합을 찾기 위해 MA 매개 변수를 최적화
  2. 트레일링 또는 캔들리어 스톱과 같은 다른 스톱 손실 메커니즘을 테스트하십시오.
  3. 부피나 변동성 같은 추가 필터를 추가합니다.
  4. 금색 십자가를 더하고 죽음의 십자가를 줄이는 것과 같은 위치 크기 규칙을 포함
  5. 자동화된 수익제도 구축
  6. 주요 측정값을 분석하고 매개 변수를 최종 결정하기 위한 백테스트

결론

요약하자면, 이것은 간결한 평균회귀 회귀 전략이다. 이중 MA 접근법으로 회귀 설정을 식별하고 적응적 중지로 위험을 관리합니다. 전략은 유연한 조정으로 파악하고 구현하기가 쉽습니다. 다음 단계는 MA 매개 변수, 중지 손실, 필터와 같은 요소에 대한 추가 최적화입니다. 전략을 더 견고하게 만들기 위해.


/*backtest
start: 2023-01-16 00:00:00
end: 2024-01-22 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ZenAndTheArtOfTrading / www.PineScriptMastery.com
// @version=5
strategy("Simple Pullback Strategy", 
     overlay=true, 
     initial_capital=50000,
     default_qty_type=strategy.percent_of_equity, 
     default_qty_value=100, // 100% of balance invested on each trade
     commission_type=strategy.commission.cash_per_contract, 
     commission_value=0.005) // Interactive Brokers rate

// Get user input
i_ma1           = input.int(title="MA 1 Length", defval=200, step=10, group="Strategy Parameters", tooltip="Long-term MA")
i_ma2           = input.int(title="MA 2 Length", defval=10, step=10, group="Strategy Parameters", tooltip="Short-term MA")
i_stopPercent   = input.float(title="Stop Loss Percent", defval=0.10, step=0.1, group="Strategy Parameters", tooltip="Failsafe Stop Loss Percent Decline")
i_lowerClose    = input.bool(title="Exit On Lower Close", defval=false, group="Strategy Parameters", tooltip="Wait for a lower-close before exiting above MA2")
i_startTime     = input(title="Start Filter", defval=timestamp("01 Jan 1995 13:30 +0000"), group="Time Filter", tooltip="Start date & time to begin searching for setups")
i_endTime       = input(title="End Filter", defval=timestamp("1 Jan 2099 19:30 +0000"), group="Time Filter", tooltip="End date & time to stop searching for setups")

// Get indicator values
ma1 = ta.sma(close, i_ma1)
ma2 = ta.sma(close, i_ma2)

// Check filter(s)
f_dateFilter =true

// Check buy/sell conditions
var float buyPrice = 0
buyCondition    = close > ma1 and close < ma2 and strategy.position_size == 0 and f_dateFilter
sellCondition   = close > ma2 and strategy.position_size > 0 and (not i_lowerClose or close < low[1])
stopDistance    = strategy.position_size > 0 ? ((buyPrice - close) / close) : na
stopPrice       = strategy.position_size > 0 ? buyPrice - (buyPrice * i_stopPercent) : na
stopCondition   = strategy.position_size > 0 and stopDistance > i_stopPercent

// Enter positions
if buyCondition
    strategy.entry(id="Long", direction=strategy.long)

if buyCondition[1]
    buyPrice := open

// Exit positions
if sellCondition or stopCondition
    strategy.close(id="Long", comment="Exit" + (stopCondition ? "SL=true" : ""))
    buyPrice := na

// Draw pretty colors
plot(buyPrice, color=color.lime, style=plot.style_linebr)
plot(stopPrice, color=color.red, style=plot.style_linebr, offset=-1)
plot(ma1, color=color.blue)
plot(ma2, color=color.orange)

더 많은