
A estratégia de alerta histórico de RSI de dupla reversão gera um sinal de negociação mais preciso através da combinação da estratégia de reversão 123 com a estratégia de alerta histórico RSI. A estratégia de reversão 123 determina o ponto de reversão do preço e a estratégia de alerta histórico RSI determina o ponto de superaquecimento. A combinação dos dois sinais de estratégia pode gerar um sinal de negociação mais confiável.
A estratégia de inversão baseia-se na hipótese de que os sinais de inversão do preço das ações geralmente aparecem 2 dias antes da inversão do preço das ações.
As regras de julgamento são:
A estratégia usa a relação de preços dos dois dias anteriores à reversão das ações para determinar possíveis pontos de reversão. Ao mesmo tempo, o indicador de linha K elimina parte dos sinais de ruído.
A estratégia de alerta histórico do RSI foi modificada com base no indicador RSI:
A estratégia é baseada na determinação do tamanho do valor absoluto do indicador RSI, sugerindo um estado de sobrevenda e sobrevenda, gerando assim um sinal de negociação.
A estratégia combina dois tipos diferentes de estratégias, que podem ser complementares e produzir sinais mais confiáveis. As vantagens específicas são:
A estratégia tem como principais riscos:
A solução é a seguinte:
A estratégia pode ser otimizada em várias direções:
A estratégia de alerta de histórico de RSI de dupla reversão pode produzir um sinal de negociação mais confiável, combinando a estratégia de reversão de preço com a estratégia de julgamento de compra e venda. Comparado à estratégia única, tem a vantagem de ter uma menor probabilidade de falso sinal e um julgamento mais abrangente. A estratégia tem um grande espaço de otimização, através de ajustes de parâmetros, verificação de múltiplos fatores e otimização de posição.
/*backtest
start: 2022-12-28 00:00:00
end: 2024-01-03 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 28/06/2021
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
// The strategy sells at market, if close price is lower than the previous close price
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// This simple indicator modified RSI
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
vFast = sma(stoch(close, high, low, Length), KSmoothing)
vSlow = sma(vFast, DLength)
pos = 0.0
pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
pos
RSI_Hist(RSIPeriod,BuyAlertLevel,SellAlertLevel,RSIHistoModify) =>
pos = 0.0
xPrice = close
RSIMain = (rsi(xPrice, RSIPeriod) - 50) * RSIHistoModify
pos:= iff(RSIMain > BuyAlertLevel, 1,
iff(RSIMain < SellAlertLevel, -1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & RSI HistoAlert", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- RSI HistoAlert ----")
RSIPeriod = input(13, minval=1)
BuyAlertLevel = input(-10)
SellAlertLevel = input(10)
RSIHistoModify = input(1.5)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posRSI_Hist = RSI_Hist(RSIPeriod,BuyAlertLevel,SellAlertLevel,RSIHistoModify)
pos = iff(posReversal123 == 1 and posRSI_Hist == 1 , 1,
iff(posReversal123 == -1 and posRSI_Hist == -1, -1, 0))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1 , 1, pos))
if (possig == 1 )
strategy.entry("Long", strategy.long)
if (possig == -1 )
strategy.entry("Short", strategy.short)
if (possig == 0)
strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )