이동 평균에 기초한 평균 역전 역전 전략

저자:차오장, 날짜: 2023-12-21 15:45:23
태그:

img

이 전략은 이동 평균에 기반한 Mean Reversion Reverse Strategy라고 불립니다. 주요 아이디어는 가격이 주요 이동 평균을 넘어서면 구매하고 미리 설정된 목표에 도달하면 이익을 얻는 것입니다.

이 전략의 주요 원칙은 단기 이동 평균의 반전을 사용하여 범위 제한 시장에서 리바운드 기회를 포착하는 것입니다. 구체적으로, 가격이 더 긴 사이클 이동 평균 (예를 들어 20 일 및 50 일 MA) 을 뚫고 강한 과판의 징후를 나타내면 시장 변동의 평균 리바운드 특성으로 인해 가격이 어느 정도 회복하는 경향이 있습니다. 이 시점에서, 짧은 사이클 이동 평균 (예를 들어 10 일 MA) 이 상향 반전 신호를 보여주면 구매하는 데 좋은 시기가 될 것입니다. 이 전략에서, 그것은 짧은 사이클 이동 평균 (예를 들어 10 일 MA) 이 단기 MA 반전을 통해 리바운드를 포착하기 위해 가격 종료가 20 일 MA 이하이고 50 일 MA 이상인 경우 구입합니다.

구체적인 입시 논리는: 가격이 20일 MA를 넘을 때 1 롯을 구매하고, 50일 MA를 넘을 때 1 롯을 추가하고, 100일 MA를 넘을 때 1 롯을 추가하고, 최대 4 롯으로 200일 MA를 넘을 때 1 롯을 추가합니다. 미리 설정된 목표에 도달한 후 이익을 취합니다. 또한 시간과 스톱 손실 조건을 설정합니다.

이점 분석

  1. 이동평균의 반전 특성을 이용하여 단기적 리바운드 기회를 효과적으로 식별
  2. 피라미드 주문을 통해 단일 포인트의 위험을 줄이세요
  3. 수익을 확보하기 위해 수익을 취하는 목표를 설정합니다
  4. 오픈 가격과 이전 낮은 가격 필터를 사용하여 가짜 브레이크를 피하십시오.

위험 분석

  1. 장기 보유 기간에 반전 위험에 직면 할 수 있습니다. 시장이 계속 떨어지면 손실이 증가 할 것입니다.
  2. MA 신호는 잘못된 신호를 주고 손실을 초래할 수 있습니다.
  3. 이윤 목표가 달성되지 않으면 전체 또는 부분적으로 이익을 얻지 못할 수 있습니다.

최적화 방향

  1. 다른 매개 변수 설정에서 수익성과 안정성을 테스트합니다.
  2. MACD, KD와 같은 다른 지표를 결합하여 엔트리를 결정하는 것을 고려하십시오.
  3. 각종 제품의 특성에 따라 적절한 MA 기간을 선택
  4. 매개 변수를 동적으로 최적화하기 위해 기계 학습 알고리즘을 도입

요약

일반적으로 이것은 고전적이고 보편적인 MA 거래 전략입니다. 단기 구매 기회를 식별하기 위해 여러 MA와 결합하여 MAs의 매끄러운 기능을 올바르게 활용합니다. 피라미드 주문과 적시에 수익을 취함으로써 위험을 제어합니다. 그러나 중요한 정책 뉴스와 같은 시장 이벤트에 대한 반응은 더 수동적일 수 있습니다. 이것은 추가로 최적화 될 수 있습니다. 전반적으로 매개 변수 최적화 및 위험 통제의 적절한 개선으로이 전략은 안정적인 초과 수익을 얻을 수 있습니다.


/*backtest
start: 2023-12-13 00:00:00
end: 2023-12-20 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("EMA_zorba1", shorttitle="zorba_ema", overlay=true)

// Input parameters
qt1 = input.int(5, title="Quantity 1", minval=1)
qt2 = input.int(10, title="Quantity 2", minval=1)
qt3 = input.int(15, title="Quantity 3", minval=1)
qt4 = input.int(20, title="Quantity 4", minval=1)
ema10 = ta.ema(close, 10)
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema100 = ta.ema(close, 100)
ema200 = ta.ema(close, 200)

// Date range filter
start_date = timestamp(year=2021, month=1, day=1)
end_date = timestamp(year=2024, month=10, day=27)
in_date_range = true

// Profit condition
profit_percentage = input(1, title="Profit Percentage")  // Adjust this value as needed

// Pyramiding setting
pyramiding = input.int(2, title="Pyramiding", minval=1, maxval=10)

// Buy conditions
buy_condition_1 = in_date_range and close < ema20 and close > ema50 and close < open and close < low[1]
buy_condition_2 = in_date_range and close < ema50 and close > ema100 and close < open and close < low[1]
buy_condition_3 = in_date_range and close < ema100 and close > ema200 and close < open and close < low[1]
buy_condition_4 = in_date_range and close < ema200 and close < open and close < low[1]

// Exit conditions
profit_condition = strategy.position_avg_price * (1 + profit_percentage / 100) <= close
exit_condition_1 = in_date_range and (close > ema10 and ema10 > ema20 and ema10 > ema50 and ema10 > ema100 and ema10 > ema200 and close < open) and profit_condition and close < low[1] and close < low[2]
exit_condition_2 = in_date_range and (close < ema10 and close[1] > ema10 and close < close[1] and ema10 > ema20 and ema10 > ema50 and ema10 > ema100 and ema10 > ema200 and close < open) and profit_condition and close < low[1] and close < low[2]

// Exit condition for when today's close is less than the previous day's low
//exit_condition_3 = close < low[1]

// Strategy logic
strategy.entry("Buy1", strategy.long, qty=qt1 * pyramiding, when=buy_condition_1)
strategy.entry("Buy2", strategy.long, qty=qt2 * pyramiding, when=buy_condition_2)
strategy.entry("Buy3", strategy.long, qty=qt3 * pyramiding, when=buy_condition_3)
strategy.entry("Buy4", strategy.long, qty=qt4 * pyramiding, when=buy_condition_4)

strategy.close("Buy1", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy2", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy3", when=exit_condition_1 or exit_condition_2)
strategy.close("Buy4", when=exit_condition_1 or exit_condition_2)

더 많은