The historical OHLC bar doesn't include the tick sequence information that led to the creation of the highs and lows.
Therefore historical OHLC values may need different efs code handling than their realtime counterparts, especially when developing strategies that need to react to prices before the close of the bar.
I'm using the following method, any comments appreciated:
var vRealTime = false;
function main() {
var vBarState = getBarState();
if (vRealTime == false && vBarState == BARSTATE_CURRENTBAR) vRealTime = true;
if (vRealTime == true) {
... code for realtime bars
}
else {
... code for historical bars
}
return;
}
Therefore historical OHLC values may need different efs code handling than their realtime counterparts, especially when developing strategies that need to react to prices before the close of the bar.
I'm using the following method, any comments appreciated:
var vRealTime = false;
function main() {
var vBarState = getBarState();
if (vRealTime == false && vBarState == BARSTATE_CURRENTBAR) vRealTime = true;
if (vRealTime == true) {
... code for realtime bars
}
else {
... code for historical bars
}
return;
}
Comment