
La estrategia de ruptura doble RSI es una estrategia de negociación cuantitativa que utiliza el RSI rápido y el RSI lento para generar señales de negociación al mismo tiempo. La estrategia crea señales de negociación mediante la ruptura rápida y lenta entre dos indicadores RSI, lo que permite seguir la tendencia del mercado.
La estrategia utiliza dos indicadores RSI al mismo tiempo, un RSI rápido con un ciclo de 2 y un RSI lento con un ciclo de 14. La señal de negociación de la estrategia proviene de una ruptura entre los dos indicadores RSI.
Cuando el RSI lento es mayor que 50, el RSI rápido es menor que 50, se produce una señal de plus; cuando el RSI lento es menor que 50, el RSI rápido es mayor que 50, se produce una señal de corto. Después de hacer más de corto, si se produce una señal de stop loss ((la columna K de línea roja aparece cuando hay más pérdidas, la columna K de línea verde aparece cuando hay pérdidas en blanco), se detiene la posición).
La estrategia también puede ser optimizada en los siguientes aspectos:
La estrategia de ruptura de doble RSI utiliza el indicador RSI rápido y lento para seguir los cambios en la tendencia del mercado, para formar señales de negociación en las zonas de sobreventa y sobreventa, para evitar de manera efectiva el seguimiento de los altos y bajos. Al mismo tiempo, se establece un mecanismo de suspensión de pérdidas para controlar el riesgo. La estrategia es simple de operar, fácil de implementar y adecuada para la negociación cuantitativa.
/*backtest
start: 2024-01-10 00:00:00
end: 2024-01-17 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//Noro
//2018
//@version=2
strategy(title = "Noro's Double RSI Strategy 1.0", shorttitle = "2RSI str 1.0", overlay=true )
//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
leverage = input(1, defval = 1, minval = 1, maxval = 100, title = "leverage")
fast = input(2, defval = 2, minval = 2, maxval = 100, title = "Fast RSI Period")
slow = input(14, defval = 14, minval = 2, maxval = 100, title = "Slow RSI Period")
fromyear = input(2018, defval = 2018, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")
//Fast RSI
fastup = rma(max(change(close), 0), fast)
fastdown = rma(-min(change(close), 0), fast)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))
//Slow RSI
slowup = rma(max(change(close), 0), slow)
slowdown = rma(-min(change(close), 0), slow)
slowrsi = slowdown == 0 ? 100 : slowup == 0 ? 0 : 100 - (100 / (1 + slowup / slowdown))
//Signals
up = slowrsi > 50 and fastrsi < 50
dn = slowrsi < 50 and fastrsi > 50
exit = (strategy.position_size > 0 and close > open) or (strategy.position_size < 0 and close < open)
lot = strategy.position_size == 0 ? strategy.equity / close * leverage : lot[1]
//Trading
if up
if strategy.position_size < 0
strategy.close_all()
strategy.entry("Long", strategy.long, needlong == false ? 0 : lot )
if dn
if strategy.position_size > 0
strategy.close_all()
strategy.entry("Short", strategy.short, needshort == false ? 0 : lot )
if exit
strategy.close_all()