Announcement

Collapse
No announcement yet.

tagID Usage with Drawing tools

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

  • tagID Usage with Drawing tools

    When drawing a shape, I'd like to retain only the last five occurrences of that drawn shape.

    When I draw that shape with a variable or a specific value in the tagID, only the most current existing condition shows that shape. (The chart only has one shape drawn). When I draw that shape using "rawtime" as the tagID, all occurrences are drawn. (The chart may have numerous shapes).

    How do I code the tagID on the drawShape command, in conjunction with the removeShape command, so only the last five occurrences of that drawn shape are retained on the chart? Anything more than 5 should be removed to unclutter the chart.

    Thanks for the assistance. Phil

  • #2
    Re: tagID Usage with Drawing tools

    Phil
    You may be able to accomplish what you want by implementing a solution similar to the one used by Jason in the Heikin-Ashi formula which is posted here
    In that efs he creates a global variable called iCntr which he then increments by 1 at each new bar and limits to a specific number [200 in that specific case] using the following routine
    PHP Code:
    if (nState == BARSTATE_NEWBAR) {
            ...
            
    iCntr += 1;
            if (
    iCntr 200iCntr 0;

    He then uses iCntr as the tagID
    Alex


    Originally posted by pjkowalski
    When drawing a shape, I'd like to retain only the last five occurrences of that drawn shape.

    When I draw that shape with a variable or a specific value in the tagID, only the most current existing condition shows that shape. (The chart only has one shape drawn). When I draw that shape using "rawtime" as the tagID, all occurrences are drawn. (The chart may have numerous shapes).

    How do I code the tagID on the drawShape command, in conjunction with the removeShape command, so only the last five occurrences of that drawn shape are retained on the chart? Anything more than 5 should be removed to unclutter the chart.

    Thanks for the assistance. Phil

    Comment


    • #3
      Thanks for the suggestion. This method does work and will only show the number of shapes that I select.

      However, the arrows only appear as the chart progresses in real time and the conditions are met. For example, when I open a new chart, it will only show the most recent occurrence. The prior 4 occurrences are not shown. Also, in playback mode, only the most recent occurrence is shown. When the condition is met, a new shape is drawn and the prior one is removed.

      Is there a way to show all of the shapes (based on my counter) as soon as the chart opens? And in playback mode?

      Thank you.

      Comment


      • #4
        Phil
        It may depend on how you implemented that example in your code and it is possible that you may need to modify it to adapt it to your script.
        Alex


        Originally posted by pjkowalski
        Thanks for the suggestion. This method does work and will only show the number of shapes that I select.

        However, the arrows only appear as the chart progresses in real time and the conditions are met. For example, when I open a new chart, it will only show the most recent occurrence. The prior 4 occurrences are not shown. Also, in playback mode, only the most recent occurrence is shown. When the condition is met, a new shape is drawn and the prior one is removed.

        Is there a way to show all of the shapes (based on my counter) as soon as the chart opens? And in playback mode?

        Thank you.

        Comment


        • #5
          Thank you for the help. I found an errant statement setting the tagID to zero.

          Comment

          Working...
          X