
This strategy uses the crossover signals of the RSI indicator and two EMA lines to determine buy and sell points. A buy signal is generated when the closing price falls below both EMA100 and EMA20, and the RSI value is below 30. A sell signal is generated when the closing price breaks above both EMA100 and EMA20, and the RSI value is above 70. The main idea of this strategy is to use the RSI indicator to judge overbought and oversold conditions, combined with the trend judgment of EMA lines, in order to capture the low and high points of market fluctuations and perform low-buy and high-sell operations.
The RSI and Dual EMA Crossover Signal Quantitative Strategy is a simple and practical quantitative trading strategy. By combining the RSI indicator with EMA moving averages, it can better capture the highs and lows in a fluctuating market and conduct arbitrage. However, this strategy also has some limitations and risks, such as failure in trend markets, lack of position management and risk control measures, etc. Therefore, in practical application, it needs to be appropriately optimized and improved according to market characteristics and personal preferences to improve the robustness and profitability of the strategy. This strategy can be used as an entry-level strategy for quantitative trading to learn and use, but it needs to be treated with caution and risk must be strictly controlled.
/*backtest
start: 2024-03-01 00:00:00
end: 2024-03-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("RSI-EMA100&20 Buy/Sell Signal", overlay=true)
// Input parameters
rsiLength = input.int(14, "RSI Length")
emaCloseLength = input.int(100, "EMA Length (Closing Price)")
emaLowLength = input.int(20, "EMA Length (Low Price)")
oversoldLevel = input.int(30, "Oversold Level")
overboughtLevel = input.int(70, "Overbought Level")
// Calculate RSI
rsi = ta.rsi(close, rsiLength)
// Calculate EMA of closing price
emaClose = ta.ema(close, emaCloseLength)
// Calculate EMA of low price
emaLow = ta.ema(low, emaLowLength)
// Determine overbought and oversold conditions
isOversold = rsi <= oversoldLevel
isOverbought = rsi >= overboughtLevel
// Plot RSI and its EMAs
plot(rsi, color=color.blue, title="RSI")
plot(emaClose, color=color.green, title="EMA 100 (Closing Price)")
plot(emaLow, color=color.orange, title="EMA 20 (Low Price)")
// Strategy entry condition: Closing price is below both EMAs and RSI is less than or equal to oversold level
buySignal = close < emaClose and close < emaLow and isOversold
// Plot buy signals
plotshape(series=buySignal, style=shape.triangleup, location=location.abovebar, color=color.green, size=size.small)
// Strategy entry
if (buySignal)
strategy.entry("Buy", strategy.long)
// Strategy exit condition: Price crosses above both EMAs and RSI is greater than or equal to overbought level
sellSignal = close > emaClose and close > emaLow and isOverbought
// Plot sell signals
plotshape(series=sellSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// Strategy exit
if (sellSignal)
strategy.entry("Sell", strategy.short)
// Plot sell signals
plotshape(series=sellSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
// Strategy exit
if (sellSignal)
strategy.entry("Sell", strategy.short)