Strategi Rebound Rata-rata Bergerak

Penulis:ChaoZhang, Tanggal: 2023-12-28 15:25:29
Tag:

img

## Ringkasan Moving Average Rebound Strategy adalah strategi yang menggabungkan indikator teknis dan pola harga untuk berdagang panjang dan pendek di sekitar level support dan resistance. Strategi ini menggunakan moving average untuk mengidentifikasi arah tren pasar, indikator pola untuk membantu menentukan titik balik, dan swing high/low sebelumnya untuk menemukan level support dan resistance kunci untuk trading counter-trend.

Prinsip Strategi

Langkah-langkah utama untuk menentukan entri perdagangan adalah:

  1. Gunakan indikator Alligator triple moving average untuk menilai arah tren.

  2. Mengidentifikasi zona pembalikan potensial dengan indikator pola puncak-melalui ketika di daerah overbought / oversold.

  3. Gabungkan dengan support/resistance untuk menentukan titik masuk perdagangan kontra-trend di sekitar level utama.

  4. Menggunakan EMAS untuk membantu menentukan tren jangka panjang secara keseluruhan.

  5. Menggunakan stop loss trailing untuk mengontrol jumlah kerugian perdagangan tunggal.

Keuntungan

Keuntungan dari strategi:

  1. Menggabungkan sinyal dari beberapa indikator meningkatkan akurasi.

  2. Trading kontra-trend dari area support/resistance utama memiliki probabilitas tinggi.

  3. Stop loss trailing yang berisi kerugian pada perdagangan tunggal.

Risiko

Risiko yang terlibat:

  1. Lebih banyak indikator dapat mengarah pada frekuensi perdagangan yang lebih tinggi dan perlu pengendalian biaya transaksi.

  2. Harga mungkin tidak berbalik seperti yang diharapkan sehingga menyebabkan kerugian besar.

  3. Stop loss dapat diambil selama pergerakan besar yang tidak stabil.

Bidang Peningkatan

Bidang yang perlu ditingkatkan:

  1. Optimalkan bobot antara indikator untuk menemukan kombinasi kinerja terbaik.

  2. Menggunakan pembelajaran mesin untuk meningkatkan akurasi tingkat dukungan / resistensi utama.

  3. Tambahkan indikator volume untuk menghindari perdagangan ketika lingkungan volatile tetapi volume rendah.

  4. Memperbaiki model stop loss adaptif untuk menyeimbangkan efektivitas dan stop yang tidak perlu.

Ringkasan

Singkatnya, Strategi Rebound Moving Average memanfaatkan pertemuan indikator termasuk moving average, pola harga dan support/resistance untuk entri. Strategi teknis khas dengan akurasi yang lebih tinggi dari beberapa sinyal. Memantau risiko di sekitar kegagalan tingkat kunci dan stop loss slippage. Optimasi lebih lanjut pada bobot indikator, pembelajaran mesin dan volume dapat meningkatkan kinerja.


