When the market is overbought and reverses back down , the previous high usually turns out to become a resistance level. At least it should be a level which will not be overshot for some time. Support-resistance levels might be interesting for an options trader, e.g. if he wants to place a bet on a neutral to bearish market behavior.
Defining Overbought and Oversold
For this sample indicator we willÂ use the RSI as our measure of overbought and oversold. As soon as the indicator leaves one of these areas, the indicator gets active.
But first let’s have a look at the RSI itself. Unfortunately it is a very shaky indicator, and we could expect several crosses above and below the 70/30 lines within a few days. That`s not what we are looking for when programming an useful indicator. It should either signal a cross or not, but not reconsider every day.
To reduce the shakiness of the indicator, the indicator code uses a double exponential smoothing. If you have a look at lines 5 and 7 of the code.
- First the indicator is calculated and the result is stored in the myrsi variable (line 5)
- Then in line 7 this variable is smoothed with an exponential moving average inside an exponential moving average. It looks tricky, but all is done within a line and you will get a smoothed myrsi without adding a lot of lag
Trendy or sideways
Besides the RSI we will use another sub-indicator for our support and resistance indicator, the ADX. This indicator is believed to give an indication if the market is in a trending or sideways phase.
- Usually an ADX level below 25 is regarded as an indication for a sideways market
- A level above 25, regardless if rising or falling, an indication for a trending market
I defined the level to use as an input so you can change it if needed.
One core element of this indicator – and a takeaway of this blog you should remember – is the forward plotting feature. Lines 15 to 17 do the trick: To plot some points into the future, the indicator is doing a loop. The loop will be run period+1 times, using the variable i as counter. And i is also used to forward shift the plot.
Line 16 just draws a symbol at the old high if the RSI crosses above 30 or below 70. The [-i] after the drawsymbol command shifts the drawn symbol into the future. And as i runs from 0 to 14, the points are drawn today, tomorrow, 2 days into the future.
To use the indicator, just drag and drop it on any chart. It can be intraday or show a higher time frame. It will even work with other chart types like Renko and Three-line Break charts. The next step would be to adjust the settings for the RSI period and the ADX level. If you get the right settings, you should see support-resistance lines which are hardly broken.
Tradesignal® is a registered trademark of Tradesignal GmbH. Unauthorized use or misuse is strictly prohibited. Data by Thomson Reuters Eikon.