Announcement

Collapse
No announcement yet.

rawtime() on external series on tick-chart?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • rawtime() on external series on tick-chart?

    See comments in sample code. Is there any reason that rawtime() of an external series would work differently if the chart interval is tick-based rather than minute-based? If not, this is a bug.



    PHP Code:
    // as tested on ES #f, 10.2.1391
    // If a one-second series is created on a one-minute chart and the 
    // the rawtime(of one-second series) value is printed each time it changes (for current bars) the value is seen to increase 
    // one-by-one (assuming market is trading normally, ie more often than once per second).
    // This is expected.


    // If the same one-second series is created on a tick chart (610T and 100T tested) then the rawtime does NOT change sequentially.
    // It only seems to update when the chart bar changes (at BARSTATE_NEWBAR). This is not expected.
    //
    // getBarStateInterval(one-second interval) also seems broken in a similar way

    // run one of these on both a one-minute chart and a, say, 610T chart, to see the 
    // missing prints from the 610T chart compared with the one-minute chart.


    var mxOneSec null;
    var 
    mnRawtimeStart null;
    var 
    mnRawtimeLast null;

    function 
    main() {
        if (
    getBarState() == BARSTATE_ALLBARS) {
            
    debugPrintln("Testing faulty timestamps in external seeries on tickcharts (tested for ES #F, compare 1min and 610T charts)");
            
    debugPrintln("Chart Symbol & interval = " getSymbol() + "," getInterval() );
            
    mxOneSec inv("1S");
            return;
        }
        if (!
    isLastBarOnChart()) {  
            return;
        }
        
        if (
    mnRawtimeLast == null) {
            
    mnRawtimeStart rawtime(0,mxOneSec);
            
    mnRawtimeLast rawtime(0,mxOneSec);
            return;
        }
        if (
    getBarState() == BARSTATE_NEWBAR) {
            
    debugPrintln("\nNew chart bar on inv = " getInterval() + "\n");
        }
        if (
    mnRawtimeLast != rawtime(0,mxOneSec)) {
            
    mnRawtimeLast rawtime(0,mxOneSec);
            
    debugPrintln("\nNew one-second rawtime() on inv = " getInterval() + ", =  " + (mnRawtimeLast mnRawtimeStart));
        } else {
            
    debugPrint("."); // each tick, to ceck activity
        
    }
        return;

    Here is some sample output, running on one-minute and 20T charts. It was run pre-market, so we didn't get a trade every second, so the output from the one-minute chart does not show sequential seconds, but it does show that rawtime() of the one-second series does NOT change on the 20T chart as frequently as it does on the one-minute one.

    PHP Code:
    New one-second rawtime() on inv 20T, =  142
    ..
    New 
    one-second rawtime() on inv 1, =  131
    .......
    New 
    one-second rawtime() on inv 1, =  132
    .
    New 
    one-second rawtime() on inv 1, =  136
    ...
    New 
    one-second rawtime() on inv 1, =  139
    .............
    New 
    one-second rawtime() on inv 1, =  140
    ...
    New 
    one-second rawtime() on inv 1, =  143
    .
    New 
    one-second rawtime() on inv 1, =  146
    .
    New 
    one-second rawtime() on inv 1, =  149

    New chart bar on inv 20T


    New one-second rawtime() on inv 20T, =  161
    ..
    New 
    one-second rawtime() on inv 1, =  150
    .
    New 
    one-second rawtime() on inv 1, =  152
    .........
    New 
    one-second rawtime() on inv 1, =  153
    .............
    New 
    one-second rawtime() on inv 1, =  155
    ..........
    New 
    chart bar on inv 20T


    New one-second rawtime() on inv 20T, =  168

    New one-second rawtime() on inv 1, =  156
    .
    New 
    one-second rawtime() on inv 1, =  159
    .
    New 
    one-second rawtime() on inv 1, =  160
    ...
    New 
    one-second rawtime() on inv 1, =  163
    ........ 

  • #2
    Hello Dave,

    Thank you for your post and code. We're currently looking into this.
    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
      Thanks Jason.

      Comment


      • #4
        -

        Hello Dave,

        We've looked into this thoroughly and confirm that the synchronization you are trying to achieve is not feasible. The main problem is that T intervals, or any similar interval type that does not have a known ending time, can only be synched to the same interval type. There isn't a solution for this problem. Synchronization between intervals with unknown ending times to non-similar interval types is not supported.

        One possible work-around for you to explore is the use of getBarStateInterval("1S"). This will at least provide you with the new bar event of the external interval so that you can try to create your own synch logic between two non-divisible interval types.
        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


        • #5
          Jason, Thanks for the investigation...
          You suggested "getBarStateInterval("1S")", but according to my comment in the original post

          PHP Code:
          // getBarStateInterval(one-second interval) also seems broken in a similar way 
          If you think that should work, could you try it too?

          Despite your comments, it's still not clear to me why the timestamp for a 1S interval can't exist in a tick interval chart - afterall the "tick" either falls in a new second, or it doesn't, irrespective of the chart interval type?

          Dave

          Comment

          Working...
          X