
Esta estratégia combina o indicador RSI com a quebra de preço para procurar oportunidades de rotação dentro da escalada formada sob uma determinada tendência e, em seguida, executar uma negociação de curto prazo em busca de lucros de curto prazo altamente eficientes.
Portanto, a estratégia integra a lógica de julgamento de várias dimensões e, em determinadas tendências e oportunidades de ruptura, usa os sinais de compra e venda gerados pelo indicador RSI para a operação rotativa de lucro em curto prazo. Pode efetivamente aproveitar as oportunidades de rebote de superavaliação e superavaliação em curto prazo.
Esta estratégia utiliza o indicador RSI para determinar a oportunidade de reversão de curto prazo de sobrecompra e sobrevenda, ao mesmo tempo em que a operação rotativa de lucro de curto prazo em combinação com a quebra de preço. É caracterizada pela busca de eficiência a curto prazo, operação simples, risco limitado, muito adequado para o uso de comerciantes de curto prazo em situações específicas.
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
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/
// © relevantLeader16058
//@version=4
strategy(shorttitle='RSI Classic Strategy',title='RSI Classic Strategy (by Coinrule)', overlay=true, initial_capital = 1000, process_orders_on_close=true, 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", type = input.integer, minval = 1, maxval = 12)
fromDay = input(defval = 1, title = "From Day", type = input.integer, minval = 1, maxval = 31)
fromYear = input(defval = 2020, title = "From Year", type = input.integer, minval = 1970)
thruMonth = input(defval = 1, title = "Thru Month", type = input.integer, minval = 1, maxval = 12)
thruDay = input(defval = 1, title = "Thru Day", type = input.integer, minval = 1, maxval = 31)
thruYear = input(defval = 2112, title = "Thru Year", type = input.integer, minval = 1970)
showDate = input(defval = true, title = "Show Date Range", type = input.bool)
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 = 14
RSI = rsi(close, lengthRSI)
oversold= input(30)
overbought= input(60)
//Entry
strategy.entry(id="long", long = true, when = RSI< oversold and window())
//Exit
//RSI
strategy.close("long", when = RSI > overbought and window())