Announcement

Collapse
No announcement yet.

problem with real time display

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

  • problem with real time display

    Hi there,

    I've attached a file of the code. It seems
    that the indicator is plotting the historical dat out correctly, however when it starts adding up the real time data it seems as
    if it just goes one direction (straight up or straight down) for a long time befor it reverses and goes the other way for a long time.

    Why is it so different with the real time data????


    Thank,

    John
    Attached Files

  • #2
    John
    That is happening because in your cumulative calculation you are not using the values of CumSumEs and CumSumNq at the prior bar so the resulting values are compounded on every tick of the current bar. Also you are using the efs1 syntax to call the external symbols which would require some further code to ensure the proper synchronization between symbols
    To resolve this you need to first declare two global variables to store the values of CumSumEs and CumSumNq at the prior bar.



    Then before you calculate the current values of CumSumEs and CumSumNq you need to transfer the last calculated values of those variables to the variables CumSumEs1 and CumSumNq1 to store them (for later use).
    This will need to happen on the first tick of a new bar.



    Now that you have the values of CumSumEs and CumSumNq at the prior bar (ie CumSumEs1 and CumSumNq1) you use those to calculate the new values. Also you should use the sym() function to call external symbols to maintain the proper synchronization



    The changes described above should resolve the problem
    Alex


    Originally posted by xoprofittaker
    Hi there,

    I've attached a file of the code. It seems
    that the indicator is plotting the historical dat out correctly, however when it starts adding up the real time data it seems as
    if it just goes one direction (straight up or straight down) for a long time befor it reverses and goes the other way for a long time.

    Why is it so different with the real time data????


    Thank,

    John

    Comment


    • #3
      Thanks

      Thanks Alexis that helps out a lot. I really apreciate that reply.

      John

      Comment


      • #4
        Re: Thanks

        John
        You are most welcome
        Alex


        Originally posted by xoprofittaker
        Thanks Alexis that helps out a lot. I really apreciate that reply.

        John

        Comment

        Working...
        X