Announcement

Collapse
No announcement yet.

drawing a study

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

  • drawing a study

    Hi,


    I wrote a function that generates an array after the last bar on the chart is loaded. I want to recalculate it and redraw it at every NEW BAR. But I can not get the past values drawn on the chart. Only the last calculated value is seen via return and the rest is gone.

    Maybe one way is to write it as a separate function and use callfunction but I don't want to have two scripts.

    Any suggestions to this?

    thanks,

  • #2
    I think the solution...

    Is to redeclare the array statement with each new bar. Then recalculate (populate) the array items, then redraw the items.

    I believe I have done this in the past and it works. By re-declaring the array in your code, it essentially dumps the old data and begins anew..

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Hello plucky,

      To change the return values on previous bars, use the setBar() function.

      Make sure that your formula returns an empty container for the values you need to set after the load completes. The setBar() function won't work if there isn't a returned container or array of values for that bar. So, if your formula returns 3 values for each bar, for example, make sure three null values get returned to each bar during the loading process. Assuming that you're not returning any data at that point. This creates the array elements that can then be changed by the setBar() function once you get to bar 0.
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment

      Working...
      X