PINE LIBRARY
已更新 libScheduler

TLDR: This is a lightweight, easy-to-use way to throttle sections of Pinescript v6 scripts, the same as you'd use barstate.isconfirmed or barstate.islast. You can use this for enormous efficiency gains, provided you design your script to handle updates on differing intervals rather than computing everything on each cycle. Usage is easy:
```
import showmethegrail/libScheduler/1 as libScheduler
i_tf_fetch = input.enum(libScheduler.Timeframes.C, "Fetch Interval",
tooltip="Do things just once every interval, default=once per chart timeframe.")
var scheduler = libScheduler.Scheduler.new().init()
if scheduler.every(i_tf_fetch)
// Do stuff
```
That's it. If you need to know more, the code is well-commented.
Combine this with sensible caching, and you can right-size the compute-heavy sections of your script, for better stability and managed use of Pinescript compute quotas. You'll need to know the proper use of var and varip to make the most of this, but I found this effectively replaced a lot of boilerplate in throttling my own scripts.
Sound software engineering, made Pinescript-level easy. That's all.
```
import showmethegrail/libScheduler/1 as libScheduler
i_tf_fetch = input.enum(libScheduler.Timeframes.C, "Fetch Interval",
tooltip="Do things just once every interval, default=once per chart timeframe.")
var scheduler = libScheduler.Scheduler.new().init()
if scheduler.every(i_tf_fetch)
// Do stuff
```
That's it. If you need to know more, the code is well-commented.
Combine this with sensible caching, and you can right-size the compute-heavy sections of your script, for better stability and managed use of Pinescript compute quotas. You'll need to know the proper use of var and varip to make the most of this, but I found this effectively replaced a lot of boilerplate in throttling my own scripts.
Sound software engineering, made Pinescript-level easy. That's all.
發行說明
v2Pine腳本庫
秉持TradingView一貫精神,作者已將此Pine代碼以開源函式庫形式發佈,方便我們社群中的其他Pine程式設計師重複使用。向作者致敬!您可以在私人專案或其他開源發表中使用此函式庫,但在公開發表中重用此代碼須遵守社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
Pine腳本庫
秉持TradingView一貫精神,作者已將此Pine代碼以開源函式庫形式發佈,方便我們社群中的其他Pine程式設計師重複使用。向作者致敬!您可以在私人專案或其他開源發表中使用此函式庫,但在公開發表中重用此代碼須遵守社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。