Estrategia de negociación de ETF de seguimiento de tendencias de reversión del índice de riesgo

El autor:¿ Qué pasa?, Fecha: 2024-01-22 17:15:18
Las etiquetas:

img

Resumen general

Principio de la estrategia

TodaysMinRSI, y el RSI hace 3 días está por debajo del parámetro ajustableDay3RSIMax

El mecanismo de salida de la estrategia es cuando el indicador RSI excede una vez más el valor umbral del parámetro ajustableExit RSI

Análisis de ventajas

  • Utilice el indicador RSI para determinar las zonas de sobrecompra y sobreventa en las que es probable un rebote.

Riesgos y soluciones

  • Los parámetros deben ser optimizados para cada variedad mediante pruebas de retroceso.

Direcciones de optimización

  • Añadir estrategias de stop loss móviles para hacer el nivel de stop loss dinámico, reduciendo las pérdidas.
  • Optimizar los parámetros y realizar pruebas de retroceso para diferentes variedades para obtener conjuntos de parámetros que se adapten a cada variedad.

Resumen de las actividades


/*backtest
start: 2024-01-14 00:00:00
end: 2024-01-21 00:00:00
period: 3m
basePeriod: 1m
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/
// @version = 5
// Author = TradeAutomation


strategy(title="R3 ETF Strategy", shorttitle="R3 ETF Strategy", overlay=true)


// Backtest Date Range Inputs // 
StartTime = input(defval=timestamp('01 Jan 2012 05:00 +0000'), title='Start Time')
EndTime = input(defval=timestamp('01 Jan 2099 00:00 +0000'), title='End Time')
InDateRange = true

// Calculations and Inputs //
RSILen = input.int(2, "RSI Length")
RSI = ta.rsi(close, RSILen)
TodaysMinRSI = input.int(10, "Today's Min RSI for Entry", tooltip = "The RSI must be below this number today to qualify for trade entry")
Day3RSIMax = input.int(60, "Max RSI 3 Days Ago for Entry", tooltip = "The RSI must be below this number 3 days ago to qualify for trade entry")
EMA = ta.ema(close, 200)

// Strategy Rules //
Rule1 = close>ta.ema(close, 200)
Rule2 = RSI[3]<Day3RSIMax and RSI<TodaysMinRSI
Rule3 = RSI<RSI[1] and RSI[1]<RSI[2] and RSI[2]<RSI[3] 
Exit = ta.crossover(RSI, input.int(70, "Exit RSI", tooltip = "The strategy will sell when the RSI crosses over this number"))

// Plot //
plot(EMA, "200 Day EMA")

// Entry & Exit Functions //
if (InDateRange)
    strategy.entry("Long", strategy.long, when = Rule1 and Rule2 and Rule3)
//    strategy.close("Long", when = ta.crossunder(close, ATRTrailingStop))
    strategy.close("Long", when = Exit)
if (not InDateRange)
    strategy.close_all()
    

Más.