Announcement

Collapse
No announcement yet.

time synchronization question

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

  • time synchronization question

    Hi,

    I'm currently using 8.0 build 782.

    My question regarding time synchronization is this. If i'm plotting 1-min chart and would like to retrieve the OHLC from the 5-min chart. How can i achieve that?

    I tried a little print script below but the result didn't turn out to be what I wanted.

    debugPrintln(day(0)+" "+hour(0)+":"+minute(0)+" ES "+close(0,inv("5"))+" "+close(-1,inv("5"))+" "+close(-2,inv("5"))+" "+close(0)+" "+close(-1));

    My result is that it prints every minute the close(0) and close(-1) correctly, but the close(0,inv("5")) keeps changing which should not be the case as a 5-min data should only change every 5 minutes.

    Please advise.

    W

  • #2
    Re: time synchronization question

    William

    My question regarding time synchronization is this. If i'm plotting 1-min chart and would like to retrieve the OHLC from the 5-min chart. How can i achieve that?
    To do that you use the inv() function inside the price function that you want to retrieve.
    The syntax will depend on what you want to do. If for example you want to create the series (from which you can then retrieve the values) you would write close(inv(5)). If instead you want to access the value directly you would also add the bar index eg (close(0, inv(5)) for the current value of the 5 minute bar, close(-1, inv(5)) for the value at the prior bar, etc

    My result is that it prints every minute the close(0) and close(-1) correctly, but the close(0,inv("5")) keeps changing which should not be the case as a 5-min data should only change every 5 minutes
    It keeps changing because the 5 minute bar is changing on every tick. If you need to plot the same value across alll the lower interval bars that are inside the corresponding higher interval time frame then you need to return the series which will constantly adjust the prior values synchronizing them to the current value of the higher interval. You may want to review this thread where this is explained in more detail
    Alex


    Originally posted by whammer
    Hi,

    I'm currently using 8.0 build 782.

    My question regarding time synchronization is this. If i'm plotting 1-min chart and would like to retrieve the OHLC from the 5-min chart. How can i achieve that?

    I tried a little print script below but the result didn't turn out to be what I wanted.

    debugPrintln(day(0)+" "+hour(0)+":"+minute(0)+" ES "+close(0,inv("5"))+" "+close(-1,inv("5"))+" "+close(-2,inv("5"))+" "+close(0)+" "+close(-1));

    My result is that it prints every minute the close(0) and close(-1) correctly, but the close(0,inv("5")) keeps changing which should not be the case as a 5-min data should only change every 5 minutes.

    Please advise.

    W

    Comment


    • #3
      There seems to be two methodologies on synchronization. One is to sync all higher interval values according to the lowest interval (assuming that's the one used in the chart), where the latest time is used as a reference. This requires using the series.

      The second way is to sync all higher intervals according to the corresponding chart interval. This requires the value rather than the series.

      Is this correct?

      W

      Comment


      • #4
        William
        Assuming I correctly understood your distinction that would be correct.
        With regards to using the value keep in mind though what I explain in the thread I linked in my prior reply ie that on historical bars the value will be the same across all lower interval bars included in the same higher interval time frame. This is because on historical bars the higher interval will return only 1 value per bar (specifically the closing value of that bar)
        Alex


        Originally posted by whammer
        There seems to be two methodologies on synchronization. One is to sync all higher interval values according to the lowest interval (assuming that's the one used in the chart), where the latest time is used as a reference. This requires using the series.

        The second way is to sync all higher intervals according to the corresponding chart interval. This requires the value rather than the series.

        Is this correct?

        W

        Comment


        • #5
          Cool. Thank you, Alex.

          Comment


          • #6
            William
            My pleasure
            Alex


            Originally posted by whammer
            Cool. Thank you, Alex.

            Comment

            Working...
            X