Williams VIX Fix Estratégia

Autora:ChaoZhang, Data: 28 de setembro de 2023
Tags:

Resumo

Esta estratégia visa prever a volatilidade do mercado do VIX usando a fórmula Williams Vix Fix combinada com os indicadores RSI e RSI estocásticos.

Estratégia lógica

A estratégia baseia-se principalmente na combinação da fórmula Williams Vix Fix e dos indicadores Stochastic RSI & RSI.

Em primeiro lugar, o valor VIX do período atual é calculado pela fórmula Williams Vix Fix através da medição da relação entre o preço mais alto e o preço mais baixo, que representa a volatilidade do mercado e os níveis de pânico.

Em segundo lugar, a estratégia adota a combinação de indicadores de RSI estocástico e RSI. O RSI é usado para determinar posições longas / curtas, enquanto o RSI do Stoch combina linhas K & D para identificar pontos de reversão do RSI. Os sinais de venda são gerados quando o RSI do Stoch cai da zona de sobrecompra.

Por último, a estratégia integra ambos, tomando o sinal de sobrecompra do RSI do Stoch como base para a venda e o valor do VIX inferior à faixa de Bollinger inferior como base para a compra, de modo a capturar pontos de reversão do mercado.

Análise das vantagens

A maior vantagem desta estratégia é que pode utilizar os pontos fortes de dois indicadores diferentes em combinação.

A fórmula Williams Vix Fix pode efetivamente refletir as emoções de pânico do mercado. O ajuste dinâmico das bandas de Bollinger pode se adaptar a diferentes ciclos. O RSI estocástico identifica pontos de reversão do RSI através do cruzamento das linhas K & D, evitando falsos sinais.

Os dois combinados podem localizar com mais precisão os pontos de reversão do mercado. Ele gera sinais de venda quando o índice de pânico do mercado libera sinais enquanto utiliza o Stoch RSI para determinar pontos de entrada específicos para evitar entradas errôneas.

Análise de riscos

Esta estratégia apresenta também alguns riscos:

  1. A fórmula Williams Vix Fix não pode refletir plenamente as emoções de pânico do mercado.

  2. Os sinais de reversão do RSI do Stoch também podem ser errados e precisam ser verificados com outros indicadores.

  3. A estratégia é relativamente conservadora e pode perder oportunidades se não conseguir acompanhar os mercados em rápida evolução em tempo útil.

  4. A estratégia pode ter drawdowns maiores, o que requer um dimensionamento cuidadoso da posição.

Precisamos definir parâmetros razoavelmente, verificar com outros indicadores e controlar os tamanhos das posições para mitigar os riscos ao utilizar esta estratégia.

Orientações de otimização

Algumas maneiras de otimizar esta estratégia:

  1. Otimizar os parâmetros da fórmula Williams Vix para refletir com mais precisão os níveis de pânico do mercado.

  2. Otimizar os parâmetros do Stoch RSI para encontrar melhores combinações de períodos de K & D para uma maior precisão de reversão.

  3. Adicionar mecanismos de dimensionamento de posições, como stop loss/take profit, ou ajustamento dinâmico de posição com base no rácio drawdown/profit.

  4. Incorporar outros indicadores como MACD, KD para realizar a verificação multi-indicador e reduzir os falsos sinais.

  5. Adicionar algoritmos de machine learning, usar big data para treinar modelos e otimizar automaticamente parâmetros, melhorando a estabilidade.

Através das otimizações acima referidas, o desempenho e a estabilidade da estratégia podem ser significativamente melhorados.

Conclusão

A estratégia Williams Vix Fix captura o pânico do mercado e as transições de estabilidade, e usa o Stoch RSI para determinar pontos de entrada específicos, localizando efetivamente os fundos do mercado. Sua vantagem reside na combinação de indicadores, mas também há certos riscos. Podemos fortalecer a estratégia por otimização de parâmetros e verificação de múltiplos indicadores, tornando-a uma ferramenta eficaz para localizar reversões do mercado.


