
Según el análisis técnico, el indicador RSI superior a 70 debe representar un estado de sobreventa y, por lo tanto, pertenece a una señal de venta. Las criptomonedas representan una nueva categoría de activos que reinventa el concepto de análisis técnico.
Construir una estrategia de trading de tendencias basado en el RSI, que generalmente se considera un indicador de reversión, parece contraintuitivo. Pero, como lo demuestran más de 200 pruebas retrospectivas, es una estrategia de largo plazo muy interesante.
La estrategia asume el 30% de los fondos disponibles para cada orden de negociación. Se tiene en cuenta una tarifa de transacción del 0.1%, que coincide con la tarifa básica de Binance (la mayor bolsa de criptomonedas del mundo).
Esta estrategia utiliza el indicador RSI para identificar el estado de sobrecompra para determinar la dirección de la tendencia y detener la tendencia ascendente. En comparación con el uso tradicional del RSI a la baja, esta estrategia ofrece una nueva forma de pensar.
/*backtest
start: 2024-01-02 00:00:00
end: 2024-02-01 00:00:00
period: 3h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=1
strategy(shorttitle='Trend-following RSI Scalping Strategy (by Coinrule)',title='Trend-following RSI Strategy ', overlay=true, initial_capital = 1000, default_qty_type = strategy.percent_of_equity, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)
//Backtest dates
fromMonth = input(defval = 1, title = "From Month")
fromDay = input(defval = 10, title = "From Day")
fromYear = input(defval = 2020, title = "From Year")
thruMonth = input(defval = 1, title = "Thru Month")
thruDay = input(defval = 1, title = "Thru Day")
thruYear = input(defval = 2112, title = "Thru Year")
showDate = input(defval = true, title = "Show Date Range")
start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window
finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window
window() => true
// RSI inputs and calculations
lengthRSI = input(14, title = 'RSI period', minval=1)
RSI = rsi(close, lengthRSI)
//Entry
strategy.entry(id="long", long = true, when = RSI > 70 and window())
//Exit
Take_profit= ((input (6))/100)
longTakeProfit = strategy.position_avg_price * (1 + Take_profit)
strategy.close("long", when = RSI < 55 or close > longTakeProfit and window())