OPEN-SOURCE SCRIPT

Groupings [SS]

Hey everyone,

Releasing this indicator called groupings.
If you watch/read my analyses on Tradingview, you will have heard me talk about groups. Groups is something I invented. What it is, is just taking the Euclidean Distance (ED) of the previous 5 candles in a specified period (i.e. daily timeframe, weekly, 1 minute, 5 minute, etc.) and rounding the ED up to a whole number.

I have had great success in this approach because the information provided is broad enough to give leniency in interpretation but narrow enough to hone in on potential moves and target prices.

This indicator is a simplified version of how I do groupings in other software, however it is no less powerful!

What do groups tell us?

A "group" takes into account the previous 5 candles, using the ED. This gives Pinescript a general idea of what the short term trend looks like mathematically. From there, Pinescript can look for other groups that looked similar to how this current trend looks. From there, it can offer us insights into what tends to happen in candles subsequent to this group. For example, the ATR range, the close range and whether it is bearish or bullish.

And that is precisely how this indicator operates, Pinescript will calculate the group of the previous 5 canndles in the timeframe period you are looking at. It will then lookback over the designated "train" length and identify previous groups, and what happened in those groups. It looks specifically at:

- What is that average High ATR associated with that group,
- What is the average Low ATR associated with that group,
- What is the average close range associated with that group,
- What is the sentiment associated with that group.


How to use the indicator?

In terms of use, the indicator is relatively simple to use. It will plot three lines, a red for the anticipated low range, a green for the anticipated high range and purple for the opening range (where the current candle opened at).

snapshot

In addition, it will plot a dot for the anticipated close area. When the dot is green, it expects a bullish close. When the dot is red, it expects a bearish close.
The indicator is going to give you a heads up as to whether we are in a bullish group, what you can anticipate the high and low range to be and where you can anticipate the close.
Of course, its not always exact, as in the image above you can see it underestimated the high range and over-estimated the low range; however, we did close within the anticipate range.
The indicator is meant to help you with your bias. I will reference this indicator on the daily timeframe at open to see what the expectations are for the day.

However, you can use it on any timeframe you wish.

Other functions:

The indicator can plot the EMA 9, 21 and 5. These are the 3 indicators I like and I find them helpful for both intraday and swing trading. However, they can be toggled off if you do not wish to view them.

In addition, the EMAs will be green if the ticker is trending above the EMA 21 (which is a critical EMA for me to determine the immediate sentiment). If the ticker is below, they will turn red.
There is also the ability to adjust the train time. The default is 1,000 candles back, but I usually have it on 1500. If you have a lot of indicators and a lot going on, on your chart, you may find that 1500 is too much and it will lag/error. That’s okay, 500 candles is sufficient and will not put a lot of stress on Pinescript.

Concluding remarks

Its overall a fairly simple concept and indicator, but it has been a neat and helpful / insightful invention. I originally developed this using R and happy to have now brought it into Pinescript.
I hope you enjoy!

Safe trades everyone!
sentimentstatisticsTrend Analysis

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?


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

Disclaimer