Stratégie de rebond de la moyenne mobile

Auteur:ChaoZhang est là., Date: le 28-12-2023 à 15h25
Les étiquettes:

img

## Vue d'ensemble La stratégie de rebond des moyennes mobiles est une stratégie qui combine des indicateurs techniques et des modèles de prix pour négocier long et court autour des niveaux de support et de résistance.

Principes de stratégie

Les étapes clés pour déterminer les entrées commerciales sont les suivantes:

  1. Utilisez l'indicateur de moyenne mobile triple Alligator pour juger de la direction de la tendance.

  2. Identifier les zones de renversement potentiels avec l'indicateur de modèle Peak-Through lorsqu'il s'agit de zones de surachat/survente.

  3. Combiner avec support/résistance pour identifier les points d'entrée de la tendance opposée autour des niveaux clés.

  4. Utiliser l'EMAS pour aider à déterminer la tendance globale à long terme.

  5. Utiliser un stop loss pour contrôler le montant des pertes d'une seule transaction.

Les avantages

Avantages de la stratégie:

  1. La combinaison de signaux provenant de plusieurs indicateurs améliore la précision.

  2. La probabilité d'un contre-trend à partir de zones de soutien ou de résistance clés est élevée.

  3. Le montant de l'exposition au risque est calculé à partir de l'exposition au risque.

Les risques

Les risques encourus:

  1. Plus d'indicateurs peuvent conduire à une plus grande fréquence des échanges et nécessitent un contrôle des coûts des transactions.

  2. Les niveaux de support/résistance défaillants représentent le plus grand risque.

  3. Le stop-loss peut être retiré lors de mouvements volatils.

Les domaines d'amélioration

Les domaines à améliorer:

  1. Optimiser les pondérations entre les indicateurs pour trouver la meilleure combinaison de performances.

  2. Utiliser l'apprentissage automatique pour améliorer la précision du niveau de support/résistance clé.

  3. Ajouter des indicateurs de volume pour éviter les transactions dans des environnements volatiles mais à faible volume.

  4. Améliorer les modèles de stop loss adaptatifs pour équilibrer l'efficacité et les arrêts inutiles.

Résumé

En résumé, la stratégie de rebond des moyennes mobiles utilise une confluence d'indicateurs, y compris les moyennes mobiles, les modèles de prix et le support / résistance pour les entrées. Une stratégie technique typique avec une plus grande précision à partir de plusieurs signaux. Surveillez les risques liés à l'échec des niveaux clés et au glissement des pertes. Une optimisation supplémentaire des poids des indicateurs, de l'apprentissage automatique et du volume peut améliorer les performances.


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




Plus de