오실레이터 트레이딩 전략


생성 날짜: 2023-12-13 14:45:51 마지막으로 수정됨: 2023-12-13 14:45:51
복사: 0 클릭수: 795
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

오실레이터 트레이딩 전략

개요

이것은 여러 가지 기술 지표에 기반한 역전 거래 전략이다. CCI, 동력 지표, RSI 등의 지표와 결합하여 잠재적인 상위 및 상위 거래 기회를 식별한다. 지표가 오버 바이 오버 셀 신호를 표시하고 가격이 회수되면 거래 신호를 발산한다.

전략 원칙

이 전략의 거래 신호는 사용자 정의 된 지표 Edri 극적 매매 에서 비롯되며 CCI, 동력 지표 및 RSI의 교차 상황을 종합적으로 고려합니다. 구체적인 논리는 다음과 같습니다.

다중 신호 조건:

  1. Edri 극적 매매 시점 지표는 CCI 상의 0 축 또는 동력 지표 상의 0 축을 통과하고 RSI가 초매매 라인보다 낮은 구매 신호를 발산한다.
  2. 가격이 100주기 EMA 아래로 밀리거나

공허 신호 조건:

  1. Edri 극적 매매 시점 지표는 판매 신호를 발산합니다. 즉, CCI가 0 축을 통과하거나 동력 지표가 0 축을 통과하고 RSI가 초과 구매 라인보다 높습니다.
  2. 100주기 EMA보다 낮아지거나 높은 가격

이 전략은 또한 RSI와 가격의 명백한 이탈이 발생하기 전에 거래 신호를 생성하기 위해 일반적인 이탈을 찾는 조건을 설정할 수 있습니다.

거래 신호가 충족되면, 전략의 중지 손실 지점은 입시 가격 ± 2ATR, 중지 손실 지점은 입시 가격 ± 4ATR이다. 이것은 시장의 변동 정도에 따라 합리적인 중지 손실 경계를 설정할 수 있다.

우위 분석

  1. 여러 지표들을 통합하여 판단하는 것은 단일 지표의 잘못된 신호를 피하는 데 도움이 됩니다.
  2. 반전 거래 방식은 불안정한 상황에서 단기 거래 기회를 잡는 데 도움이 됩니다.
  3. ATR 상쇄 방식, 시장의 변동성에 따라 지위를 조정할 수 있다.
  4. 다른 조건에서 벗어날 수 있고, 극단적이지 않은 과매매 과매매 상황에서 포지션을 열지 않도록 한다.

위험 분석

  1. 지표 파라미터를 잘못 설정하면 놓친 거래 기회 또는 너무 많은 잘못된 신호가 발생할 수 있습니다.
  2. 반전 거래 방식은 트렌드 상황에서 연속적으로 상쇄될 수 있다.
  3. ATR은 지연성이 있으며, 급변하는 시장에서 제 시간에 스톱로스 스톱포인트를 갱신할 수 없다.

해결책:

  1. 지표 파라미터를 여러 번 재검토하고 최적화하여 최적의 파라미터 조합을 찾습니다.
  2. 트렌드가 강할 때 이 전략을 일시 중단하는 것을 고려할 수 있다.
  3. 다른 손해 차단 방법과 결합하여, 이동 손해 차단 또는 반항 손해 차단.

최적화 방향

  1. CCI와 동력 지표 주기, RSI 파라미터, ATR 배수 등과 같은 다양한 파라미터 조합을 테스트하십시오.
  2. 가격 패턴, 거래량 변화 등과 같은 다른 보조 필터 조건을 추가하십시오.
  3. ATR 값에 따라 포지션 비율을 설정하는 등 포지션 관리 방법을 조정하십시오.
  4. 다양한 품종, 주기의 파라미터 템플릿을 설정한다.
  5. 트렌드 추적 장치와 결합하여 트렌드 상황에서 역거래를 중지하는 것을 고려하십시오.

요약하다

이 전략은 주로 충격적인 상황에서 적용되며, 중간에 짧은 선 반전을 포착하여 안정적인 수익을 얻습니다. 그것은 가격의 단기 스트레칭 현상을 식별하는 데 도움이되며, 여러 지표 판단에 따라 거래 신호를 생성합니다. 합리적인 매개 변수 최적화 및 위험 관리를 통해 이 전략의 장점을 효과적으로 활용할 수 있습니다.

