Announcement

Collapse
No announcement yet.

Help getting market close price

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

  • Help getting market close price

    Hello,

    I am working on an EFS for some after-hours trading.

    I need to compare the most recent bid price against the market close price (4pm EST).

    However, I can't seem to figure out how to pull that information into an EFS.

    Something like:

    "close(end_of_market_session)"



    or could is there a way to get the price at a specific time? So I could do something like:

    "close(3:59:59EST)"


    The quote window offers a field for Extended Hours Change (ExtHrsChg), but I can't seem to figure out how to pull that number into an EFS. If I could, I think I could use it to figure out the market close price.
    Last edited by DENbdf; 03-25-2009, 03:49 PM.

  • #2
    Re: Help getting market close price

    DENbdf
    A simple solution is to create a Time Template with a User Defined Interval of 390 minutes set to Start/End at 09:30/16:00. At that point you can use close(0, inv(390)) which will return the value of the RTH Close
    Another method is to declare a global variable [called for example RTHClose] and then assign to it the value of close(0) if the bar time is less than 16:00 eg
    if((hour(0)*100)+minute(0)<1600) RTHClose = close(0);
    At or after 16:00 the value of RTHClose will remain constant at the last traded price of the RTH
    Alex


    Originally posted by DENbdf
    Hello,

    I am working on an EFS for some after-hours trading.

    I need to compare the most recent bid price against the market close price (4pm EST).

    However, I can't seem to figure out how to pull that information into an EFS.

    Something like:

    "close(end_of_market_session)"



    or could is there a way to get the price at a specific time? So I could do something like:

    "close(3:59:59EST)"


    The quote window offers a field for Extended Hours Change (ExtHrsChg), but I can't seem to figure out how to pull that number into an EFS. If I could, I think I could use it to figure out the market close price.

    Comment


    • #3
      That Time Template suggestion did the trick, but it's pretty slow to load the data from the close(0,inv(390)) request.

      Any suggestions to speed it up? Or other ways to do this?

      Thanks

      Comment


      • #4
        Actually, this worked for a while, but now I tested in on Citigroup and it's giving me the after hours price of 2.90, but I show it closed at 2.95

        Comment


        • #5
          DENbdf
          Actually the last trading price at the closing bell was 2.90 [see enclosed screenshot] and not 2.95 which is the Settlement that occurs after the RTH close. If you want the Close inclusive of the Settlement then reference the daily bar
          With regards to close(0, inv(390)) that was just the simplest solution to illustrate the concept
          If at this point you want to improve the speed then there are several ways to do that depending on your needs.
          You could for example make that call once only on a specific bar rather than on every bar or you could initialize the series once at BARSTATE_ALLBARS or inside a bInit routine and then retrieve its value using the getValue() method, etc.
          Alternatively you can use the other method I suggested which does not call an external interval but uses only the data on the chart
          Alex




          Originally posted by DENbdf
          Actually, this worked for a while, but now I tested in on Citigroup and it's giving me the after hours price of 2.90, but I show it closed at 2.95

          Comment

          Working...
          X