Hi,
Welcome to my 4th script.
Someone asked me some questions about the Bollinger Band strategy I previously published. When I went back to my published script I couldn't help myself but simply try and make it better. Which I did.
Since I've published that script, I've gained much more knowledge about how Pinescript functions. As well as gaining more and more knowledge about how the markets are structered etc.
In this reversal script we use 4 indicators to determine good entry signals, we determine whether the market is ranging or trending and we still only want to take trades in the direction of the "trend".
Bollinger Bands are used for our entry signal. When price hits either side of the band, we wait for a reverse candlestick before we enter a position.
RSI is used to determine if we're in a trending market or in a ranging market. You can adjust the values in the inputs. You can determine the minimum RSI value and the maximum RSI value.
ADX is used the same way as RSI, you can adjust the value in the inputs. You can determine the minimum ADX value.
Last but not least we use two EMA's, a 200 EMA and 100 EMA. Both are adjustable through the inputs. I used two EMA's because I noticed when using this strategy that we'd enter a new position often after having a bad trade. Using two EMA's might clean up some signals, in my case with EUR/USD on a 15m timeframe, it didn't clean up enough signals.
All the default values are pretty decent but might require some finetuning on a certain instrument. Don't overfit the strategy though, that'll only give you bad signals in the future.
Then we are off to our exit signals.
Initially I wanted to incorporate my previous Bollinger Band exit signals as well, but it was too much of a hassle to make the script work as intended so I left it out. If you want to use those exit signals, just find my other script.
When we're in a position and price crosses the opposite band, we wait for a reverse candlestick before we exit the position.
Additionally we want our losses to be as small as possible, so we use RSI to signal us when the market is, or starts to, trend against us. This is where you use the minimum and maximum exit values. So when RSI crosses over or under that value, it'll exit the position.
Furthermore, we use the ATR indicator to set our stop loss, which is pretty basic stuff. You can adjust the ATR multiplier in the inputs. Disabling "Use Trailing Stop?" is really inadvisable unless you know this script inside out as your only exit signals will be opposite Bollinger Band Cross and RSI overbought / oversold areas.