Estratégia de combinação de indicadores multi-momentum

Autora:ChaoZhang, Data: 2023-09-24 13:24:47
Tags:

Resumo

Esta estratégia experimental combina o Chande Momentum, RMI, Triple HMA RSI, Double EVW RSI, Triple EMA RSI e outros indicadores de momento, entrando em posições quando todos os indicadores dão sinais alinhados.

Estratégia lógica

  1. Calcule Chande Momentum e defina suas linhas de compra e venda.

  2. Calcular RMI, Triple HMA RSI, Double EVW RSI, Triple EMA RSI e outros indicadores.

  3. Estabelecer linhas de compra e venda para cada indicador.

  4. Quando o Momentum de Chande cruzar acima de sua linha de compra, verifique se outros indicadores também estão abaixo de suas respectivas linhas de compra.

  5. Por outro lado, quando o Chande Momentum cruza abaixo da linha de venda, enquanto outros indicadores excedem suas linhas de venda, geram sinal curto.

Vantagens

  1. A combinação de indicadores permite a validação mútua, evitando falsos sinais.

  2. O Chande Momentum capta de forma sensível as mudanças de tendência.

  3. O RMI mostra níveis de impulso para identificar níveis de sobrecompra/supervenda.

  4. Testar diferentes cálculos do RSI com o RSI HMA, o RSI EVW, etc.

  5. A combinação flexível de vários indicadores permite testes de eficácia dos indicadores.

Riscos

  1. Os requisitos para combinações de múltiplos indicadores são mais difíceis de cumprir, menos negócios, oportunidades perdidas.

  2. Não há mecanismos de controlo de risco como o stop loss.

  3. O desempenho do indicador depende de um período de tempo e pode não funcionar em todos os períodos.

  4. Nenhuma otimização de parâmetros, ajustamento de parâmetros fraco possível.

  5. Dados insuficientes de backtest para validar totalmente a estratégia.

Soluções possíveis:

  1. Afrouxar os limiares dos indicadores para mais operações.

  2. Incorporar perdas de atraso ou perdas de parada dura para limitar as perdas.

  3. Teste em diferentes produtos e prazos para encontrar parâmetros ideais.

  4. Empregar aprendizado de máquina ou busca de grade para otimização de parâmetros.

  5. Testes de retorno em mais mercados para garantir a robustez.

Orientações de otimização

  1. Teste diferentes conjuntos de parâmetros para encontrar a configuração ideal.

  2. Adicionar indicadores de impulso adaptativos de escala de tempo múltipla.

  3. Incorporar a detecção de tendências para evitar operações contrárias às tendências.

  4. Utilize a aprendizagem automática para melhorar a ponderação de múltiplos indicadores.

  5. Combinar com o sistema de média móvel para melhorar as entradas.

Resumo

Esta estratégia tenta identificar pontos de virada de tendência mais confiáveis, combinando múltiplos indicadores de impulso. A lógica diversificada tem grande extensão e potencial de otimização em áreas como seleção de parâmetros, ponderação de indicadores, controle de risco, etc., para adquirir mais sinais de qualidade, garantindo robustez, mas riscos como a curva de ajuste precisam ser gerenciados.


/*backtest
start: 2023-08-24 00:00:00
end: 2023-09-23 00:00:00
period: 1h
basePeriod: 15m
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/
// © burgercrisis

//@version=4
strategy("RMI + Triple HMRSI + Double EVWRSI + TERSI Strategy")

//* Backtesting Period Selector | Component *//
//* https://www.tradingview.com/script/eCC1cvxQ-Backtesting-Period-Selector-Component *//
//* https://www.tradingview.com/u/pbergden/ *//
//* Modifications made *//
testStartYear = input(2021, "Backtest Start Year") 
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)

testStopYear = input(999999, "Backtest Stop Year")
testStopMonth = input(9, "Backtest Stop Month")
testStopDay = input(26, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)

testPeriod() => true
/////////////// END - Backtesting Period Selector | Component ///////////////


src = input(close, "Price", type = input.source)
CMOlength = input(9, minval=1, title="Alpha Chande Momentum Length")

