Announcement

Collapse
No announcement yet.

drawLineRelative erased despite having unique tag

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

  • drawLineRelative erased despite having unique tag

    Hello,

    I can't figure out why my drawLineRelative commands don't leave a line on the chart in spite of the fact that they have unique tags for that bar...every one of them.


    So (based on a certain criteria) I want to draw several vertical lines, in the future (from present or current bar)...here is my code:

    drawLineRelative(13, high(0)+1000, 14, 0, PS_SOLID, 4, Color.blue, "vertLineTwo2"+rawtime(0)+nBarCounter);
    drawLineRelative(21, high(0)+1000, 22, 0, PS_SOLID, 4, Color.blue, "vertLineTwo3"+rawtime(0)+nBarCounter);
    drawLineRelative(34, high(0)+1000, 35, 0, PS_SOLID, 4, Color.blue, "vertLineTwo4"+rawtime(0)+nBarCounter);
    drawLineRelative(55, high(0)+1000, 56, 0, PS_SOLID, 4, Color.blue, "vertLineTwo5"+rawtime(0)+nBarCounter);


    but what is happening is that the lines are being drawn for the current bar (where my certain criteria are being met) then on the next bar they dissappear. I would like the bars to remain...for the life of this specific chart. Any ideas as to what I'm doing wrong?

    The above lines of code reside in the main fuction nested within a couple of flags to ensure they are called once (for given criteria).

    Any help is much appreciated,

    gg

  • #2
    This is because you are using "BarCounter" as part of your TAG for the line.

    You need to think about how you want to draw and control these line functions.

    I would suggest you try using a simple TAG feature (like "VL1"+BarCounter) and then isolate when and if you are calling the increment of the BarCounter variable.

    Also, you may want to try to control WHEN these draw functions are being called in your script.

    I wish I could help more, but without seeing you entire script, I can just point you to the most common issues.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment

    Working...
    X