Announcement

Collapse
No announcement yet.

Employing tick data of one symbol in a tick chart of another symbol

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

  • Employing tick data of one symbol in a tick chart of another symbol

    It has been mentioned in various posts that while all ticks are picked up in a tick chart, some ticks are missed when one minute bars are employed. I think this may be the case with imported values as well. For example, within a 60s tick chart of the emini (es #f) I would like to incorporate into a study the tick by tick close of EPREM A0 but find if I construct an internal function within which I assign a variable the close of EPREM A0, e.g.

    function calc() {
    epremclose = close(0, sym("EPREM A0"));
    return epremclose;
    }

    and then pass and plot the value of epremclose to the main() using efsInternal(), that this plot does not update as often as do the values of EPREM A0 can be seen doing if I open a 60s tick chart of EPREM A0 off to the side for comparison purposes. I tried including an interval specification in the internal function, i.e.

    epremclose = close(0, sym("EPREM A0, inv(60s)"));

    but still found that far from all EPREM A0 ticks were being processed in the es #f chart study. So my question is, how can a study used in a 60s chart of the emini be designed so as to plot ALL the tick by tick changes in EPREM A0? Thanks for any suggestions.

    Mike

  • #2
    Mike
    The first thing you need to do is correct the syntax used in this line
    epremclose = close(0, sym("EPREM A0, inv(60s)"));
    which should be
    epremclose = close(0, sym("EPREM A0, 60s"));
    This modification will resolve in part the issue you were seeing. 'In part' because you need to consider that the efs will execute on each tick of the external symbol only if the time stamps of the external symbol are comparable (ie contained within) the interval of the main symbol.
    Assume for example that the main symbol is on a 60 seconds interval and that you are calling an external symbol also on a 60 seconds interval. So long as the time stamps of each are matching then the efs will execute on each external interval even if the main symbol is not printing any trades. However once the time stamps of the external symbol go beyond the time slot of the main symbol's interval then the efs can no longer maintain the synchronization because it has no comparable time stamps to reference.
    Alex

    Comment


    • #3
      Mike
      In my prior reply I used as an example a 60 seconds interval for the main symbol. The same is true also if the main symbol is based on any intraday interval (ie minute based) and the external symbol is tick based so long as the time stamp of the external symbol falls within the slot of the main symbol's interval.
      To confirm this here is an animated image which shows that the main symbol ($SPX) is based on a 15 minute interval while the external symbol is based on 60 seconds. As you can see there are times where the main symbol is not updating yet the plot of the external symbol is updating in synch with the chart for that same symbol. Also enclosed is the formula used for this example
      Alex



      PHP Code:
      function main() { 
          var 
      epremclose close(0,sym("EPREM A0,60s"));
          return 
      epremclose;

      Comment


      • #4
        Very cool. Strangely I only run into trouble when the internal chart and the external symbol are both set at the 60s interval. Thought at first it might be a CPU problem because of the increased data a tick chart processes but Task Manager tells me I'm still well below 100%. When I find the solution I'll post it. Thanks Alexis.

        Mike

        Comment


        • #5
          My mistake. Bad coding on my part was the cause of the apparent dropping of ticks. Alexis is correct. As he shows below, if the interval is included in the definition of the external value, i.e.

          var epremclose = close(0,sym("EPREM A0,60s"));

          then no ticks are missed no matter what the interval of the internal chart. Thanks for taking the time, Alexis.

          Mike

          Comment


          • #6
            Mike
            You are most welcome
            Alex

            Comment

            Working...
            X