I need the last tick of the bar.
These do NOT provide that.
At the first tick of the new bar, the information I need is from bar(-1).
Technically, the first tick of a new bar, could be seconds or minutes away from the bar start time.
Do you see why that won't work?
These do NOT provide that.
At the first tick of the new bar, the information I need is from bar(-1).
Technically, the first tick of a new bar, could be seconds or minutes away from the bar start time.
Do you see why that won't work?
Originally posted by SteveH
Don't you just want to use the getBarState() function then so that you can choose which pieces of code in your script get executed according to what state the bar processing is in?
This is from the EFS docs:
Don't you just want to use the getBarState() function then so that you can choose which pieces of code in your script get executed according to what state the bar processing is in?
This is from the EFS docs:
Code:
function main() { var nState; ... ... nState = getBarState(); if (nState == BARSTATE_ALLBARS) { //the bars are being loaded by the script. This happens when a script is first loaded debugPrint("Script is loading\n"); } else if (nState == BARSTATE_NEWBAR) { //this flag is set when a new bar is coming in debugPrint("The first tick of a new bar has arrived\n"); } else if (nState == BARSTATE_CURRENTBAR) { //this flag is set as each new tick comes in debugPrint("A new tick has arrived\n"); } }
Comment