
A estratégia de ruptura de linha de equilíbrio do RSI é uma estratégia quantitativa que usa o indicador RSI e o indicador da linha de equilíbrio para julgar o tempo de negociação. A idéia central da estratégia é usar a direção da linha de equilíbrio para filtrar os sinais e buscar pontos de ruptura de melhor qualidade para construir posições quando o indicador RSI atinge uma área de sobrevenda.
O RSI e a SMA são calculados de acordo com os parâmetros definidos pelo usuário.
Quando o RSI atravessa a linha de ultra-venda definida (default 30), um sinal de multi-cabeça é gerado se o preço estiver abaixo da linha média de saída LONG.
Quando o RSI atravessa a linha de sobrevenda definida (default 70) abaixo, um sinal de cabeça-vazio é gerado se o preço estiver acima da linha média de saída SHORT.
O usuário pode selecionar a linha média de filtragem, e o sinal é gerado quando o preço está acima da linha média de filtragem.
A saída da posição é julgada de acordo com a linha média de saída LONG e a linha média de saída SHORT.
O design de dois indicadores, com referência a dois fatores de mercado, aumenta a precisão da tomada de decisão.
Aproveite a característica de inversão do RSI para encontrar o momento da inversão.
O filtro de linha média aumenta a rigoridade do julgamento e evita a perseguição de altos e baixos.
Permite a personalização de parâmetros, que podem ser otimizados para diferentes variedades e ciclos.
O design lógico é simples, fácil de entender e modificar.
O indicador RSI é propenso a produzir linhas verticais, o indicador de densidade pode reduzir esse problema.
O RSI em grandes períodos é fácil de falhar, pode reduzir a otimização de parâmetros ou auxiliar outros indicadores.
A linha média tem um atraso e pode ser apropriadamente reduzida para comprimento da linha média ou auxiliar indicadores como MACD.
A simplificação dos critérios de avaliação permite a introdução de mais indicadores para garantir a eficácia dos sinais de negociação.
Otimizar os parâmetros do RSI ou introduzir um indicador de densidade reduz a probabilidade de falso sinal.
Combinação de tendências e indicadores de flutuação como DMI, BOLL para determinar tendências e suportes.
A introdução de indicadores como MACD para substituir ou colaborar com o julgamento de equilíbrio.
Aumentar a lógica das condições de abertura de posição para evitar sinais de ruptura indesejáveis.
A estratégia de ruptura de linha de equilíbrio de RSI dupla usa o método integrado do indicador RSI para determinar a tendência de compra e venda excessiva e de avaliação de linha de equilíbrio. Em teoria, é possível aproveitar efetivamente a oportunidade de reversão. A estratégia é flexível e simples, fácil de usar, mas também adequada para a otimização 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))