The Bull Market Buy Dips strategy aims to buy the dips in bull market by utilizing RSI indicator and confirm the trend by double moving averages. When the price gets back to the uptrend, the moving averages crossover is used as profit taking signal.
The strategy first sets the backtesting start and end date, then configures the parameters for RSI and fast/slow moving averages.
The strategy signal logic is:
When RSI drops below the threshold (default 35), it triggers buy signal as it indicates oversold area.
The fast MA needs to be above slow MA, which confirms the current uptrend and avoids buying in consolidation.
When price goes above fast MA and fast MA is above medium MA, it triggers close signal to take profit.
The reasonable application of RSI and MA crossover principles helps catch pullback opportunities in bull market and take profits once the price resumes trend.
RSI is very suitable for catching reversal points. Buying when RSI enters oversold area allows accurately locking oversold opportunities. Using MAs to determine the trend can filter ranging market and prevent repeated buying in consolidation. Finally, the MA crossover confirms the trend again for timely taking profit and avoiding pullback loss.
If RSI parameter is set too wide or too narrow, it may lose the accuracy in judging oversold levels. Wrongly chosen fast or slow MA periods could also lead to false trend determination. If profit taking timing is improper, too early may miss further profits while too late may sacrifice gained profits.
Parameters of RSI can be optimized, suitable MA periods can be selected, and different profit taking mechanisms can be tested to improve profit taking performance.
Different RSI periods can be tested to optimize oversold area judgment. Different MA period combinations can be tried to find the best parameters for trend determination. Other profit taking mechanisms like trailing stop, resistance stop can also be tested. Optimizing position sizing can better control risks. Finally, considering trading costs can make the strategy closer to live trading.
The Bull Market Buy Dips strategy has clear and sensible logic overall, skillfully utilizes RSI and MA principles to capture buying and profit taking timing in trending market. Through parameter optimization, profit taking tests and position sizing management, the robustness and real trading performance can be further enhanced. With simple and practical idea, this strategy is suitable for catching pullbacks in bull market and can bring decent profits to the portfolio.
/*backtest start: 2023-10-02 00:00:00 end: 2023-11-01 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=4 strategy(shorttitle='Buy The Dips in Bull Market',title='Buy The Dips in Bull Market (by Coinrule)', overlay=true, initial_capital = 1000, default_qty_type = strategy.percent_of_equity, 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") fromDay = input(defval = 10, title = "From Day") fromYear = input(defval = 2020, title = "From Year") thruMonth = input(defval = 1, title = "Thru Month") thruDay = input(defval = 1, title = "Thru Day") thruYear = input(defval = 2112, title = "Thru Year") showDate = input(defval = true, title = "Show Date Range") start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window window() => time >= start and time <= finish ? true : false // create function "within window of time" // RSI inputs and calculations lengthRSI = input(14, title = 'RSI period', minval=1) RSI = rsi(close, lengthRSI) //MA inputs and calculations inSignal=input(9, title='MAfast') inlong1=input(50, title='MAslow') inlong2=input(200, title='MAslow') MAfast= sma(close, inSignal) MAslow= sma(close, inlong1) MAlong= sma(close, inlong2) RSI_buy_signal= input(35, title='RSI Buy Signal') //Entry strategy.entry(id="long", long = true, when = RSI < RSI_buy_signal and MAlong < MAslow and window()) //Exit strategy.close("long", when = close > MAfast and MAfast > MAslow and window()) plot(MAslow, color=color.orange, linewidth=1) plot(MAfast, color=color.purple, linewidth=1) plot(MAlong, color=color.blue, linewidth=2)