Editors' picks
OPEN-SOURCE SCRIPT
Updated

BIN Based Support and Resistance [SS]

14 381
This indicator presents a version of an alternative way to determine support and resistance, using a method called "Bins".

Bins provide for a flexible and interesting way to determine support and resistance levels.

First off, let's discuss BINS:

Bins are ranges or containers into which your data points can be sorted. For example, if you're grouping ages, you might have bins like 0–18, 19–35, 36–50, and 51+. Any data point within these intervals gets placed in the corresponding bin.

Binning simplifies complex data sets by grouping values into categories. This is useful for such things as

  • Visualizing data in histograms or bar charts.
  • Reducing noise and highlighting trends.


This indicator groups the price action into 10 separate bins. It determines the Support / Resistance level by averaging the values in the Bins to find an iteration of the "central tendency" or average reoccurring value.

Pros and Cons
Since this is a different approach to support and resistance, I think its important to highlight some of the pros and advantages, but also be open about the cons.

First off the PROS

  • Bin Based Support and Resistance Levels dynamically adjust to ranges as opposed to hard / fast peaks and valleys. This makes them better at analyzing price action vs simply drawing lines at random peaks and valleys.

  • Because Bins are analyzing ALL PA within a period's max and min range, Bin Support and Resistance can actually be used similar to Volume profile, where you are able to identify a pseudo-POC, or areas where price tends to consolidate. Take a look at this example on SPY:
    snapshot

    You can see these 2 SR lines are close together. This represents that this general price range is an area where price likes to accumulate/consolidate. You can see the SPY ended up coming back to this range and consolidating there for a bit.
    This is a strength of using a BIN based approach to calculating support and resistance, because as indicated before, it looks at price action vs peaks and valleys.
    As a tip, these areas are areas you want to wait for a break in one direction or the other.

  • The indicator provides for backtest results of the support and resistance lines, to see how many times certain areas acted as resistance or support. Because this is analyzing and distributing PA evenly throughout the period's max and min, the indicator can tell you which areas tend to have higher rejection zones and which have higher support zones.
     


Now the CONS

  • Because bin based SR take an average approach, the SR lines can sometimes be slightly broken before the ticker finds rejection:
    snapshot

    To combat this, make sure there is confirmed support. How the indicator actually backtests these lines is by waiting to see if the ticker has 3 consecutive closes above the support line or below the resistance line. So these are things to be mindful of.

  • It doesn't consider pivots. Most support and resistance indicators either identify max and min peaks and valleys or use pivot points. Pivot points are a great way to identify peaks and valleys and thus by extension support and resistance. However, this is also somewhat of a strength, as using BINS forces the indicator to consider ALL price action and not just the extremes (highs and lows).

  • Can be slightly skewed in highly volatile environments. Any time there is a massive drop or rally, it can skew the indicator to give extreme ranges to both ends. For example, the Tariff news collapse on ES1!:
    snapshot
  • Owning to limitations in lookback length, sometimes the min and max range can be exceeded and other traditional areas of support / resistance is where a ticker will find support.



Using the indicator

Here are some basic use/functionalities of the indicator:

  • Selecting display of backtest results: You can select to have the backtest results shown in a table:
    snapshot

    Or directly on the lines:
    snapshot

    Inversely, you can toggle them off completely:
    snapshot
  • You can modify the lookback length. The suggested lookback length is between 250 to 500 candles on smaller timeframes. I also suggest 252 on daily timeframes (which represents 1 trading year).




And that's the indicator!
It is very easy to use, so you should pick it up in no time!

Enjoy and as always, 🚀🚀 safe trades! 🚀🚀
Release Notes
Update, fix chart issue and added offset ability per user request.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.