Strategi Penunjuk Reverasal

Penulis:ChaoZhang, Tarikh: 2023-12-13 14:45:51
Tag:

img

Ringkasan

Ini adalah strategi perdagangan revasal berdasarkan beberapa penunjuk teknikal. Ia menggabungkan CCI, penunjuk Momentum, RSI dan penunjuk lain untuk mengenal pasti peluang perdagangan panjang dan pendek yang berpotensi. Strategi ini menghasilkan isyarat perdagangan apabila penunjuk menunjukkan isyarat overbought / oversold dan harga menarik balik.

Logika Strategi

Isyarat perdagangan strategi ini berasal dari penunjuk tersuai yang dipanggil Edri Extreme Points Buy & Sell. Ia mengambil kira CCI, penunjuk Momentum dan persilangan RSI. Logik khusus adalah:

Keadaan isyarat panjang:

  1. Indikator Edri Extreme Points Buy & Sell mencetuskan isyarat beli, iaitu CCI melintasi di atas 0 atau Momentum melintasi di atas 0, dan RSI di bawah tahap oversold.
  2. Harga menarik kembali ke atau di bawah EMA 100 tempoh.

Keadaan isyarat pendek:

  1. Indikator Edri Extreme Points Buy & Sell mencetuskan isyarat jual, iaitu CCI melintasi di bawah 0 atau Momentum melintasi di bawah 0, dan RSI berada di atas tahap overbought.
  2. Harga menarik kembali ke atau di atas EMA 100 tempoh.

Strategi ini juga boleh dikonfigurasikan untuk mencari perbezaan bullish / bearish yang tetap, menghasilkan isyarat perdagangan hanya apabila RSI menyimpang secara ketara dari harga.

Apabila isyarat perdagangan dicetuskan, strategi menetapkan stop loss pada harga kemasukan ± 2ATR, mengambil keuntungan pada harga kemasukan ± 4ATR. Ini membolehkan julat stop loss dan mengambil keuntungan yang munasabah berdasarkan turun naik pasaran.

Analisis Kelebihan

  1. Menggabungkan beberapa penunjuk mengelakkan isyarat palsu dari satu penunjuk.
  2. Gaya perdagangan pembalikan menangkap peluang jangka menengah di pasaran yang terhad.
  3. Stop loss dan mengambil keuntungan berasaskan ATR boleh menyesuaikan kedudukan berdasarkan turun naik pasaran.
  4. Penemuan perbezaan mengelakkan pembukaan kedudukan tanpa tahap overbought / oversold yang melampau.

Analisis Risiko

  1. Parameter penunjuk yang tidak betul boleh menyebabkan peluang yang hilang atau terlalu banyak isyarat yang salah.
  2. Perdagangan pembalikan boleh menyebabkan kerugian berhenti berturut-turut di pasaran trend.
  3. ATR mempunyai kesan kelewatan dan tidak dapat mengemas kini stop loss / mengambil keuntungan tepat pada masanya di pasaran yang bergerak cepat.

Penyelesaian:

  1. Uji balik dan optimum parameter penunjuk untuk mencari kombinasi terbaik.
  2. Pertimbangkan untuk menangguhkan strategi apabila trend kuat.
  3. Gabungkan dengan kaedah stop loss lain seperti stop loss bergerak atau stop loss bertentangan.

Arahan pengoptimuman

  1. Uji kombinasi parameter CCI, panjang momentum, parameter RSI, pengganda ATR dan lain-lain.
  2. Tambah keadaan penapisan lain seperti corak harga, perubahan jumlah dan lain-lain.
  3. Sesuaikan peraturan saiz kedudukan seperti nisbah kedudukan berasaskan ATR.
  4. Tetapkan templat parameter untuk produk dan jangka masa yang berbeza.
  5. Pertimbangkan untuk menambah pengesanan trend untuk menangguhkan perdagangan pembalikan di pasaran trend.

Ringkasan

Strategi ini berfungsi terutamanya untuk pasaran yang terikat julat, menangkap pembalikan jangka menengah untuk keuntungan yang agak mantap. Ia membantu mengenal pasti rentang harga jangka pendek dan menghasilkan isyarat perdagangan berdasarkan pelbagai indikator. Dengan pengoptimuman dan pengurusan risiko yang betul, kelebihannya dapat digunakan dengan berkesan.


/*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)

Lebih lanjut