Announcement

Collapse
No announcement yet.

Real time vs reload

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

  • Real time vs reload

    I get condused with this type of code almost every time and right now I cant figure it out - again.

    I have two sections of code one starts

    if(getCurrentBarIndex()==0 && //real time
    getBarState()==BARSTATE_NEWBAR ){//new bar)
    ...
    }


    the other is

    if(getCurrentBarIndex()!=0){//back testing
    ...
    }

    My dilema - I want to return high()-high(-1)

    Do I need to change the math for each of the two sections - it appears the numbers returned are different cuz when I reload the efs the plot changes.

    Any suggestions?

  • #2
    Hello David,

    Not sure what the problem is here. If you would post some example code that recreates the issue I'll take a look.
    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


    • #3
      Re: Reply to post 'Real time vs reload'

      As I look at the problem, I believe I am checking for a new es h4 bar, but I
      am using high(0) and high (0,nqH4) - which may or may not be in synch with
      the start of a new es h4 bar.

      I have switched the indicator to update on every tick, that way the values
      synch up shortly after a new bar is formed.

      Comment


      • #4
        Dave,

        If I am following correctly, try this. Then you do not have to worry if you are backtesting or not. I am using in one of my applications where I am loading up all the historical bars. The nice thing is that it works for RT too.

        var nIndex = getCurrentBarIndex();

        var delta = high(nIndex) - high(nIndex - 1);

        in RT nIndex is zero, during load, it is the negative index number associated with the historical bars.

        Regards,

        Comment

        Working...
        X