Announcement

Collapse
No announcement yet.

chart refresh doesnt reload indicator

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

  • chart refresh doesnt reload indicator

    When the chart is in dynamic mode 0 in time templates, when you move the chart it brings down more data and refreshs.

    However it doesnt seem to force a reload of my study. My study place drawText objects on the chart and after the data refresh they are out of place obviously cuase the data changed slightly.

    Is there a way to have the efs study force a reload when the chart data changes?

    [edit]
    I think I may have figured some of this out. YOu see im calling a dll in my script. if i check getBarState() == BARSTATE_ALLBARS instead of using a bInit global I'll know when the script is reloading. Why do all the examples use bInit var when it seems better practice to call getBarState???

    Problem now is i need to call a destructor in the DLL in postmain() which doesnt seem to be called.

    It seems to me is should be called if the script is being reloaded again from the first bar.
    Last edited by theperm; 11-17-2006, 02:15 PM.

  • #2
    Re: chart refresh doesnt reload indicator

    Hello theperm,

    Originally posted by theperm
    When the chart is in dynamic mode 0 in time templates, when you move the chart it brings down more data and refreshs.

    However it doesnt seem to force a reload of my study. My study place drawText objects on the chart and after the data refresh they are out of place obviously cuase the data changed slightly.

    Is there a way to have the efs study force a reload when the chart data changes?

    [edit]
    I think I may have figured some of this out. YOu see im calling a dll in my script. if i check getBarState() == BARSTATE_ALLBARS instead of using a bInit global I'll know when the script is reloading. Why do all the examples use bInit var when it seems better practice to call getBarState???
    The formula does reprocess the chart data when these events occur. However, global variables do not get reinitialized on a chart refresh or request for more data from the scrolling event, which is why bInit is used in most cases. Most formulas require certain items to only be initialized once when a study is first applied to a chart. The ALLBARS state could also be used instead, there's no right or wrong way to do this, it's more of a question of the what the specific formula needs. In your case, it sounds like you do need to use the ALLBARS state. This state will be triggered on a manual chart refresh or the scrolling event that requests more data when in dynamic mode. If any of your globals need to be reinitialized you need to do that within the ALLBARS condition as well.

    Problem now is i need to call a destructor in the DLL in postmain() which doesnt seem to be called.

    It seems to me is should be called if the script is being reloaded again from the first bar.
    First, make sure you are using a capital M in your postMain() function name. This function will only be called when a manual reload occurs or the formula is removed from a chart. If you need your postMain() function to execute at ALLBARS as well, you could call it directly from within the conditional block associated with your check for ALLBARS in main().
    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