It appears this function returns different values for the current bar depending on the interval. Is this true? I am getting a value of 0 for daily bars and -1 for intraday bars.
Announcement
Collapse
No announcement yet.
getCurrentBarIndex() Question
Collapse
X
-
Hello pa-kay,
If you use setComputeOnClose(true) in your formula, it won't execute on bar 0. That's why you are seeing -1 returned by the getCurrentBarIndex() function. Your formula is being told to wait until the bar closes, before executing your formula. At that time it's bar index becomes -1. Bar 0 is present and updating at that same instance but the setComputeOnClose(true) setting prevents your formula from executing on bar 0. Hope this helps.Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
Comment
-
Actually, what I am seeing is a different execution (or calculation) if the script is run using intraday bars or not. Intraday charts behave as you describe, but daily charts will recognize and calculate on bar 0. At least, the getCurrentBarIndex() command will return a 0 when using daily bars and setComputeOnClose(true). This isn't such a big deal for running my script, except that I wasn't aware of it before now.pa-kay
Comment
Comment