本策略将RSI指标与价格突破结合,在一定趋势下形成的盘整范围内寻找轮动机会,进而进行短线交易,追求高效率的短线获利。
所以,该策略综合多个维度的判断逻辑,在一定的趋势和突破机会下,利用RSI指标产生的买卖信号进行短线获利的轮动操作。可以有效抓住市场短期的超跌反弹和超买回落的机会。
本策略利用RSI指标判断超买超卖的短期反转机会,同时结合价格突破进行短线获利的轮动操作。特点是追求短期效率,操作简单,风险有限,非常适合短线交易者在特定行情下使用。需要注意判断整体大趋势,并优化参数等,从而获得更好的效果。
/*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())