//@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='MAlong')
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)
Expand (52 lines)
Overview
Buy The Dips in Bull Market defines a bull market when the 50-period simple moving average trades above the 200-period moving average. Long entries trigger when the RSI drops below a defined threshold to capture oversold dips. Positions exit when price crosses above the fast 9-period moving average while it trades above the 50-period moving average. Adjustable inputs include RSI periods, moving average lengths, and backtest date limits. The strategy includes no built-in stop loss.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
From Month
int
1
fromMonth
From Day
int
10
fromDay
From Year
int
2020
fromYear
Thru Month
int
1
thruMonth
Thru Day
int
1
thruDay
Thru Year
int
2112
thruYear
Show Date Range
bool
true
showDate
RSI period
int
14
lengthRSI
MAfast
int
9
inSignal
MAslow
int
50
inlong1
MAlong
int
200
inlong2
RSI Buy Signal
int
35
RSI_buy_signal
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This strategy combines a Simple Moving Average (SMA) and the Relative Strength Index (RSI) to generate long trading signals. It enters a long position when price closes above the SMA filter while RSI drops below the oversold threshold. The strategy exits the p
2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the
This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can
Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish
This strategy combines Arnaud Legoux Moving Average percentage price change calculations with an adaptive Gaussian Moving Average to generate trend-following signals. Long and short entries are triggered when the ALMA change calculation crosses above or below
This strategy generates trading signals based on a selectable momentum engine, supporting MACD, RSI, Stochastic, or Rate of Change. Entries trigger on signal crosses, zero-line crosses, or threshold crosses, with an optional moving average trend filter. Risk m