OPEN-SOURCE SCRIPT

Trading bot grids

124
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.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。