OPEN-SOURCE SCRIPT

Volume Orderbook (Expo) — safe-indexed

86
基于 Zeiierman 的Volume Orderbook(Expo) 修复了以下bug
Pine Script®
In 'array.get()' function. Index 3 is out of bounds, array size is 3. at #main():75


修复思路:

提供一个索引钳制函数 clampIndex(idx, last),把任何索引限制在 [0, last] 区间内。

所有 array.get() 前都用该函数钳制索引(包括对 levels / volumes 的两端访问,以及 +1 时的上界保护)。

网格线、方框上下边界使用的 levels.get(...) 也统一钳制,避免负值或越界。

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.