This strategy uses two moving averages (a fast moving average and a slow moving average) and the Relative Strength Index (RSI) to identify short-term market trends and overbought/oversold conditions. When the fast moving average crosses above the slow moving average and the RSI is below the oversold level, the strategy enters a long position. When the fast moving average crosses below the slow moving average and the RSI is above the overbought level, the strategy enters a short position. The strategy determines entry and exit points based on the crossover of the moving averages and RSI levels to capture short-term price trends.
This strategy combines dual moving averages and the RSI indicator to capture short-term price trends, making it suitable for short-term trading in volatile markets. The strategy logic is clear, parameters are flexible, and it is easy to implement and optimize. However, it may generate excessive trading signals in choppy markets and has a weak ability to capture long-term trends. Therefore, in practical applications, consider introducing additional indicators, optimizing parameter selection, implementing risk management measures, and other approaches to improve the strategy’s robustness and profitability.
/*backtest start: 2024-03-24 00:00:00 end: 2024-03-25 05:00:00 period: 1m basePeriod: 1m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Short-Term Scalp Trading Strategy", overlay=true) // Define strategy parameters fastMA_length = input(5, title="Fast MA Length") slowMA_length = input(10, title="Slow MA Length") rsi_length = input(7, title="RSI Length") rsi_oversold = input(20, title="RSI Oversold Level") rsi_overbought = input(80, title="RSI Overbought Level") // Calculate Moving Averages fastMA = ta.sma(close, fastMA_length) slowMA = ta.sma(close, slowMA_length) // Calculate RSI rsi = ta.rsi(close, rsi_length) // Define entry conditions longCondition = ta.crossunder(fastMA, slowMA) and rsi < rsi_oversold shortCondition = ta.crossover(fastMA, slowMA) and rsi > rsi_overbought // Enter long position strategy.entry("Long", strategy.long, when=longCondition) // Enter short position strategy.entry("Short", strategy.short, when=shortCondition) // Define exit conditions longExitCondition = ta.crossunder(fastMA, slowMA) or ta.crossover(rsi, rsi_overbought) shortExitCondition = ta.crossover(fastMA, slowMA) or ta.crossunder(rsi, rsi_oversold) // Exit long position if (longExitCondition) strategy.close("Exit Long", "Long") // Exit short position if (shortExitCondition) strategy.close("Exit Short", "Short") // Plot buy and sell signals plotshape(series=longCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small) plotshape(series=shortCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)