OPEN-SOURCE SCRIPT

Auto Support & Resistance With Wick Signals & Percentage Gaps

Updated
This auto support and resistance indicator uses percentage deviations from the previous session close to calculate levels. It provides arrows as signals when it detects 2 wicks in the last 5 bars from a support or resistance level. Includes alerts for price crossing any level as well as real time percentage gaps from current price to the next closest support and resistance level. You also have the option to set up to 3 major levels of your own for any levels that are very important on longer timeframes that you want included. Those will show on the chart as well as within your percentage gap table with color coded background. All features can be customized or turned off to suit your preferences.

SOURCE
This indicator uses the previous session close as a source by default but can be adjusted to use the previous session high or the previous session low. I find the close setting to provide the most accurate levels.

SESSION
The default setting for the previous session used is the daily session but can be adjusted to use the daily, weekly, monthly, quarterly or yearly session. Use longer sessions when looking at longer time frame charts.

SIGNALS
The signals by default are set to only show an arrow if there have been 2 bullish or bearish wicks off of a support or resistance level in the last 5 bars. This can be changed to one bullish wick off of support and one bearish wick off of resistance or it can be set to give a signal anytime a bar crosses a support or resistance level. This can be controlled in the indicator settings.

PERCENTAGE DEVIATION LEVELS
The default percentage deviation is set to 1% but can and should be adjusted according to whatever ticker you are using. For example use .25% or .5% when looking at forex intraday charts since they are not as volatile as other markets. For leveraged etfs used 1% multiplied by the leverage on the etf, so for SQQQ use 3% as it is a 3x leveraged etf. When looking at longer timeframes or highly volatile charts, set the percentage deviation to 2%, 5%, 10%, etc.

LINE COLORS
The color of the lines will change from red to green depending on if the price is above or below that level. You can customize these colors in the settings.

MAJOR LEVELS
If you have major levels of support and resistance from longer timeframes and your own charting, you can add up to 3 major levels that will show on the chart as well as show the percentage gaps in the table. The label for each major level will be colored to match the color of the line on the chart individually.

PERCENTAGE GAP TABLE
The gap table will update live with percentages to go from current price to the next closest support and resistance levels so you don’t have to calculate them manually. The position of the percentage gap table can also be changed within the indicator settings.

TURN FEATURES ON/OFF
There are 3 toggle switches so you can easily turn on or off certain features such as: the support and resistance lines, the percentage gaps table and the arrow signals.

LINE WIDTHS
You can also set the line width of all levels and the line width of the starting level within the indicator settings.

***MARKETS***
This indicator can be used as a signal on all markets, including stocks, crypto, futures and forex.

***TIMEFRAMES***
This automatic support and resistance indicator can be used on all timeframes as long as there is enough data for the session used.

***TIPS***
Try using numerous indicators of ours on your chart so you can instantly see the bullish or bearish trend of multiple indicators in real time without having to analyze the data. Some of our favorites are our Volume Spike Scanner, Volume Profile, Momentum and Trend Friend in combination with this auto support and resistance indicator. They all have real time Bullish and Bearish labels as well so you can immediately understand each indicator's trend.
Release Notes
Added a new signal parameter for when any wick touches a support/resistance level, no matter if the candle is green or red.
Added lines for the previous high and low because they are important levels.
Added new rows to the percentage gap label that tell you whether price is above or below the previous high, low and close to give you an idea of the current session trend.
Added ability to change the text color in the percentage gaps table so users that want white s&r lines can still read the text.
Release Notes
With the new features just added I strongly recommend you try adding 2 of these to your chart with one set to Previous Close as the source and one set to Session Open as the source. Both should have the same percentage deviation. By doing this, you will get support and resistance "Zones" that are amazing. This only makes a difference for Stocks or trading pairs that the markets aren't open 24/7 so keep that in mind.

New Features:
Added session open as a yellow line and session close as an orange line.
Added wick signals for open, close, high and low lines.
Added alert conditions and removed generic alerts. Now you can choose to get alerts for bullish, bearish and touch wick signals, based on which setting you choose for wick signals.
Added label to notify user whether price is above or below session open price.
Removed starting level line, as it will be one of the open, close, high or low lines already.
Removed Major Level 2 & 3 because there is a limit to the amount of plots you can use and this script is maxed out with the open and close lines included. So, instead of removing auto S&R levels, I removed 2 major levels.
Release Notes
Added an average price zone(orange). This will show the average price range for the current session. See explanation below.
Added a control zone(aqua blue). This will show the previous session average price range on the current session. See explanation below.
Added current session high and low lines.
Added current and previous session open lines.
Added ability to move the lines up or down on the chart for those highly volatile days where the deviations don't reach current price action.
Added more support and resistance lines to the chart. There are now 22 support levels and 22 resistance levels.
Switched default setting to current session open instead of previous session close.

In order to be able to add these extra zones and levels, I had to remove the color input variables as those create 2 plots instead of one and was maxing out the pine script limitations. All color settings will now have to be controlled from the indicator settings style tab. There is no more dynamic line coloring due to this limitation. I made this decision because extra levels seemed more important than dynamic line colors.

The average zone(orange) will update in real time when the chart is open, but will show flat lines with historical data so keep that in mind. This zone will act as dynamic support and resistance and will change throughout the session.

The control zone(aqua blue) is the previous sessions average price zone and typically will determine how the market moves for the current session. If price bounces up from the control zone, you can expect it to continue and vice versa. If price breaks through the control zone, you can expect continuation at an accelerated rate. Take a look at historic data and you'll see how well price reacts to it. The reason price reacts so well to this zone is because traders and algos are covering their positions from the previous session. This zone is an excellent place for entries and many times marks the top or bottom of the session.
autosupportresistanceresistancezonesStandard DeviationsupportSupport and ResistancesupportandresistancezonessupportresistancetradersupportzonesVolatility

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Trend Friend - Data Driven Trading Indicators For All Your Favorite Markets

Get Our Premium Indicator Suite -> friendofthetrend.com/

Join Our Trading Group - facebook.com/groups/stockandcryptotradingstrategies
Also on:

Disclaimer