5일 이동평균 골든크로스 체이싱 전략


생성 날짜: 2023-09-21 12:16:22 마지막으로 수정됨: 2023-09-21 12:16:22
복사: 0 클릭수: 694
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

개요

이 전략은 5일과 78일 이동 평균 선의 포크가 형성된 후속 신호를 기반으로 하고, 짧은 선의 가격 Momentum의 돌파구를 가져오는 기회를 포착하는 것을 목표로 한다.

전략 원칙

  1. 3일, 78일, 195일 중화 이동 평균을 계산해보세요.

  2. 3일선에서 195일선을 통과할 때 구매 신호를 다.

  3. 3일선이 78일선 위에 있고, 78일선이 195일선 위에 있을 때, 상승 트렌드 채널에 있다고 여겨지며, 구매 신호를 발산한다.

  4. 6ATR 동적 정지선을 설정하여 정지선 아래에서 정지 신호를 발산한다.

  5. 3호선이 195호선을 다시 통과할 때 정지 신호를 발산한다.

우위 분석

  1. 다중 평행선 교차 조합, 효과적인 필터링 가짜 돌파구.

  2. 동적 정지 설정은 역전지 피해를 피한다.

  3. 회귀 매 거래의 평균 보유 주기는 2 시간이며, 단선 Momentum 거래에 적합하다.

  4. 최대 인출율은 20% 정도입니다.

위험 분석

  1. 고정 평균선 변수는 시장의 변화에 적응할 수 없습니다.

  2. 샘플 기간은 1년이며, 샘플 검증 전략을 확장해야 합니다.

  3. 스톱톱 손실 파라미터는 최적화되고, 위험을 통제해야 한다.

  4. 가격 상승에 대처할 수 없습니다.

  5. 수료와 슬라이드 비용이 더 많이 들 수 있습니다.

최적화 방향

  1. 다른 평평선 파라미터를 테스트하고, 최적화 조합을 다.

  2. 스톱 스톱 손실 파라미터를 최적화하고 수익 위험을 균형 잡는다.

  3. 입학제어 조건을 설정하여 감금 가능성을 줄일 수 있습니다.

  4. 포지션 관리를 최적화하고, 트렌드에 따라 점진적으로 포지션을 늘립니다.

  5. 다양한 품종과 더 긴 기간 동안 테스트하십시오.

  6. 몬테카를로 시뮬레이션 평가 최대 철회.

요약하다

이 전략은 평행선 다중 금포를 이용하여 주식 가격 상승세를 판단하고, 동적 스톱 로드 규칙을 설정하여, 재측량 성능이 좋다. 그러나 이 전략은 샘플링 기간이 짧고, 변수 안정성이 검증되어야 하며, 공중상황을 처리할 수 없다. 샘플링 구간 재측정을 더 확장하여, 잘못된 신호율을 줄이기 위해 더 많은 필터링 조건을 도입하고, 동시에 스톱 로드 변수를 최적화하고, 수수료와 같은 거래 비용 영향을 평가할 필요가 있다.

전략 소스 코드
/*backtest
start: 2022-09-14 00:00:00
end: 2023-09-20 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
// © FinTasticTrading 2021/2/14
// This is a 5 day moving average crossing long strategy, used in short term momentum trading strategy.
// Momentum trading Strategy: When S&P 500 index is at up trend (or above 60 sma), buy 10+ stocks in top 20% stock RS ranking at equal weight using this MA5X_L strategy. Change stocks when any stock exited by algorithm.  
// Back test start since 2020/7/1, each long entry for condition 1 is $30000, condition 2 is $20000, with max of 2 long positions.
// Setup: 10 minutes chart
// Buy condition 1) 3 wma cross up 180 wma (5day) 2) 3wma > 60wma > 180wma UP Trend Arrangement (UTA)
// Exit condition 1) 3 wma cross under 180 wma 2) position profit > 20% and 3 wma cross under 6 ATRs line (green)
//@version=4

strategy("MA5X_L", overlay=true, pyramiding=2,default_qty_type=strategy.cash, default_qty_value=100000)
s_len = input( 3 )
m_len = input( 78 )  // 2 day moving average
l_len = input( 195)  // equal to 5 Day moving average
xl_len = input(390)  // 10 day moving average
//Draw WMAs
s_ma = wma(close,s_len)
m_ma = wma(close,m_len)
l_ma = wma(close,l_len)
xl_ma = sma(close,xl_len)
plot(s_ma, color=color.yellow, linewidth=2)
plot(m_ma, color=color.fuchsia, linewidth=2)
plot(l_ma, color=color.blue, linewidth=2)
plot(xl_ma, color = color.gray, linewidth=2)

//ATR Stop Profit , length = 40 or 1 day
Periods = input(title="ATR Period", type=input.integer, defval=40)
Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=6.0)
sl=hl2-(Multiplier*atr(Periods))
sl1 = nz(sl[1], sl)
sl := s_ma[1] > sl1 ? max(sl, sl1) : sl
plot(strategy.position_size > 0 ? sl:na, title="Stop Loss", style=plot.style_linebr, linewidth=2, color=color.green)

//Backtest since
condition100 = time>=timestamp(2020, 07, 01, 00, 00) 

//Long Entry Condition 1 : s_ma Cross UP l_ma
if crossover(s_ma, l_ma) and condition100
    strategy.entry("X Up", strategy.long, qty = 30000/close, comment="X Up")

//Long Entry Condition 2 : s_ma > m_ma > l_ma
condition31 = s_ma>m_ma and m_ma>l_ma
condition32 = condition31[1]==false and condition31 == true and condition100
strategy.entry("UTA", strategy.long, qty = 20000/close, when = condition32, comment="UTA")

//Long Exit Condition 1 :  3 wma cross under 180 wma
condition50 = crossunder(s_ma, l_ma)
strategy.close_all(when = condition50, comment="X Dn")

//Long Exit Condition 2 : position profit > 20% and 3 wma cross under 6 ATRs line (green)
strategy.close_all(when = crossunder(close,sl) and strategy.openprofit>30000*0.2, comment="Stop")