EMA의 크로스오버 긴 라인 양자 전략

저자:차오장, 날짜: 2024-02-20 15:22:12
태그:

img

전반적인 설명

이 전략은 장기 보유를 목표로 시장에 진입 및 출입 시기를 결정하기 위해 다른 시간 프레임의 이동 평균 (MA) 및 RSI 지표 사이의 교차 패턴을 활용합니다. 이 전략은 매개 변수 조정을 통해 실시간 최적화를 허용하며 주요 지수에 대한 장기 투자에 적합합니다.

전략 논리

이 전략의 핵심 메커니즘은 EMA 라인의 황금 십자가와 죽음의 십자가를 통해 입구와 출구 지점을 식별하는 것입니다. 또한 RSI 지표를 통합하여 과잉 구매 및 과잉 판매 조건을 결정합니다.

특히, 구매 신호 논리는 다음을 확인합니다. 가격은 EMA20 아래와 EMA50 위를 가로질러 황금 십자가를 형성하여 단일 EMA 시스템과 비교하여 트렌드 반전을 더 정확하게 식별하는 데 도움이됩니다. 닫기 가격이 오픈보다 낮고 전날의 낮은 가격에 대한 추가 기준은 잘못된 브레이크를 추가로 필터합니다.

위의 구매 기준은 다양한 매개 변수로 구성되어 다른 EMA 기간과 양에 대응하는 4 가지 구매 규칙을 형성합니다. 이것은 턴치 구매를 통해 점진적 입장을 구축하여 평균 비용 절감을 달성 할 수 있습니다.

출구에 대한 전략은 과잉 매수 RSI 신호로 EMA10 이상의 죽음의 교차 또는 과잉 매매 RSI 신호로 EMA10 이하의 죽음의 교차를 검사합니다. 특정 수익률 비율에 기반한 수익 취득 규칙도 구현됩니다. RSI를 EMA 크로스오버와 결합하여 잘못된 신호의 위험을 줄입니다.

이점 분석

이 전략의 가장 큰 강점은 EMA 교차로 트렌드 역전 지점을 식별하여 트렌드를 따라갈 수 있다는 효과에 있다. 단일 EMA 시스템과 비교하면 이중 EMA 교차가 잘못된 신호를 제거하는 데 도움이 된다. 또한 RSI의 사용은 과잉 구매 / 과잉 판매 구역에 진입하기 전에 확인을 추가하여 거래 위험을 더욱 낮추는 데 도움이됩니다.

또 다른 장점은 피라미드화 및 평균 비용 하락을 구현하는 것입니다. 이러한 트랜치 구매는 다른 가격 수준에서 양을 분배하여 추세가 재개되면 최대 수익을 보장합니다. 또한 단일 큰 입점 위치에서 위험을 다양화합니다.

위험 분석

이 전략과 관련된 주요 위험은 다음과 같습니다.

  1. EMA 시스템의 지연성 특성으로 인해 갑작스러운 가격 변화에 반응하는 것이 느리고, 적시에 포지션을 종료 할 수 없습니다. 스톱 로스 메커니즘을 추가하면 그러한 위험을 완화 할 수 있습니다.

  2. 구매 입시 시간 프레임에 대한 제한이 없기 때문에 조기 입시로 이어질 수 있으며 시장 통합에 휘말릴 수 있습니다. 이것은 구매 구역을 제한함으로써 해결 될 수 있습니다.

  3. 피라미드 구매 주문은 과대 규모의 포지션을 초래할 수 있으며, 한 방향의 브레이크 위험에 취약성을 만들 수 있습니다. 물 수준 매개 변수를 조정하고 위험 통제를 도입하면 이러한 위험을 줄일 수 있습니다.

더 나은 기회

이 전략은 다음 영역에서 더 이상 최적화 될 수 있습니다.

  1. 하락위에서 주요 지원 수준이 넘어가면 손실을 줄이기 위해 스톱 로스 규칙을 포함하고 하락위 위험을 제어합니다.

  2. 트레이딩 검증 모듈을 추가하여 주요 트렌드 방향을 확인하고 전체 트렌드가 상승할 때만 트레이드를 입력하여 역 트렌드 위험을 피합니다.

  3. 확인 전에 조기 피라미드 입력을 방지하기 위해 더 엄격한 구매 구역 제한을 설정합니다.

  4. 입시 정확성과 승률을 높이기 위해 다인자 분석으로 기계 학습 알고리즘을 사용하십시오.

결론

요약적으로,이 기사는 효율성을 극대화하기 위해 트랜지 포지션 구축에 의해 지원되는 입출 신호를 위해 이중 EMA 크로스오버 및 RSI 지표를 활용한 장기적인 양적 전략을 상세히 설명합니다. 논리와 매개 변수는 시장 전체의 지수 및 주식에 맞게 조정 할 수 있으며, 장기적인 트렌드를 따르는 다재다능한 전략으로 만듭니다. 위험 분석 및 향상 기회는 또한 추가 최적화를 위한 참조를 제공합니다. 전략이 더 정교해짐에 따라 라이브 거래 환경에서 장기적인 보유를위한 견고한 시스템으로 사용될 것이라고 믿습니다.


/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("EMA_zorba1", shorttitle="3 NIFTY RSI EMA", overlay=true)

// Input parameters
qt1 = input.int(1, title="Quantity 1", minval=1)
qt2 = input.int(2, title="Quantity 2", minval=1)
qt3 = input.int(3, title="Quantity 3", minval=1)
qt4 = input.int(4, 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)

// RSI(14) condition
rsi_threshold = 65
rsi_crossed_above_70 = ta.rsi(close, 14) > rsi_threshold
rsi_crossed_above_70_two_days_ago = ta.rsi(close[5], 14) > rsi_threshold or ta.rsi(close[4], 14) > rsi_threshold or ta.rsi(close[3], 14) > rsi_threshold
rsi_crossed_above_70_yesterday = ta.rsi(close[1], 14) > rsi_threshold

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

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

// Pyramiding setting
pyramiding = input.int(1, 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 rsi_crossed_above_70_two_days_ago) 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 rsi_crossed_above_70_yesterday) and profit_condition and close < low[1] and close < low[2]

// 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)


더 많은