OPEN-SOURCE SCRIPT

Support and Resistance Backtester [SS]

Hey everyone,

Excited to release this indicator I have been working on.
I conceptualized it as an idea a while ago and had to nail down the execution part of it. I think I got it to where I am happy with it, so let me tell you about it!

What it does?
This provides the user with the ability to quantify support and resistance levels. There are plenty of back-test strategies for RSI, stochastics, MFI, any type of technical based indicator. However, in terms of day traders and many swing traders, many of the day traders I know personally do not use or rely on things like RSI, stochastics or MFI. They actually just play the support and resistance levels without attention to anything else. However, there are no tools available to these people who want to, in a way, objectively test their identified support and resistance levels.

For me personally, I use support and resistance levels that are mathematically calculated and I am always curious to see which levels:

a) Have the most touches,
b) Have provided the most support,
c) Have provided the most resistance; and,
d) Are most effective as support/resistance.

And, well, this indicator answers all four of those questions for you! It also attempts to provide some way to support and resistance traders to quantify their levels and back-test the reliability and efficacy of those levels.

How to use:

So this indicator provides a lot of functionality and I think its important to break it down part by part. We can do this as we go over the explanation of how to use it. Here is the step by step guide of how to use it, which will also provide you an opportunity to see the options and functionality.

Step 1: Input your support and resistance levels:

snapshot

When we open up the settings menu, we will see the section called "Support and Resistance Levels". Here, you have the ability to input up to 5 support and resistance levels. If you have less, no problem, simply leave the S/R level as 0 and the indicator will automatically omit this from the chart and data inclusion.

Step 2: Identify your threshold value:

snapshot

The threshold parameter extends the range of your support and resistance level by a desired amount. The value you input here should be the value in which you would likely stop out of your position. So, if you are willing to let the stock travel $1 past your support and resistance level, input $1 into this variable. This will extend the range for the assessment and permit the stock to travel +/- your threshold amount before it counts it as a fail or pass.

Step 3: Select your source:

snapshot

The source will tell the indicator what you want to assess. If you want to assess close, it will look at where the ticker closes in relation to your support and resistance levels. If you want to see how the highs and lows behave around the S/R levels, then change the source to High or Low.

It is recommended to leave at close for optimal results and reliability however.

Step 4: Determine your lookback length:

snapshot

The lookback length will be the number of candles you want the indicator to lookback to assess the support and resistance level. This is key to get your backtest results.

The recommendation is on timeframes 1 hour or less, to look back 300 candles.
On the daily, 500 candles is recommended.

Step 5: Plot your levels

snapshot

You will see you have various plot settings available to you. The default settings are to plot your support and resistance levels with labels. This will look as follows:

snapshot

This will plot your basic support and resistance levels for you, so you do not have to manually plot them.

However, if you want to extend the plotted support and resistance level to visually match your threshold values, you can select the "Plot Threshold Limits" option. This will extend your support and resistance areas to match the designated threshold limits.

In this case on MSFT, I have the threshold limit set at $1. When I select "Plot Threshold Limits", this is the result:

snapshot


Plotting Passes and Fails:

snapshot

You will notice at the bottom of the settings menu is an option to plot passes and plot fails. This will identify, via a label overlaid on the chart, where the support and resistance failures and passes resulted. I recommend only selecting one at a time as the screen can get kind of crowded with both on. here is an example on the MSFT chart:

snapshot

And on the larger timeframe:

snapshot

The chart

The chart displays all of the results and counts of your support and resistance results. Some things to pay attention to use the chart are:

a) The general success rate as support vs resistance

Rationale: Support levels may act as resistance more often than they do support or vice versa. Let's take a look at MSFT as an example:

snapshot

The chart above shows the 334.07 level has acted as very strong support. It has been successful as support almost 82% of the time. However, as resistance, it has only been successful 33% of the time. So we could say that 334 is a strong key support level and an area we would be comfortable longing at.

b) The number of touches:

snapshot


Above you will see the number of touches pointed out by the blue arrow.
Rationale: The number of touches differs from support and resistance. It counts how many times and how frequently a ticker approaches your support and/or resistance area and the duration of time spent in that area. Whereas support and resistance is determined by a candle being either above or below a s/r area, then approaching that area and then either failing or bouncing up/down, the number of touches simply assesses the time spent (in candles) around a support or resistance level. This is key to help you identify if a level has frequent touches/consolidation vs other levels and can help you filter out s/r levels that may not have a lot of touches or are infrequently touched.

Closing comments:

So this is pretty much the indicator in a nutshell. Hopefully you find it helpful and useful and enjoy it.

As always let me know your questions/comments and suggestions below.

As always I appreciate all of you who check out, try out and read about my indicators and ideas. I wish you all the safest trades and good luck!









ANDCandlestick analysissrsupportSupport and ResistanceTrend Analysis

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?


For real-time updates and premium indicators, consider joining my group at: patreon.com/steversteves
Também em:

Aviso legal