Estratégia de captura dinâmica de volatilidade RSI-Bandas de Bollinger


Data de criação: 2023-12-01 14:17:55 última modificação: 2023-12-01 14:17:55
cópia: 0 Cliques: 751
1
focar em
1619
Seguidores

Estratégia de captura dinâmica de volatilidade RSI-Bandas de Bollinger

Visão geral

A estratégia RSI-Bulling Band é uma estratégia de negociação que integra o conceito de Bulling Bands (BB), Indicadores de Força Relativa (RSI) e Média Móvel Simples (SMA). A particularidade da estratégia é que ela calcula um nível dinâmico entre os preços de fechamento acima e abaixo da trajetória. Esta característica única permite que a estratégia se adapte à volatilidade do mercado e às mudanças de preços.

Os mercados de criptomoedas e ações são altamente voláteis e, portanto, são ideais para a adoção da estratégia de Brin. O RSI pode ajudar a identificar a situação de supercompra e supervenda neste mercado frequentemente especulativo.

Princípio da estratégia

Bolling Band Dinâmico: A estratégia primeiro calcula os Bolling Bands de alta e baixa trajectória de acordo com o comprimento e o múltiplo definidos pelo usuário. Em seguida, ajusta o valor do Bolling Band de alta e baixa trajectória em combinação com a dinâmica do preço de fechamento. Finalmente, gera um sinal de quebra quando o preço atravessa o Bolling Band de alta e baixa trajectória e um sinal de quebra quando o preço atravessa o Bolling Band de baixa e baixa trajectória.

RSI: Se o usuário optar por usar o RSI para gerar sinais, a estratégia também calculará o RSI e seu SMA, e usá-los para gerar sinais adicionais de fazer mais e fazer menos. O sinal baseado no RSI só será usado quando o criptógrafo usar o RSI para gerar sinais.

Em seguida, a estratégia verifica a direção de negociação escolhida, entrando em posições de compra ou venda, respectivamente. Se a direção de negociação for definida como um funil bidirecional, a estratégia pode entrar em posições de compra e venda simultaneamente.

Finalmente, quando o preço de fechamento atravessa a BollingBand presente, ele é liquidado como uma opção de compra; quando o preço de fechamento atravessa a BollingBand presente, ele é liquidado como uma opção de compra.

Análise de vantagens

A estratégia combina os benefícios dos indicadores Brinks, RSI e SMA para adaptar-se à volatilidade do mercado, capturar dinamicamente os movimentos e gerar sinais de negociação em caso de sobrecompra e sobrevenda.

O indicador RSI complementa os sinais de negociação de Binary, evitando entradas erradas em mercados turbulentos. Permite opções de apenas fazer mais, apenas fazer menos ou negociar de forma bidirecional, adaptando-se a diferentes condições de mercado.

Os parâmetros são personalizáveis e podem ser ajustados de acordo com as preferências de risco individuais.

Análise de Riscos

A estratégia, baseada em indicadores técnicos, não consegue lidar com as mudanças fundamentais.

A configuração incorreta dos parâmetros da faixa de Bryn pode causar sinais de transação muito frequentes ou muito escassos.

O risco de negociação bidirecional aumenta e é necessário estar atento a perdas de baixa de preço.

Recomenda-se a combinação de stop loss para controlar o risco.

Direção de otimização

  1. Combinação com outros indicadores de filtragem de sinais, como MACD.

  2. Aumentar as estratégias de stop loss.

  3. Optimizar os parâmetros do Brin e do RSI.

  4. Parâmetros ajustados de acordo com a variedade de transações e o ciclo.

  5. Considere a otimização do disco e ajuste os parâmetros para adaptá-los à realidade.

Resumir

A estratégia RSI-Bulling é uma estratégia de captura de ondas dinâmicas de Bolling, combinando os benefícios dos indicadores Bolling, RSI e SMA para capturar a volatilidade do mercado. A estratégia pode ser personalizada e otimizada, mas não previne mudanças fundamentais.

