RSI 평균 회전 수량 거래 전략

저자:차오장, 날짜: 2023-12-01 16:59:26
태그:

img

전반적인 설명

이 전략은 단기 거래 전략에 속하는 RSI 지표와 이동 평균의 교차를 기반으로 구매 및 판매 신호를 결정합니다. RSI가 MA보다 낮을 때 구매하고 RSI가 MA보다 높을 때 판매합니다. 이것은 전형적인 낮은 구매-높은 판매 전략입니다.

전략 원칙

  1. RSI 표시기를 계산합니다.
  2. RSI 지표의 MA를 계산합니다. 기간은 10 바입니다.
  3. RSI가 MA 곱하기 계수 (1-거래 범위%) 보다 낮을 때 구매 신호를 생성합니다.
  4. RSI가 MA 곱하기 계수 (1+거래 범위%) 보다 높을 때 판매 신호를 생성합니다.
  5. 기본 거래 범위 거리는 5, 즉 신호를 유발하는 MA보다 5% 이상 또는 이하입니다.
  6. RSI가 MA와 50 수준을 초과했을 때 출구를 결정합니다.

이점 분석

이것은 전형적인 평균 역전 전략이며, 거래 신호를 결정하기 위해 RSI 지표의 과잉 구매/ 과잉 판매 특성을 활용합니다. 이점은 다음과 같습니다.

  1. 시장 구조를 판단하기 위해 RSI 지표를 채택하는 것은 상당히 신뢰할 수 있습니다.
  2. MA 필터는 불필요한 거래를 피하고 안정성을 향상시킵니다.
  3. 조정 가능한 거래 범위 제어 주파수
  4. 단순하고 이해하기 쉬운 논리

요약하자면, 그것은 간단하고 실용적인 단기 거래 전략입니다.

위험 분석

주의해야 할 몇 가지 위험 요소가 있습니다.

  1. RSI가 잘못된 신호를 주는 가능성, 패턴을 관찰해야 합니다.
  2. 부정확한 거래 범위 설정으로 인해 거래가 과잉되거나 기회를 놓칠 수 있습니다.
  3. 높은 거래 빈도, 거래 비용을 고려해야 합니다
  4. 단 하나의 지표에만 의존하고, 시장 이상에 취약합니다.

이러한 위험은 매개 변수 조정, 필터 추가 등으로 완화 될 수 있습니다.

최적화 방향

이 전략은 다음과 같은 측면에서 최적화 될 수 있습니다.

  1. 볼륨과 같은 더 많은 필터를 추가하여 전환점에서만 신호를 보장합니다.
  2. 단일 거래 손실을 제어하기 위해 스톱 손실을 추가하십시오.
  3. 거래 빈도와 수익률을 균형을 맞추기 위해 거래 범위를 최적화
  4. 최적의 매개 변수 집합을 찾기 위해 기계 학습을 활용
  5. 하위 전략의 결과를 통합하기 위해 앙상블 모델을 추가합니다.

다중 지표 조합, 스톱 손실 관리, 매개 변수 최적화 등을 통해 상당한 성능 상승을 달성 할 수 있습니다.

요약

요약하자면, 이것은 매우 전형적이고 실용적인 단기 거래 전략이다. 추가 MA 필터와 함께 입점과 출구를 결정하기 위해 RSI의 과잉 구매/ 과잉 판매 수준을 활용합니다. 논리는 간단하고 명확하고 매개 변수도 유연하며 구현하기가 쉽습니다. 특정 시장 위험이 있지만, 입점/출구 메커니즘을 정제하고 매개 변수 조정 등을 통해 해결할 수 있습니다. 더 많은 기술적 지표와 위험 관리 기술과 결합하면이 전략은 비교적 안정적인 단기 전략이 될 수 있습니다.


/*backtest
start: 2022-11-24 00:00:00
end: 2023-11-30 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/
// © I11L

//@version=5
strategy("I11L - Meanreverter 4h", overlay=false, pyramiding=3, default_qty_value=10000, initial_capital=10000, default_qty_type=strategy.cash,process_orders_on_close=false, calc_on_every_tick=false)
 
frequency = input.int(10)
rsiFrequency = input.int(40)
buyZoneDistance = input.int(5)
avgDownATRSum = input.int(3)
useAbsoluteRSIBarrier = input.bool(true)
barrierLevel = 50//input.int(50)

momentumRSI = ta.rsi(close,rsiFrequency)
momentumRSI_slow = ta.sma(momentumRSI,frequency)
 
isBuy = momentumRSI < momentumRSI_slow*(1-buyZoneDistance/100) and (strategy.position_avg_price - math.sum(ta.atr(20),avgDownATRSum)*strategy.opentrades > close or strategy.opentrades == 0 ) //and (momentumRSI < barrierLevel or not(useAbsoluteRSIBarrier))
isShort = momentumRSI > momentumRSI_slow*(1+buyZoneDistance/100) and (strategy.position_avg_price - math.sum(ta.atr(20),avgDownATRSum)*strategy.opentrades > close or strategy.opentrades == 0 ) and (momentumRSI > barrierLevel or not(useAbsoluteRSIBarrier))
momentumRSISoftClose = (momentumRSI > momentumRSI_slow) and (momentumRSI > barrierLevel or not(useAbsoluteRSIBarrier))

isClose = momentumRSISoftClose

plot(momentumRSI,color=isClose ? color.red :  momentumRSI < momentumRSI_slow*(1-buyZoneDistance/100) ? color.green : color.white)
plot(momentumRSI_slow,color=color.gray)
plot(barrierLevel,color=useAbsoluteRSIBarrier ? color.white : color.rgb(0,0,0,0))
plot(momentumRSI_slow*(1-buyZoneDistance/100),color=color.gray)
plot(momentumRSI_slow*(1+buyZoneDistance/100),color=color.gray)
plot(momentumRSI_slow*(1+(buyZoneDistance*2)/100),color=color.gray)

// plot(strategy.wintrades - strategy.losstrades)

 
 
if(isBuy)
    strategy.entry("Buy",strategy.long, comment="#"+str.tostring(strategy.opentrades+1))

// if(isShort)
//     strategy.entry("Sell",strategy.short, comment="#"+str.tostring(strategy.opentrades+1))

if(isClose)
    strategy.exit("Close",limit=close)





더 많은