/*backtest
start: 2022-12-21 00:00:00
end: 2023-12-27 00:00:00
period: 1d
basePeriod: 1h
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/
// © vhurtadocos


//@version=5
strategy('Estrategia EMA Resistencia Soporte', shorttitle='Estrategia EMA RESISTENCIA Y SOPORTE', overlay=true, margin_long=100, margin_short=100, pyramiding = 10 )

//INICIO DE CONDICIONES BASICAS
/// Alligator
smma(src, length) =>
    smma = 0.0
    sma_1 = ta.sma(src, length)
    smma := na(smma[1]) ? sma_1 : (smma[1] * (length - 1) + src) / length
    smma
lipsLength = input(title='🐲 Lips Length', defval=5)
teethLength = input(title='🐲 Teeth Length', defval=8)
jawLength = input(title='🐲 Jaw Length', defval=13)
lipsOffset = input(title='🐲 Lips Offset', defval=3)
teethOffset = input(title='🐲 Teeth Offset', defval=5)
jawOffset = input(title='🐲 Jaw Offset', defval=8)
lips = smma(hl2, lipsLength)
teeth = smma(hl2, teethLength)
jaw = smma(hl2, jawLength)


// Fractals
n = input.int(title='📌 Period', defval=2, minval=2)
upFractal = high[n + 2] < high[n] and high[n + 1] < high[n] and high[n - 1] < high[n] and high[n - 2] < high[n] or high[n + 3] < high[n] and high[n + 2] < high[n] and high[n + 1] == high[n] and high[n - 1] < high[n] and high[n - 2] < high[n] or high[n + 4] < high[n] and high[n + 3] < high[n] and high[n + 2] == high[n] and high[n + 1] <= high[n] and high[n - 1] < high[n] and high[n - 2] < high[n] or high[n + 5] < high[n] and high[n + 4] < high[n] and high[n + 3] == high[n] and high[n + 2] == high[n] and high[n + 1] <= high[n] and high[n - 1] < high[n] and high[n - 2] < high[n] or high[n + 6] < high[n] and high[n + 5] < high[n] and high[n + 4] == high[n] and high[n + 3] <= high[n] and high[n + 2] == high[n] and high[n + 1] <= high[n] and high[n - 1] < high[n] and high[n - 2] < high[n]
dnFractal = low[n + 2] > low[n] and low[n + 1] > low[n] and low[n - 1] > low[n] and low[n - 2] > low[n] or low[n + 3] > low[n] and low[n + 2] > low[n] and low[n + 1] == low[n] and low[n - 1] > low[n] and low[n - 2] > low[n] or low[n + 4] > low[n] and low[n + 3] > low[n] and low[n + 2] == low[n] and low[n + 1] >= low[n] and low[n - 1] > low[n] and low[n - 2] > low[n] or low[n + 5] > low[n] and low[n + 4] > low[n] and low[n + 3] == low[n] and low[n + 2] == low[n] and low[n + 1] >= low[n] and low[n - 1] > low[n] and low[n - 2] > low[n] or low[n + 6] > low[n] and low[n + 5] > low[n] and low[n + 4] == low[n] and low[n + 3] >= low[n] and low[n + 2] == low[n] and low[n + 1] >= low[n] and low[n - 1] > low[n] and low[n - 2] > low[n]
plotshape(title='📌 Up-Fractal', series=upFractal, style=shape.triangleup, location=location.abovebar, offset=-2, color=color.new(color.olive, 0), text="R")
plotshape(title='📌 Down-Fractal', series=dnFractal, style=shape.triangledown, location=location.belowbar, offset=-2, color=color.new(color.maroon, 0), text="S", textcolor = color.new(color.maroon,0))

// Resistance, Support
showRS = input(title='⤒⤓ Show Res-Sup', defval=true)
lengthRS = input(title='⤒⤓ Res-Sup Length', defval=13)
highRS = ta.valuewhen(high >= ta.highest(high, lengthRS), high, 0)
lowRS = ta.valuewhen(low <= ta.lowest(low, lengthRS), low, 0)
plot(title='⤒ Resistance', series=showRS and highRS ? highRS : na, color=highRS != highRS[1] ? na : color.olive, linewidth=1, offset=0)
plot(title='⤓ Support', series=showRS and lowRS ? lowRS : na, color=lowRS != lowRS[1] ? na : color.maroon, linewidth=1, offset=0)




// EMA de 8 períodos
ema8 = ta.ema(close, 8)
plot(title='ema8', series=ema8, color=color.new(#dbef41, 0), offset=0)

// EMA de 21 períodos
ema21 = ta.ema(close, 21)
plot(title='ema21', series=ema21, color=color.new(#e12c0c, 0), offset=0)

// EMA de 50 períodos
ema50 = ta.ema(close, 50)
plot(title='ema50', series=ema50, color=color.new(#3419de, 0), offset=0)

// EMA de 200 períodos
ema200 = ta.ema(close, 200)
plot(title='ema200', series=ema200, color=color.new(#f6f6f4, 0), offset=0)



// Definiciones originales...
// ... (incluyendo tus definiciones de Alligator, Fractals, etc.)

// Guardamos el último soporte y resistencia
var float lastSupport = na
var float lastResistance = na

// Detectando un nuevo soporte y resistencia
newSupportDetected = low == lowRS


if newSupportDetected
    lastSupport := low

// Lógica de entrada y salida

// Condiciones de entrada basadas en soportes recién formados
longCondition = low == lowRS
if longCondition
    strategy.entry("Long", strategy.long)

// Salida (take profit) cuando detectamos una nueva resistencia después de entrar en una posición long
newResistanceDetected = high == highRS
if newResistanceDetected and strategy.position_size > 0
    strategy.close("Long")

// Agregar una condición para el stop loss
longStopLossPrice = close * 0.95
if strategy.position_size > 0 and close <= longStopLossPrice
    strategy.close("Long")

// Pintamos los soportes y resistencias
plotshape(longCondition, style=shape.triangledown, location=location.belowbar, color=color.red)
plotshape(newResistanceDetected, style=shape.triangleup, location=location.abovebar, color=color.green)

// Resto del código para plotear las EMAs y fractales
// ...




Lebih banyak