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:

快照

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:

快照

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:

快照

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:

快照

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

快照

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:

快照

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:

快照


Plotting Passes and Fails:

快照

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:

快照

And on the larger timeframe:

快照

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:

快照

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:

快照


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

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?


For real-time updates and premium indicators, consider joining my group at: patreon.com/steversteves
更多:

免责声明