Announcement

Collapse
No announcement yet.

drawTextRelative

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

  • drawTextRelative

    Can somebody please explain the meaning, and purpose of the "TagName" parameter at the end of the "drawTextRelative" function?

    Call me dense, but I have been banging my head against the wall trying to figure out why my efs is only drawing the last buy and last sell signals of the study on the chart, rather than each one at the point of occurance. I finally figured out, through review of other studies and my own trial and error, that for some reason (undocumented) the "TagName" must include the "getValue()" function. Will somebody please explain this?
    Be the diner, not the dinner.

  • #2
    TagName is supposed to be an identifier for your line. It allows you to move, or delete your line after you have drawn it.

    I would not suggest using getValue(), but instead, use a global counter variable if you never want to erase your lines.

    var lineCount = 0;

    function preMain() {
    ...
    }

    function main() {
    ...
    drawWhateverRelative(........,..,.,.,., lineCount++);
    ...
    }

    This will increment the 'lineCount' variable by 1 everytime you call drawWhateverRelative().

    Comment


    • #3
      I too have seen formula's that use just the return from getInterval() or getValue() to create labels. Unless this is getValue("Time") or getValue("rawtime") this is a mistake, as there is no way to know if the return will be unique.

      I typically do something similar to what Dion suggests.
      Garth

      Comment

      Working...
      X