
La estrategia de ruptura de la línea media RSI doble es una estrategia cuantitativa que utiliza el indicador RSI y el indicador de la línea media para juzgar el momento de negociar. La idea central de la estrategia es que cuando el indicador RSI alcanza una zona de sobreventa y sobreventa, se utiliza la dirección de la línea media para filtrar la señal y buscar puntos de ruptura de mayor calidad para construir posiciones.
El RSI y el SMA se calculan de acuerdo con los parámetros establecidos por el usuario.
Cuando el RSI atraviesa la línea de sobreventa establecida (default 30), se genera una señal de más cabeza si el precio está por debajo de la línea media de salida LONG.
Cuando el RSI cruza la línea de sobreventa establecida (default 70) debajo, se genera una señal de cabeza vacía si el precio está por encima de la línea media de salida SHORT.
El usuario puede seleccionar la línea media de filtración, que se generará cuando el precio esté por encima de la línea media de filtración.
La salida de la posición se determina de acuerdo con la línea media de salida larga y la línea media de salida corta.
El diseño de los dos indicadores hace referencia a los dos factores más importantes del mercado para mejorar la precisión de las decisiones.
Utiliza razonablemente las características de la reversión del RSI para buscar el momento de la reversión.
Los filtros de línea media aumentan la rigidez de los juicios y evitan la persecución de los altos y bajos.
Permite la personalización de parámetros que se pueden optimizar para diferentes variedades y ciclos.
Diseño lógico simple, fácil de entender y modificar.
Los indicadores RSI son propensos a generar líneas verticales, y los indicadores de densidad pueden reducir este problema.
El RSI en períodos largos es susceptible a fallas y puede reducir la optimización de parámetros o ayudar a otros indicadores.
La línea media tiene un retraso, se puede acortar la longitud de la línea media o auxiliar indicadores como MACD.
La simplicidad de los criterios de evaluación permite introducir más indicadores para asegurar la eficacia de las señales de negociación.
Optimización de los parámetros RSI o la introducción de un indicador de densidad reduce la probabilidad de falsas señales.
La combinación de la tendencia y los indicadores de fluctuación como DMI, BOLL para determinar la tendencia y el soporte.
Introducción de indicadores como el MACD para sustituir o colaborar con el juicio equitativo.
Se ha añadido una lógica de condiciones de apertura para evitar señales de ruptura no deseadas.
La estrategia de ruptura de la línea media doble RSI utiliza el método integrado de los indicadores RSI para determinar la tendencia de sobreventa y sobreventa y el juicio de la línea media. En teoría, puede aprovechar eficazmente las oportunidades de reversión. La estrategia es flexible, sencilla y fácil de manejar, pero también se adapta a la optimización de diferentes variedades.
/*backtest
start: 2024-01-16 00:00:00
end: 2024-01-23 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Global Market Signals: RSI Strategy.
//@version=4
strategy("GMS: RSI Strategy", overlay=true)
LongShort = input(title="Long Only or Short Only or Both?", type=input.string, defval="Both", options=["Both", "Long Only", "Short Only"])
RSILength = input(title="RSI Length", type = input.integer ,defval=14)
RSIUpper = input(title="Upper Threshold", type = input.float ,defval=70)
RSILower = input(title="Lower Threshold", type = input.float ,defval=30)
LongExit = input(title="Long Exit SMA Length", type = input.integer ,defval=5)
ShortExit = input(title="Short Exit SMA Length", type = input.integer ,defval=5)
AboveBelow = input(title="Trend SMA Filter?", type=input.string, defval="Above", options=["Above", "Below", "Don't Include"])
TrendLength = input(title="Trend SMA Length", type = input.integer ,defval=200)
//Long Side
if LongShort =="Long Only" and AboveBelow == "Above"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Long Only" and AboveBelow == "Below"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Long Only" and AboveBelow == "Don't Include"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Above"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Below"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
strategy.close("LONG", when = close>sma(close,LongExit))
if LongShort =="Both" and AboveBelow == "Don't Include"
strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
strategy.close("LONG", when = close>sma(close,LongExit))
//SHORT SIDE
if LongShort =="Short Only" and AboveBelow == "Above"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Short Only" and AboveBelow == "Below"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Short Only" and AboveBelow == "Don't Include"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Above"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Below"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
strategy.close("SHORT", when = close<sma(close,ShortExit))
if LongShort =="Both" and AboveBelow == "Don't Include"
strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
strategy.close("SHORT", when = close<sma(close,ShortExit))