Código-fonte da estratégia
/*backtest
start: 2023-11-23 00:00:00
end: 2023-11-30 00:00:00
period: 15m
basePeriod: 5m
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/
// © PresentTrading

//@version=5
// Define the strategy settings
strategy('Volatility Capture RSI-Bollinger - Strategy [presentTrading]', overlay=true)

// Define the input parameters for the indicator
priceSource  = input.source(title='Source', defval=hlc3, group='presentBollingBand') // The price source to use
lengthParam   = input.int(50, 'lengthParam', minval=1, group='presentBollingBand') // The length of the moving average
multiplier = input.float(2.7183, 'Multiplier', minval=0.1, step=.1, group='presentBollingBand') // The multiplier for the ATR
useRSI = input.bool(true, 'Use RSI for signals', group='presentBollingBand') // Boolean input to decide whether to use RSI for signals
rsiPeriod = input.int(10, 'RSI Period', minval=1, group='presentBollingBand') // The period for the RSI calculation
smaPeriod = input.int(5, 'SMA Period', minval=1, group='presentBollingBand') // The period for the SMA calculation
boughtRange = input.float(55, 'Bought Range Level', minval=1, group='presentBollingBand') // The level for the bought range
soldRange = input.float(50, 'Sold Range Level', minval=1, group='presentBollingBand') // The level for the sold range

// Add a parameter for choosing Long or Short
tradeDirection = input.string("Both", "Trade Direction", options=["Long", "Short", "Both"], group='presentBollingBand') // Dropdown input for trade direction

// Calculate the bollingerBand
barIndex = bar_index // The current bar index
upperBollingerBand = ta.sma(high, lengthParam) + ta.stdev(high, lengthParam) * multiplier // Calculate the upper Bollinger Band
lowerBollingerBand = ta.sma(low, lengthParam) - ta.stdev(low, lengthParam) * multiplier // Calculate the lower Bollinger Band

var float presentBollingBand = na // Initialize the presentBollingBand variable
crossCount = 0 // Initialize the crossCount variable

// Calculate the buy and sell signals
longSignal1 = ta.crossover(priceSource, presentBollingBand) // Calculate the long signal
shortSignal1 = ta.crossunder(priceSource, presentBollingBand) // Calculate the short signal

// Calculate the RSI
rsiValue = ta.rsi(priceSource, rsiPeriod) // Calculate the RSI value
rsiSmaValue = ta.sma(rsiValue, smaPeriod) // Calculate the SMA of the RSI value

// Calculate the buy and sell signals
longSignal2 = rsiSmaValue > boughtRange // Calculate the long signal based on the RSI SMA
shortSignal2 = rsiSmaValue < soldRange // Calculate the short signal based on the RSI SMA

presentBollingBand := na(lowerBollingerBand) or na(upperBollingerBand)?0.0 : close>presentBollingBand?math.max(presentBollingBand,lowerBollingerBand) : close<presentBollingBand?math.min(presentBollingBand,upperBollingerBand) : 0.0


if (tradeDirection == "Long" or tradeDirection == "Both") and longSignal1 and (useRSI ? longSignal2 : true) // Use RSI for signals if useRSI is true
    presentBollingBand := lowerBollingerBand // If the trade direction is "Long" or "Both", and the long signal is true, and either useRSI is false or the long signal based on RSI is true, then assign the lowerBollingerBand to the presentBollingBand.
    strategy.entry("Long", strategy.long) // Enter a long position.

if (tradeDirection == "Short" or tradeDirection == "Both") and shortSignal1 and (useRSI ? shortSignal2 : true) // Use RSI for signals if useRSI is true
    presentBollingBand := upperBollingerBand // If the trade direction is "Short" or "Both", and the short signal is true, and either useRSI is false or the short signal based on RSI is true, then assign the upperBollingerBand to the presentBollingBand.
    strategy.entry("Short", strategy.short) // Enter a short position.

// Exit condition
if (strategy.position_size > 0 and ta.crossunder(close, presentBollingBand)) // If the strategy has a long position and the close price crosses under the presentBollingBand, then close the long position.
    strategy.close("Long")
if (strategy.position_size < 0 and ta.crossover(close, presentBollingBand)) // If the strategy has a short position and the close price crosses over the presentBollingBand, then close the short position.
    strategy.close("Short")

//~~ Plot
plot(presentBollingBand,"presentBollingBand", color=color.blue) // Plot the presentBollingBand on the chart.