I'm seeing a behaviour that I can't quite explain and have so far not been able to remove...
As I understand it, when a TagID is associated with a drawTextRelative, it will depend on whether the Tag is unique (ie contains a contextual reference eg BarIndex) or generic (ie 'My Tag') to how EFS handles single, or multiple instances of the drawText function.
In my code I'm only expecting the latest bar to draw, so a generic Tag will ensure that each time the function is called, the same drawText object is rerendered. What I am observing is more like a ghost (see attached screen shot) in the BARSTATE_CURRENTBAR routine when the text box is being drawn.
This is a very simple adaptation of the BarStates.efs within eSignal formulas folder.
Has anyone else experienced this, or have any suggestions one what I need to manipulate within the code so that this behaviour isn't present?
As I understand it, when a TagID is associated with a drawTextRelative, it will depend on whether the Tag is unique (ie contains a contextual reference eg BarIndex) or generic (ie 'My Tag') to how EFS handles single, or multiple instances of the drawText function.
In my code I'm only expecting the latest bar to draw, so a generic Tag will ensure that each time the function is called, the same drawText object is rerendered. What I am observing is more like a ghost (see attached screen shot) in the BARSTATE_CURRENTBAR routine when the text box is being drawn.
This is a very simple adaptation of the BarStates.efs within eSignal formulas folder.
PHP Code:
function preMain() {
setPriceStudy(true);
setStudyTitle("Bar States");
setShowCursorLabel(false);
}
function main() {
var nState = getBarState();
if (nState == BARSTATE_NEWBAR) {
drawTextRelative(-1, high(-1)+0.5, "NEWBAR "+open(0), Color.blue, null, Text.BOLD|Text.BOTTOM|Text.FRAME, null, 12, 'NewBar');
}
if (nState == BARSTATE_CURRENTBAR) {
drawTextRelative(0, low(0)-0.5, "O: "+open(0)+" H: "+high(0)+" C: "+close(0), Color.red, null, Text.BOLD|Text.TOP|Text.FRAME, null, 12),'CurrentBar';
setPriceBarColor(Color.black)
}
return;
}
Comment