Announcement

Collapse
No announcement yet.

Time&Sales EFS not catching all trades

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

  • Time&Sales EFS not catching all trades

    I have written an EFS to monitor for (and give an alert to) large trades and trades going off above the Ask and/or below the bid.

    In watching eSignal's T&S windows, though, it's clear that the EFS is not catching all the trades that the T&S sheet is showing.

    Is there somethign I can do to improve this, so my EFS catches all the trades that the T&S window does?

    The EFS is pretty simple... basically using:
    getMostRecentAsk()
    getMostRecentBid()
    getMost RecentTradeSize()
    getMostRecentTrade()

    And then if the most recent trade size is above a pre-set threshold,... or ... . if the most recent trade is below the bid or above the ask, it does an Alert.addToList and an Alert.playSound(wavefile). Very simple EFS.

    Thanks for any help.

    JOHN

  • #2
    John
    What you are seeing is due to how an efs executes in minute based charts with some electronically traded contracts (ES and NQ for example). Under those conditions an efs will execute only when
    - Current trade price is different than the previous trade price.
    - Current trade price is at the bid and previous trade was at the ask or vice versa. The two trade prices can be the same in this instance.
    With tick based charts (Tick, Volume, Seconds or Price-change) instead an efs executes on every trade so a solution could be to use (for example) 60S in lieu of 1 minute.
    Alex

    Comment


    • #3
      Alex,

      That is likely it. I am using a 1min chart for this. Thank you for your informative reply. I will switch it to a 60sec chart, instead of the 1min chart.

      Just so I am clear, there should be no difference in the frequency with which my EFS executes if I use a "second" based chart or a "tick" based chart? Becuase if it will execute better on a, say, 100tick chart, I can run that, too, just as easily.

      Thanks, again.

      JOHN

      Comment


      • #4
        Alex,

        I have one more Question for you on this. When I switch to a 60sec chart (instead of a 1min chart), my chart shows all trades for all times. That is, it is ignoring my time template being set for 9:30am to 16:15pm.

        Is there a way to do a "second" based chart that still obeys the time-template I choose? Or do "second" based charts all default to the "24hour" format (ie all times)?

        JOHN

        Comment


        • #5
          John
          To answer your first question there should be no difference in executions between tick, volume or seconds charts as they all tick based charts.
          As to the Start/End times in a Time Template these are not applicable to tick based charts which currently default to "all sessions".
          Alex

          Comment


          • #6
            Alex,

            I have one more question relating to this program. Since my EFS program is drawing lines based on T&S information, and since EFS's do not access historical data, while I run the program real-time, the lines it's drawn are still there. But, if I reload the chart, they are gone.

            Is there a way to 'release' the lines the EFS program has drawn, so that they become permanent parts of my chart?

            JOHN
            Last edited by fish7; 12-19-2005, 12:55 PM.

            Comment


            • #7
              Hello John,

              The only way to accomplish this task is to write the information you collect in real time to a text file using File I/O. When the study is reloaded you would add logic to look for the file and parse the information out based on the time stamp of the bars during the reload process to redisplay or redraw the information that was previously collected in real time.

              You need to only allow writing to the file when your EFS is processing real time data. Use a check for getCurrentBarIndex() == 0. Likewise, during the reload process, if getCurrentBarIndex() < 0, then allow your EFS to read your file.
              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


              • #8
                Jason,

                Thanks for the reply. That seems like that could do it. I am curious, though. If I am writing to a file (on my hard drive), won't that potentially be a slow-spot in the running of the EFS? That is, while the EFS is writing to the hard drive, new data keeps coming into T&S (which is what I am watching). In that case, will the EFS potentially miss incoming trades while the EFS is tied up doing file I/O?

                JOHN

                Comment


                • #9
                  Hello John,

                  It really depends on how you write the routine. If you open and close the file every tick, yes, that could be an inefficient method. I'm not certain that would cause you to miss ticks however. I would suggest storing the information you want to write to the file in some global variables. Then at BARSTATE_NEWBAR, write all that information to the text file once. This would force the routine to occur only once per bar and not every tick, which shouldn't cause any problems.
                  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


                  • #10
                    Hi John,

                    To add to what Jason recommended, opening and closing files takes a significant chunk of time. Check out this link where I did some timing when writing to files. I found that leaving a file open and using the flush() command resulted in lightning quick file access while minimizing the risk of data loss.

                    Comment


                    • #11
                      Wow, thank you, both of you, for excellent, informative replies! That helps a lot.

                      Cheers!

                      JOHN

                      Comment

                      Working...
                      X