다중 지표 복합 거래 전략

저자:차오장, 날짜: 2023-09-13 12:18:05
태그:

이 전략은 이동 평균, RSI 및 스토카스틱과 같은 여러 기술적 지표를 결합하여 가격 추세와 거래 신호에 대한 과잉 구매 / 과잉 판매 수준을 평가합니다. 더 신뢰할 수있는 결정을 위해 여러 지표의 강점을 활용합니다.

전략 논리:

  1. 전체 가격 추세를 결정하기 위해 여러 EMA를 사용하십시오.

  2. RSI와 스토카스틱을 과잉 구매/ 과잉 판매 수준으로 계산합니다.

  3. EMA가 황소 신호를 주면, RSI가 과잉 매입되지 않고, 스톡이 과잉 매입되지 않을 때 장면을 입력합니다.

  4. EMA가 베어 신호를 주면 마감, RSI가 과잉 판매되지 않고 주식도 과잉 판매되지 않습니다.

  5. 어떤 신호가 반대 신호를 내면 출구

장점:

  1. 여러 지표 검증은 정확성을 향상시킵니다.

  2. 시장 평가에 더 나은 지표를 위해 지표가 서로를 보완합니다.

  3. 명확한 거래 규칙은 백테스트와 실행을 용이하게 합니다.

위험성:

  1. 지표에 대한 과도한 과잉을 피하십시오.

  2. 복잡한 다중 지표 최적화

  3. 더 많은 지표가 반드시 성과를 향상시키는 것은 아닙니다.

요약하자면, 다중 지표 접근 방식은 어느 정도 의사결정을 개선할 수 있지만 단순하고 신뢰할 수있는 전략에 대한 최적화 어려움과 과잉성을 균형 잡는 것이 필요합니다.


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

//@version=5
// strategy(title='Combined Strategy', default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=.0020, pyramiding=0, slippage=3, overlay=true)

//----------//
// MOMENTUM //
//----------//
ema8 = ta.ema(close, 5)
ema13 = ta.ema(close, 9)
ema21 = ta.ema(close, 13)
ema34 = ta.ema(close, 21)
ema55 = ta.ema(close, 34)

plot(ema8, color=color.new(color.red, 0), style=plot.style_line, title='5', linewidth=1)
plot(ema13, color=color.new(color.orange, 0), style=plot.style_line, title='9', linewidth=1)
plot(ema21, color=color.new(color.yellow, 0), style=plot.style_line, title='13', linewidth=1)
plot(ema34, color=color.new(color.aqua, 0), style=plot.style_line, title='21', linewidth=1)
plot(ema55, color=color.new(color.lime, 0), style=plot.style_line, title='34', linewidth=1)

longEmaCondition = ema8 > ema13 and ema13 > ema21 and ema21 > ema34 and ema34 > ema55
exitLongEmaCondition = ema13 < ema55

shortEmaCondition = ema8 < ema13 and ema13 < ema21 and ema21 < ema34 and ema34 < ema55
exitShortEmaCondition = ema13 > ema55

// ----------  //
// OSCILLATORS //
// ----------- //
rsi = ta.rsi(close, 14)
longRsiCondition = rsi < 70 and rsi > 40
exitLongRsiCondition = rsi > 70

shortRsiCondition = rsi > 30 and rsi < 60
exitShortRsiCondition = rsi < 30

Stochastic
length = 14, smoothK = 3, smoothD = 3
kFast = ta.stoch(close, high, low, 14)
dSlow = ta.sma(kFast, smoothD)

longStochasticCondition = kFast < 80
exitLongStochasticCondition = kFast > 95

shortStochasticCondition = kFast > 20
exitShortStochasticCondition = kFast < 5

//----------//
// STRATEGY //
//----------//

longCondition = longEmaCondition and longRsiCondition and longStochasticCondition and strategy.position_size == 0
exitLongCondition = (exitLongEmaCondition or exitLongRsiCondition or exitLongStochasticCondition) and strategy.position_size > 0

if (longCondition)
  strategy.entry("LONG", strategy.long)
if (exitLongCondition)
  strategy.close("LONG")

shortCondition = shortEmaCondition and shortRsiCondition and shortStochasticCondition and strategy.position_size == 0
exitShortCondition = (exitShortEmaCondition or exitShortRsiCondition or exitShortStochasticCondition) and strategy.position_size < 0

if (shortCondition)
  strategy.entry("SHORT", strategy.short)
if (exitShortCondition)
  strategy.close("SHORT")



더 많은