이동평균에 기초한 전략을 따르는 경향

저자:차오장, 날짜: 2024-01-18 12:23:59
태그:

img

전반적인 설명

이 전략은 이동 평균에 기반한 트렌드 다음 전략이다. 트렌드 추적을 위해 여러 세트의 거래 신호를 구성하기 위해 다양한 기간의 EMA 라인을 활용합니다. 가격이 더 긴 기간 이동 평균 아래로 넘어갈 때 전략은 평균 비용을 낮추기 위해 점진적으로 긴 포지션을 구축합니다. 전략은 또한 수익을 확보하기 위해 짧은 기간 이동 평균 회전을 기반으로 스톱 로스 조건을 설정합니다.

전략 논리

이 전략은 10일, 20일, 50일, 100일 및 200일 EMA인 거래 신호를 구성하기 위해 다양한 기간의 5개의 EMA 라인을 사용합니다. 이 전략은 피라미드 거래를 구현하기 위해 이러한 EMA 라인과의 가격 관계에 기반한 4개의 구매 조건을 정의합니다.

가격이 20일 EMA 아래에서 50일 EMA 위에 있을 때 첫 번째 구매 신호가 트리거된다. 50일 EMA 아래에서 100일 EMA 위에 있을 때 두 번째 구매 신호가 트리거된다. 3번째와 4번째 구매 신호는 각각 100일 EMA와 200일 EMA 아래로 떨어질 때 트리거된다. 포지션 크기도 qt1에서 qt4로 점차 확대된다.

판매 측면에서는 두 가지 유형의 스톱 로스 조건이 있습니다. 첫 번째는 가격이 10 일간의 EMA를 초과하고 10 일간의 EMA가 다른 EMA 라인 위에있을 때 손실을 멈추는 것입니다. 두 번째는 비슷하지만 가격이 10 일간의 EMA의 이전 폐쇄 이하로 떨어지면 종료됩니다. 이 두 가지 조건은 트렌드 중에 단기 이익을 확보하는 것입니다.

이점 분석

이 전략의 가장 큰 장점은 장기적인 보유에 대한 시장 트렌드를 자동으로 추적 할 수 있다는 것입니다. 여러 입시 조건과 점진적 위치 구축을 활용함으로써 과도한 수익을 창출하기 위해 지속적으로 비용 기반을 줄여줍니다. 또한 단일 입시 가격 수준과 관련된 가격 위험을 다양화합니다.

스톱 로스 측면에서는 전략은 짧은 기간 이동 평균 전환점을 추적하여 빠르게 이익을 취하고 추가 손실을 피합니다. 이것은 하락 위험을 최소화합니다.

위험 분석

이 전략에 직면한 가장 큰 위험은 장기적인 통합 또는 하락 추세에 갇혀있는 것입니다. 전체 시장이 범위 또는 하락 채널에 들어갈 때, 이동 평균 신호는 덜 신뢰할 수 있습니다. 이것은 지속적인 긴 빌드에서 지속적인 손실로 이어질 수 있습니다.

또 다른 위험 요소는 이동 평균이 항상 회전을 정확하게 파악하지 못한다는 것입니다. 가격 격차 또는 폭발적인 움직임은 잘못된 신호로 이어질 수 있습니다. 이것은 검증 및 최적화를 위해 추가 기술 지표를 요구합니다.

최적화 방향

부피나 볼링거 밴드 같은 다른 기술 지표는 입시 정확도를 더욱 향상시키기 위해 구매 조건에 포함될 수 있습니다.

또한 볼린거 상단 또는 주요 지원 영역에 기반한 두 번째 스톱 손실 층을 추가 할 수 있습니다. 이것은 불필요한 작은 스톱을 피하는 데 도움이됩니다. 트레일 가격에 적응 스톱 손실을 구현하는 것은 이익을 더 잘 보호하기 위한 또 다른 강화 영역입니다.

결론

이 전략은 이동 평균 시스템을 통해 트렌드를 따라 거래를 구현합니다. 피라미드 포지션 구축을 통해 이중 스톱 로스 메커니즘으로 자본 보존을 보장하면서 지속적인 트렌드로부터 수익을 극대화하는 것을 목표로합니다. 이것은 추가 추적 및 라이브 테스트에 가치가있는 전략입니다. 매개 변수 및 모델은 실제 성과에 따라 점진적으로 최적화 될 수 있습니다.


/*backtest
start: 2023-01-11 00:00:00
end: 2024-01-17 00:00:00
period: 1d
basePeriod: 1h
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)

더 많은