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.
הערות שחרור
v2ספריית Pine
ברוח האמיתית של TradingView, המחבר לפרסם את הקוד של Pine הזה כספרייה בקוד פתוח, כך שמתכנתים אחרים בקהילתנו יעשו שימוש חוזר. כל הכבוד למחבר! ניתן להשתמש בספרייה הזו באופן פרטי או בומים בקוד פתוח, אך השימוש בחוזר בקוד הזה בפרסומים כפוף ל-כללי הבית.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
ספריית Pine
ברוח האמיתית של TradingView, המחבר לפרסם את הקוד של Pine הזה כספרייה בקוד פתוח, כך שמתכנתים אחרים בקהילתנו יעשו שימוש חוזר. כל הכבוד למחבר! ניתן להשתמש בספרייה הזו באופן פרטי או בומים בקוד פתוח, אך השימוש בחוזר בקוד הזה בפרסומים כפוף ל-כללי הבית.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.