The queue function method used is adapted from an example provided on the PineCoders website, much gratitude to LucF for this gem!
To prevent grid lines out of range from causing chart to rescale right click on chart's price column and enable Scale Price Chart Only.
Pictured example above is using Type Of Increment: Steps By Pivot, Number Of Steps: 5.
Pictured example below is using Type Of Increment: Steps By Price, Number Of Steps: 6, Starts From Price: $10k, Steps By Percent Or Price: $10k.
Pictured example below is using Type Of Increment: Steps By Percent, Number Of Steps: 7, Starts From Price: $10k, Steps By Percent Or Price: 33%.
NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
Enabled adjustable transparency for grid lines.
Added ability to specify number of bars to the left and right of pivot. Reducing number of bars to the right of pivot increases responsiveness.
Made the following cosmetic changes to default line style: Dotted Yellow.
Cosmetic change, added padding for better alignment.
Added option Pivot Higher Timeframe.
Added adjustable line width and changed default color to Gray for better viewing compatibility with both Dark & Light themes.
Added option Grid Lines Extend, setting this option to Right allows the age of each Pivot to be seen as shown in pictured example below.
Improved alignment when using Grid Lines Extend: Right with higher timeframe pivots. Added option to show price labels as shown in pictured example below.
Updated for Pine Script™ v5.
Added option Direction To Step Towards: "Both" which allows for stepping in both directions when using Steps by Percent or Steps by Price.
If you wish to buy me a refreshing beverage :)...
LTC (preferred): LTDaAe7nPzbpBhZVT9o5f9f8M3aZSPa46Y
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 a publication is governed by House Rules. You can favorite it to use it on a chart.