SMA 및 RSI 단장 전략

저자:차오장, 날짜: 2023-12-18 10:28:10
태그:

img

전반적인 설명

이 전략은 엔리코 말베르티의 기사를 통해 개발되었다. 이 전략은 주로 간단한 이동 평균 (SMA) 과 상대 강도 지표 (RSI) 를 사용하여 긴 입출 신호를 식별한다. 이 전략은 길지만 짧지 않다.

전략 논리

엔트리 신호는 클로저가격이 더 긴 기간 SMA 라인을 넘을 때 발사됩니다.

출구 신호는 다음과 같습니다.

  1. RSI가 70보다 낮거나 75보다 높을 때 긴 문을 닫습니다.
  2. 마감 가격이 짧은 기간 SMA 라인 아래로 넘어가면 손해를 멈추는 방법
  3. 마감 가격이 짧은 기간 SMA 라인을 넘으면 이윤을 취합니다.

또한 스톱 로스 SMA 라인과 리프트 리프트 SMA 라인도 그래프화되어 있습니다.

이점 분석

이 전략의 장점:

  1. 단순하고 이해하기 쉬운 표시 조합을 사용한다.
  2. 단기판매 위험을 피하기 위해서만
  3. 명확한 엔트리, 스톱 로스 및 수익 취득 규칙, 통제 가능한 리스크가 있습니다.
  4. SMA 기간 등을 조정하여 최적화 할 수 있습니다.

위험 분석

몇 가지 위험 요소가 있습니다.

  1. 패배 후 자신감을 잃는 심리적 편견
  2. SMA 라인 이동은 위험을 초래할 수 있습니다.
  3. RSI 분산 신호는 신뢰할 수 없습니다.

해결책:

  1. 규칙에 따라 고정된 거래 메커니즘을 구축합니다.
  2. SMA 기간을 최적화
  3. RSI 신호를 위한 다른 필터를 추가합니다.

최적화 방향

전략은 더 이상 최적화 될 수 있습니다.

  1. SMA를 위한 다른 매개 변수를 테스트합니다.
  2. 필터로 다른 지표를 추가합니다.
  3. 트렌드 및 통합을 구분하기 위해 트렌드 식별을 추가합니다.
  4. 파라미터 적응과 최적화

결론

전체적인 아이디어는 간단하고 명확합니다. 기본 지표와 제어 가능성으로 중장기 거래에 적합합니다. 그러나 매개 변수 조정 및 지표 필터링은 전략을 더 견고하고 신뢰할 수 있도록 많은 테스트와 최적화를 필요로합니다. 간단한 아이디어는 실제 사용 가능한 거래 시스템을 형성하기 위해 최적화 및 조합에 대한 엄청난 노력이 필요합니다.


/*backtest
start: 2022-12-11 00:00:00
end: 2023-12-17 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version= 4
// form the original idea of Enrico Malverti www.enricomalverti.com , trading system 2015  
// https://sauciusfinance.altervista.org
strategy(title="MAs & RSI strategy long only", overlay = true, max_bars_back=500)

///********FROM EMAS TO SIMPLE MA *****
// NON AGGIUNTO SCHAFF INDICATOR, che serve per discriminare quali titoli scegliere dallo screener (segnale già aperto o il primo o, a parità,
//quello più alto) ==> Tolte le bande di Bollinger (che filtrano "poco")

// INPUTS 
emapf = input(14, title ="Ma periodo veloce",  minval=1, step = 1)
emapl = input(14, title ="Ma periodo lungo",  minval=1, step = 1)
emaps = input(7, title ="Ma periodi stop",  minval=1, step = 1)
rsi_period = input(14, title="RSI period", minval = 1, step = 1) 
// CALCULATIONS
maf = sma(close, emapf)
mal = sma(close, emapl)
// rsi
myrsi = rsi(close, rsi_period)
//ema stop long ed ema stop short
//Ema7 messo da "massimo" a "chiusura" come target per posizioni short. Il limite è, in questo caso, sempre ema20 (più restringente - asimmetria)
// in questo t.s., lo short viene soltanto indicato come "rappresentazione grafica", non agito
mass = sma(close, emaps)
masl = sma(low, emaps)
ma200=sma(close,200)
/// Entry
strategy.entry("Long", true, when = crossover(close,mal))

rsi1 = crossunder(myrsi,70)
rsi2 = myrsi > 75
// previously, 80
st_loss_long = crossunder(close,masl)// **chiusura sotto EMA7**
target_long= crossunder(close,maf) //* Chiusura sotto EMA14*
// exits. *RSI**Long: Target if over bandamax, loss if under bandamin. Viceversa, for short
strategy.close("Long", when = rsi1, comment="crossunder RSI")
strategy.close("Long", when = rsi2, comment ="RSI MAX")
strategy.close("Long", when = st_loss_long, comment = "Stop loss")
strategy.close("Long", when = target_long, comment = "target_long" )

plot(masl, title="ma stop long", color=#363A45, linewidth= 1, style=plot.style_cross)
plot(maf, title="MA FAST", color=#FF0000,  linewidth= 1)
plot(mal, title="MA SLOW", color=#0000FF,  linewidth= 2)
plot(mass, title="ma stop short", color=#787B86,linewidth= 1, style=plot.style_cross)
plot(ma200, title="ma200", color=color.black,  linewidth= 1)

더 많은