OPEN-SOURCE SCRIPT
Trading bot grids

Guide: Price Lines – Arithmetic vs. Geometric
This script draws horizontal price lines (grids) between a start price and an end price.
You can choose whether the lines are distributed evenly (arithmetic) or by percentage (geometric).
🔧 Inputs
Start Price → Lower or upper boundary of the price range.
End Price → Opposite boundary of the price range.
Number of Lines → Total number of lines to be drawn between the start and end prices.
Distribution →
Arithmetic: Fixed USDT distance between each line.
Geometric: Fixed percentage distance between each line.
Grid Color → Color of the drawn lines.
📈 How it Works
The script calculates the lower (lo) and upper (hi) boundaries, regardless of which is entered first.
Arithmetic distribution: Each line is spaced by a fixed amount in USDT.
Geometric distribution: Each line is spaced by the same percentage difference from the previous one.
Lines are created only once at the first bar and remain on the chart.
All lines are extended across the entire visible chart.
💡 Tips
Useful for Grid Bot backtesting or visualizing price zones.
Works for both long and short price ranges.
In geometric mode, lines appear closer together near the lower price range and farther apart toward the upper range.
This script draws horizontal price lines (grids) between a start price and an end price.
You can choose whether the lines are distributed evenly (arithmetic) or by percentage (geometric).
🔧 Inputs
Start Price → Lower or upper boundary of the price range.
End Price → Opposite boundary of the price range.
Number of Lines → Total number of lines to be drawn between the start and end prices.
Distribution →
Arithmetic: Fixed USDT distance between each line.
Geometric: Fixed percentage distance between each line.
Grid Color → Color of the drawn lines.
📈 How it Works
The script calculates the lower (lo) and upper (hi) boundaries, regardless of which is entered first.
Arithmetic distribution: Each line is spaced by a fixed amount in USDT.
Geometric distribution: Each line is spaced by the same percentage difference from the previous one.
Lines are created only once at the first bar and remain on the chart.
All lines are extended across the entire visible chart.
💡 Tips
Useful for Grid Bot backtesting or visualizing price zones.
Works for both long and short price ranges.
In geometric mode, lines appear closer together near the lower price range and farther apart toward the upper range.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.