리버랄 지표 전략

저자:차오장, 날짜: 2023-12-13 14:45:51
태그:

img

전반적인 설명

이 전략은 여러 가지 기술 지표에 기반한 리바살 거래 전략이다. CCI, 모멘텀 지표, RSI 및 기타 지표를 결합하여 잠재적 인 장기 및 단기 거래 기회를 식별합니다. 이 전략은 지표가 과소매 / 과소매 신호를 표시하고 가격이 후퇴 할 때 거래 신호를 생성합니다.

전략 논리

이 전략의 거래 신호는 Edri Extreme Points Buy & Sell라는 사용자 지정 지표에서 나옵니다. CCI, 모멘텀 지표 및 RSI 크로스오버를 고려합니다. 구체적인 논리는 다음과 같습니다:

긴 신호 조건:

  1. Edri Extreme Points Buy & Sell 지표는 CCI가 0을 넘거나 모멘텀이 0을 넘어서면 매수 신호를 발사하고, RSI는 과판 수준 이하입니다.
  2. 가격은 100주기 EMA에 도달하거나 그 아래로 떨어집니다.

짧은 신호 조건:

  1. Edri Extreme Points Buy & Sell 지표는 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)

더 많은