Announcement

Collapse
No announcement yet.

drawTextRelative ghost images

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • drawTextRelative ghost images

    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.

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Bar States");
        
    setShowCursorLabel(false);
    }
    function 
    main() {
        var 
    nState getBarState();
        
        if (
    nState == BARSTATE_NEWBAR) {
                    
    drawTextRelative(-1high(-1)+0.5"NEWBAR "+open(0), Color.bluenullText.BOLD|Text.BOTTOM|Text.FRAMEnull12'NewBar');
        }
        
        if (
    nState == BARSTATE_CURRENTBAR) {
            
    drawTextRelative(0low(0)-0.5"O: "+open(0)+" H: "+high(0)+" C: "+close(0), Color.rednullText.BOLD|Text.TOP|Text.FRAMEnull12),'CurrentBar';
                
    setPriceBarColor(Color.black)
        }    
        return;

    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?
    Attached Files

  • #2
    Kardinal
    What you are seeing is happening because there is no unique tagID in that drawTextRelative(...) function due to the fact that the close parenthesis is placed prior to the 'CurrentBar' string. Change that line of code to the following
    PHP Code:
    drawTextRelative(0low(0)-0.5"O: "+open(0)+" H: "+high(0)+" C: "+close(0), Color.rednullText.BOLD|Text.TOP|Text.FRAMEnull12,'CurrentBar'); 
    and you should see that the function will behave as expected
    Alex

    Comment


    • #3
      Thanks! Such a simple Typo and I normally spot those when things don't work! Must be getting tired...

      Comment


      • #4
        Kardinal
        You are most welcome
        Alex

        Comment

        Working...
        X