using LAST() for extended hours

Optuma Forums Optuma Scripting using LAST() for extended hours

Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #62229
    AvatarJeffrey A.
    • Topics: 30
    • Replies: 41
    • Posts: 71

    Hello,

    In a watchlist, when I add the “standard” built-in script for “Last”, it will show me live extended hours pricing in a column.. However when I want to use a custom script that is trying to reference the current price using “Last()” , it is using the day’s close versus the live after hours price. Is there another way to go about this?

    Jeff

    • This topic was modified 4 weeks ago by AvatarJeffrey A..
    #62257
    MathewMathew
    • Topics: 32
    • Replies: 1,707
    • Posts: 1,739

    Hi Jeff,

    Does Close() give you what you need?

    All the best

    Mathew

    #62297
    AvatarJeffrey A.
    • Topics: 30
    • Replies: 41
    • Posts: 71

    Hi Mathew,

    Simply what I am trying to do is create a column that will show the percentage a stock is up or down in extended hours in relation to its daily close ( will display that “XYZ stock is up 5% in post/pre market”).

    When the time frame of the watchlist is set to “1 day”,  CLOSE() or LAST() populates the close of day price and but then there does not seem to be a way to retrieve the after hours price using those variables with the watchlist in “1 day” mode.  Now, if the watchlist is set to an intraday timeframe ( “60 minutes” for example), when I use CLOSE() or LAST() in a script, it will retrieve the extended hours pricing, but then in the intraday set watch list,  I can’t seem to then retrieve the day’s close price using those variables, even if they are specified for daily timeframe,  ex:   a1 = CLOSE(Day(PERIODAMOUNT=1));

    Jeff

    #62362
    MatthewMatthew
    • Topics: 5
    • Replies: 332
    • Posts: 337

    Hi Jeff,

    The time frame will have an impact on which Close() references.  To achieve what you are wanting to do i think you’d need to setup a script that splits the bars into In Session and Out of Session zones.  Once you have done that you can then select specific bars within those zones to use in your comparison to see how much the price has moved in extended trading.

    The following thread here should help in getting that setup: https://forum.optuma.com/topic/marking-out-of-session-bars/

    1 user thanked author for this post.
    #62377
    AvatarJeffrey A.
    • Topics: 30
    • Replies: 41
    • Posts: 71

    Hi Matthew,

    This is a useful script, thank you for sharing –  I like how I can shade extended hours and change the color of the time periods, however, I am still a bit confused on how to use these variables that contain decimals to call up the end of day and a live extended hours price quote. Can you give me an example how to reference the close using decimals and the current extended hours price?  I tried to nest some of the variables inside of close and last and it didn’t query the price

    Jeff

    #62402
    MatthewMatthew
    • Topics: 5
    • Replies: 332
    • Posts: 337

    Hi,

    I’d setup a 15min watchlist and use a variation of the script i referenced earlier to find the price when the out of market hours ends to compare with the main sessions close.

    To do this you’d use the PriceatSignal() function, but for that to work you need to set a Boolean trigger to mark when the out of session zone starts and ends.  That will give us the price points which we can then use to calculate the % difference between.

    The final script would look like this:

    The final result would look like this:

    Ex1

    You can see how the Show View displays the % change each day, comparing the close of the main session with the close of the out of session activity. The values line up with a manual measurement of the same ranges.

    I’ve attached an example workbook (which uses live USA Equities data) for you to review.  It may not be exactly what you are after but should give you a foundation to build on.

    Attachments:
    1 user thanked author for this post.
    #62413
    AvatarJeffrey A.
    • Topics: 30
    • Replies: 41
    • Posts: 71

    Hi Matthew,

    Thank you very much for the script and the workbook! Will experiment with these.

    Much respect,
    Jeff

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close