//CMO
momm = change(src)
f1(m) => m >= 0.0 ? m : 0.0
f2(m) => m >= 0.0 ? 0.0 : -m
m1 = f1(momm)
m2 = f2(momm)
sm1 = sum(m1, CMOlength)
sm2 = sum(m2, CMOlength)
percent(nom, div) => 100 * nom / div
chandeMO = percent(sm1-sm2, sm1+sm2)
plot(chandeMO, "Chande MO", color=color.blue)




//RMI
// Copyright (c) 2018-present, Alex Orekhov (everget)
// Relative Momentum Index script may be freely distributed under the MIT license.
length3 = input(title="RMI Length", type=input.integer, minval=1, defval=30)
momentumLength3 = input(title="RMI Momentum ", type=input.integer, minval=1, defval=25)
up3 = rma(max(change(src, momentumLength3), 0), length3)
down3 = rma(-min(change(src, momentumLength3), 0), length3)

rmi3 = (down3 == 0 ? 100 : up3 == 0 ? 0 : 100 - (100 / (1 + up3 / down3)))-50
//
//
// end RMI, end Alex Orekhov copywrite
//
//

lengthMA = input(7)
lengthRSI = input(14)
thrsi = hma(hma(hma(rsi(src, lengthRSI), lengthMA), lengthMA), lengthMA)
thrsi1 = (thrsi-50)*10

lengthMA2 = input(7)
lengthRSI2 = input(14)
devwrsi = ((ema(ema(vwma(rsi(src, lengthRSI2), lengthMA2), lengthMA2), lengthMA2))-50)*5

lengthMA3 = input(7)
lengthRSI3 = input(14)
tersi = ((ema(ema(ema(rsi(src, lengthRSI3), lengthMA3), lengthMA3), lengthMA3))-50)*10

rmirsi = ((thrsi*rmi3/25))

//Boundary Lines

obLevel1 = input(0, title="Chande Sellline")
osLevel1 = input(0, title="Chande Buyline")
hline(obLevel1, color=#0bc4d9)
hline(osLevel1, color=#0bc4d9)

obLevel2 = input(0, title="Triple HMRSI Sellline")
osLevel2 = input(0, title="Triple HMRSI Buyline")
hline(obLevel2, color=#5a0bd9)
hline(osLevel2, color=#5a0bd9)

obLevel3 = input(0, title="DEVWRSI Sellline")
osLevel3 = input(0, title="DEVWRSI Buyline")
hline(obLevel3, color=#5a0bd9)
hline(osLevel3, color=#5a0bd9)

obLevel4 = input(0, title="TERSI Sellline")
osLevel4 = input(0, title="TERSI Buyline")
hline(obLevel4, color=#5a0bd9)
hline(osLevel4, color=#5a0bd9)

obLevel5 = input(0, title="RMI Sellline")
osLevel5 = input(0, title="RMI Buyline")
hline(obLevel5, color=#5a0bd9)
hline(osLevel5, color=#5a0bd9)

obLevel6 = input(0, title="RMI*RSI Sellline")
osLevel6 = input(0, title="RMI*RSI Buyline")
hline(obLevel6, color=#5a0bd9)
hline(osLevel6, color=#5a0bd9)

plot((thrsi1), title="THRSI")
plot(devwrsi, color=color.red, title="DEVWRSI")
plot(tersi, color=color.yellow, title="TERSI")
plot(rmirsi, color=color.purple, title="RMI*HMRSI")
plot(rmi3, color=color.orange, title="RMI")




longcondition1 = crossover(chandeMO, osLevel1)
shortcondition1 = crossunder(chandeMO, obLevel1)
longcondition2 = rmirsi<osLevel6 and rmi3<osLevel5 and tersi<osLevel4 and devwrsi<osLevel3 and thrsi1<osLevel2  and longcondition1
shortcondition2 = rmirsi>obLevel6 and rmi3>obLevel5 and tersi>obLevel4 and devwrsi>obLevel3 and thrsi1>obLevel2  and shortcondition1

if testPeriod()
    if longcondition2
        strategy.entry("Buy", strategy.long)
    if shortcondition2
        strategy.entry("Sell", strategy.short)






hline(0, color=#C0C0C0, linestyle=hline.style_dashed, title="Zero Line")

Mais.