OPEN-SOURCE SCRIPT

1% Range Bars with Sequence Table

Overall Logic:
The script is designed to help traders visualize and analyze price movements on the chart, where each 1% movement is highlighted with a corresponding symbol. Additionally, the table helps track and analyze the number and length of consecutive price movements in one direction, which can be useful for identifying trends and understanding market dynamics.

This script can be particularly useful for traders looking for recurring patterns in price movements and wanting to quickly identify significant changes on the chart.

Main elements of the script:
Price Percentage Change:

The script tracks the price movement by 1% from the last significant value (the value at which the last 1% change was recorded).
If the price rises by 1% or more, a green circle is displayed above the bar.
If the price drops by 1% or more, a red circle is displayed below the bar.
Sequence Counting:

The script counts the number of consecutive 1% moves upwards (green circles) and downwards (red circles).
Separate counters are maintained for upward and downward movements, increasing each time the respective movement occurs.
If an opposite movement interrupts the sequence, the counter for the opposite direction is reset.
Sequence Table:

A table displayed on the chart shows the number of sequences of 1% movements in one direction for lengths from 1 to 15 bars.
The table is updated in real-time and shows how many times sequences of a certain length occurred on the chart, where the price moved by 1% in one direction.
Candlestick analysisCycles

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?

Disclaimer