/*backtest
start: 2022-09-21 00:00:00
end: 2023-09-27 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
//Divergence and Hidden Divergence correlating with the Money Flow Index

strategy("Vix FIX / StochRSI Strategy", pyramiding=9, initial_capital=10000, default_qty_type=strategy.percent_of_equity,overlay=false)

///////////// Stochastic Slow
Stochlength = input(14, minval=1, title="lookback length of Stochastic")
StochOverBought = input(80, title="Stochastic overbought condition")
StochOverSold = input(20, title="Stochastic oversold condition")
smoothK = input(3, title="smoothing of Stochastic %K ")
smoothD = input(3, title="moving average of Stochastic %K")
k = sma(stoch(close, high, low, Stochlength), smoothK)
d = sma(k, smoothD)

 
///////////// RSI 
RSIlength = input( 14, minval=1 , title="lookback length of RSI")
RSIOverBought = input( 70  , title="RSI overbought condition")
RSIOverSold = input( 30  , title="RSI oversold condition")
RSIprice = close
vrsi = rsi(RSIprice, RSIlength)

///////////// Double strategy: RSI strategy + Stochastic strategy

pd = input(22, title="LookBack Period Standard Deviation High")
bbl = input(20, title="Bolinger Band Length")
mult = input(2.0    , minval=1, maxval=5, title="Bollinger Band Standard Devaition Up")
lb = input(50  , title="Look Back Period Percentile High")
ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")
new = input(false, title="-------Text Plots Below Use Original Criteria-------" )
sbc = input(false, title="Show Text Plot if WVF WAS True and IS Now False")
sbcc = input(false, title="Show Text Plot if WVF IS True")
new2 = input(false, title="-------Text Plots Below Use FILTERED Criteria-------" )
sbcFilt = input(true, title="Show Text Plot For Filtered Entry")
sbcAggr = input(true, title="Show Text Plot For AGGRESSIVE Filtered Entry")
ltLB = input(40, minval=25, maxval=99, title="Long-Term Look Back Current Bar Has To Close Below This Value OR Medium Term--Default=40")
mtLB = input(14, minval=10, maxval=20, title="Medium-Term Look Back Current Bar Has To Close Below This Value OR Long Term--Default=14")
str = input(3, minval=1, maxval=9, title="Entry Price Action Strength--Close > X Bars Back---Default=3")
//Alerts Instructions and Options Below...Inputs Tab
new4 = input(false, title="-------------------------Turn On/Off ALERTS Below---------------------" )
new5 = input(false, title="----To Activate Alerts You HAVE To Check The Boxes Below For Any Alert Criteria You Want----")
sa1 = input(false, title="Show Alert WVF = True?")
sa2 = input(false, title="Show Alert WVF Was True Now False?")
sa3 = input(false, title="Show Alert WVF Filtered?")
sa4 = input(false, title="Show Alert WVF AGGRESSIVE Filter?")

//Williams Vix Fix Formula
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
rangeHigh = (highest(wvf, lb)) * ph

//Filtered Bar Criteria
upRange = low > low[1] and close > high[1]
upRange_Aggr = close > close[1] and close > open[1]
//Filtered Criteria
filtered = ((wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh))
filtered_Aggr = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and not (wvf < upperBand and wvf < rangeHigh)

//Alerts Criteria
alert1 = wvf >= upperBand or wvf >= rangeHigh ? 1 : 0
alert2 = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh) ? 1 : 0
alert3 = upRange and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered ? 1 : 0
alert4 = upRange_Aggr and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered_Aggr ? 1 : 0

//Coloring Criteria of Williams Vix Fix
col = wvf >= upperBand or wvf >= rangeHigh ? lime : gray

isOverBought = (crossover(k,d) and k > StochOverBought) ? 1 : 0
isOverBoughtv2 = k > StochOverBought ? 1 : 0
filteredAlert = alert3 ? 1 : 0
aggressiveAlert = alert4 ? 1 : 0

plot(isOverBought, "Overbought / Crossover", style=line, color=red) 
plot(filteredAlert, "Filtered Alert", style=line, color=fuchsia) 
plot(aggressiveAlert, "Aggressive Alert", style=line, color=orange)

if (filteredAlert or aggressiveAlert)
    strategy.entry("Long", strategy.long)

if (isOverBought)
    strategy.close("Long")

    


Mais.