전략 소스 코드
/*backtest
start: 2023-11-12 00:00:00
end: 2023-12-02 00:00:00
period: 1h
basePeriod: 15m
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/
// © MagicStrategies

//@version=5
strategy("Reversal Indicator Strategy", overlay = true)

// Input settings
ccimomCross = input.string('CCI', 'Entry Signal Source', options=['CCI', 'Momentum'], tooltip='CCI or Momentum will be the final source of the Entry signal if selected.')
ccimomLength = input.int(10, minval=1, title='CCI/Momentum Length')
useDivergence = input.bool(true, title='Find Regular Bullish/Bearish Divergence', tooltip='If checked, it will only consider an overbought or oversold condition that has a regular bullish or bearish divergence formed inside that level.')
rsiOverbought = input.int(65, minval=1, title='RSI Overbought Level', tooltip='Adjusting the level to extremely high may filter out some signals especially when the option to find divergence is checked.')
rsiOversold = input.int(35, minval=1, title='RSI Oversold Level', tooltip='Adjusting this level extremely low may filter out some signals especially when the option to find divergence is checked.')
rsiLength = input.int(14, minval=1, title='RSI Length')
plotMeanReversion = input.bool(false, 'Plot Mean Reversion Bands on the chart', tooltip='This function doesn\'t affect the entry of signal but it suggests buying when the price is at the lower band, and then sell it on the next bounce at the higher bands.')
emaPeriod = input(200, title='Lookback Period (EMA)')
bandMultiplier = input.float(1.8, title='Outer Bands Multiplier', tooltip='Multiplier for both upper and lower bands')


// CCI and Momentum calculation
momLength = ccimomCross == 'Momentum' ? ccimomLength : 10
mom = close - close[momLength]
cci = ta.cci(close, ccimomLength)
ccimomCrossUp = ccimomCross == 'Momentum' ? ta.cross(mom, 0) : ta.cross(cci, 0)
ccimomCrossDown = ccimomCross == 'Momentum' ? ta.cross(0, mom) : ta.cross(0, cci)

// RSI calculation
src = close
up = ta.rma(math.max(ta.change(src), 0), rsiLength)
down = ta.rma(-math.min(ta.change(src), 0), rsiLength)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
oversoldAgo = rsi[0] <= rsiOversold or rsi[1] <= rsiOversold or rsi[2] <= rsiOversold or rsi[3] <= rsiOversold
overboughtAgo = rsi[0] >= rsiOverbought or rsi[1] >= rsiOverbought or rsi[2] >= rsiOverbought or rsi[3] >= rsiOverbought

// Regular Divergence Conditions
bullishDivergenceCondition = rsi[0] > rsi[1] and rsi[1] < rsi[2]
bearishDivergenceCondition = rsi[0] < rsi[1] and rsi[1] > rsi[2]

// Entry Conditions
longEntryCondition = ccimomCrossUp and oversoldAgo and (not useDivergence or bullishDivergenceCondition)
shortEntryCondition = ccimomCrossDown and overboughtAgo and (not useDivergence or bearishDivergenceCondition)


// Mean Reversion Indicator
meanReversion = plotMeanReversion ? ta.ema(close, emaPeriod) : na
stdDev = plotMeanReversion ? ta.stdev(close, emaPeriod) : na
upperBand = plotMeanReversion ? meanReversion + stdDev * bandMultiplier : na
lowerBand = plotMeanReversion ? meanReversion - stdDev * bandMultiplier : na


// Plotting
plotshape(longEntryCondition, title='BUY', style=shape.triangleup, text='B', location=location.belowbar, color=color.new(color.lime, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(shortEntryCondition, title='SELL', style=shape.triangledown, text='S', location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)

plot(upperBand, title='Upper Band', color=color.new(color.fuchsia, 0), linewidth=1)
plot(meanReversion, title='Mean', color=color.new(color.gray, 0), linewidth=1)
plot(lowerBand, title='Lower Band', color=color.new(color.blue, 0), linewidth=1)

// Entry signal alerts
alertcondition(longEntryCondition, title='BUY Signal', message='Buy Entry Signal')
alertcondition(shortEntryCondition, title='SELL Signal', message='Sell Entry Signal')
alertcondition(longEntryCondition or shortEntryCondition, title='BUY or SELL Signal', message='Entry Signal')

ema100 = ta.ema(close, 100)
plot(ema100, color=color.red)

// Define trading signals based on the original indicator's entry conditions
// Buy if long condition is met and price has pulled back to or below the 100 EMA
longCondition  = longEntryCondition and close <= ema100
// Sell if short condition is met and price has pulled back to or above the 100 EMA
shortCondition = shortEntryCondition and close >= ema100

// Strategy Entries
if longCondition
    strategy.entry("Buy", strategy.long)
if shortCondition
    strategy.entry("Sell", strategy.short)