
This strategy is called “FNGU Quantitative Trading Strategy Based on Bollinger Bands and RSI”. It is a long-only strategy designed specifically for the FNGU stock. The strategy mainly uses Bollinger Bands and RSI indicators to identify overbought and oversold conditions of the stock to generate buy and sell signals.
The core logic of this strategy is based on the combination of Bollinger Bands and RSI indicators.
Firstly, Bollinger Bands contain three lines: middle line, upper line and lower line. The middle line is the n-day simple moving average, while the upper line and lower line are k times standard deviation above and below the middle line. When price reaches or touches the upper or lower line, it indicates the stock is in overbought or oversold status.
In this strategy, the period length of Bollinger Bands middle line is 235 days, and the parameter k value is 2. It generates buy signals when price falls below the Bollinger lower line or crosses above the middle line, and sell signals when price rises above the Bollinger upper line.
Secondly, RSI indicator reflects the overbought/oversold level of a stock. RSI above 70 suggests overbought status, while below 30 oversold status. The parameter period length for RSI in this strategy is 2.
In this strategy, Bollinger Bands and RSI indicators are used together: Buy signals are generated when RSI breaks through oversold level while price touches or falls below the Bollinger lower line. Sell signals are generated when RSI breaks down from overbought level while price rises above Bollinger upper line.
This strategy has the following advantages:
There are also some risks associated with this strategy:
There are several directions to further optimize this strategy:
This is a long-only strategy particularly suitable for highly volatile stocks such as FNGU. By combining Bollinger Bands and RSI, it generates trading signals around overbought/oversold price levels, aiming to capture price reversal opportunities. There is still large room for optimization to expand its applicability and enhance performance.
/*backtest
start: 2023-12-29 00:00:00
end: 2024-01-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Bollinger + RSI + EMA, Double Strategy Long-Only (by EMKM)", shorttitle="1Min Killer", overlay=true)
///////////// RSI
RSIlength = input(2, title="RSI Period Length") // Adjusted RSI period length
RSIoverSold = 50
RSIoverBought = 50
price = close
vrsi = rsi(price, RSIlength)
///////////// Bollinger Bands
BBlength = input(235, minval=1, title="Bollinger Period Length") // Adjusted Bollinger period length
BBmult = 2
BBbasis = sma(price, BBlength)
BBdev = BBmult * stdev(price, BBlength)
BBupper = BBbasis + BBdev
BBlower = BBbasis - BBdev
BBtarget38 = BBbasis + 0.38 * BBdev // Line at 38% of Bollinger Band width
BBtarget50 = BBbasis + 0.50 * BBdev // Line at 50% of Bollinger Band width
///////////// EMA
emaLength = input(20, title="EMA Period Length")
ema = ema(close, emaLength)
source = close
buyEntry = crossover(source, BBlower) or (close < BBlower and close > BBbasis) or (low < BBlower and close > BBbasis) // Add condition for low touching Bollinger Band
sellEntry = crossunder(source, BBupper)
///////////// Plotting
plot(BBbasis, color=color.aqua, title="Bollinger Bands SMA Basis Line")
plot(BBupper, color=color.silver, title="Bollinger Bands Upper Line")
plot(BBlower, color=color.silver, title="Bollinger Bands Lower Line")
plot(BBtarget38, color=color.blue, linewidth=2, title="SMA at 38% of BB width") // Line at 38%
plot(BBtarget50, color=color.green, linewidth=2, title="SMA at 50% of BB width") // Line at 50%
plot(ema, color=color.orange, title="EMA") // Plot EMA
///////////// RSI + Bollinger Bands Strategy
longCondition = crossover(vrsi, RSIoverSold) and buyEntry
sellCondition = crossunder(vrsi, RSIoverBought) and close > BBupper
close_long = close > BBbasis
close_short = close < BBbasis
if (not na(vrsi))
if longCondition
strategy.entry("Buy", strategy.long, qty=10, stop=BBlower, comment="Buy")
else
strategy.cancel(id="Buy")
if close_long
strategy.close("Buy")
if (sellCondition)
strategy.entry("Sell", strategy.short, qty=10, stop=BBupper, comment="Sell")
else
strategy.cancel(id="Sell")
if close_short
strategy.close("Sell")