LowestLow Date

Optuma Forums Optuma Scripting LowestLow Date

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #57319
    Thomas
    • Topics: 131
    • Replies: 179
    • Posts: 310

    Hi,

    I have created a scripts to show the date of the highest 52-week high and a script to show the lowest 52-week low.

    The shown dates in the watch list for the highest 52-week highs seem to be correct but the dates for the lowest 52-week lows are mostly wrong.

    lowest low date

    highest high

    lowest low

    Here are the scripts:

    Date of the highest 52-week high

    Var1 = HIGH() == HIGHESTHIGH(BACKTYPE=Weeks, BARS=52, INCBAR=True);
    BARDATE(Var1)

    Date of the lowest 52-week low

    Var1 = LOW() == LOWESTLOW(BACKTYPE=Weeks, BARS=52, INCBAR=True);
    BARDATE(Var1)

    I have also uploaded my watch list.

    Interestingly the values of the highest 52-week highs and the lowest 52-week lows are correct but not the dates.

    My script for the highest 52-week high

    HIGHESTHIGH(High(), BACKTYPE=Weeks, BARS=52, INCBAR=True)

    My script for the lowest 52-week low

    LOWESTLOW(Low(), BACKTYPE=Weeks, BARS=52, INCBAR=True)

    Inform me please what I have made wrong.

    Thanks

    Thomas

    #57327
    Thomas
    • Topics: 131
    • Replies: 179
    • Posts: 310

    Hi,

    here is my updated watch list.

    The one in my last post used data only available on my computer.

    #57333
    Thomas
    • Topics: 131
    • Replies: 179
    • Posts: 310

    My final updated watch list, with data from the Optuma databases

    #57340
    Matthew
    • Topics: 5
    • Replies: 631
    • Posts: 636

    Hi Thomas,

    The results for the low you are seeing are from the first match found within the 52 week range. The result you are after is from the most recent bar, the way to do this in a Watchlist is to use a script like this (i’ve included notes on what each step does):

    This should return the results you’re expecting to see in the WL column.

    1 user thanked author for this post.
    #57349
    Thomas
    • Topics: 131
    • Replies: 179
    • Posts: 310

    Hi Matthew,

    thank you for your script. In my watch list it works almost perfect but unfortunately not for Microsoft. The watch list shows the date 9/17/1987, that date is the first day data are available.

    I have again attached my watch list.

    date lowest low

    Thanks

    Thomas

    #57353
    Thomas
    • Topics: 131
    • Replies: 179
    • Posts: 310

    Hi Matthew,

    perhaps I have figured out the issue in the script.

    The lowest low was 114.59 (see watch list). That low was on Friday, March 15, 2019.

    If you multiply 52 * 7 you get 364, if you subtract 364 calendar days from March 12, 2020 (last bar date) you get Thursday, March 14, 2019.

    Perhaps since the lowest low date and the start of the script (start = BARDATE() == LAST(BARDATE()) – (52*7)) are so close together the issue occurs.

    #57383
    Thomas
    • Topics: 131
    • Replies: 179
    • Posts: 310

    Hi Matthew,

    have you any idea how to solve the issue of the lowest low date script as outlined above?

    Thanks

    Thomas

    #57402
    Matthew
    • Topics: 5
    • Replies: 631
    • Posts: 636

    Hi Thomas,

    We think it’s the LowestSince() function that’s causing this outlier issue, we’re looking into it further.  For now the following adjusted script seems to be working without producing the outliers:

    1 user thanked author for this post.
    #64979
    Darren
    • Topics: 73
    • Replies: 900
    • Posts: 973

    Here’s a variation to get the date of the 52 week lowest close, rather than the lowest low:

    For highest close change V4 from LOWESTLOW to HIGHESTHIGH. This example shows the highest 52 week close date for AMGN was July 20th 2020:

    Capture

    1 user thanked author for this post.
    #69477
    Darren
    • Topics: 73
    • Replies: 900
    • Posts: 973

    Hi Thomas,

    In our fundamental data we now have have dates for high and low prices over the week, month, quarter, 6 months, year, and all-time. These can be added as a watchlist column from the Fundamental Field list without having to create a formula:

    Capture

    However, this will only work for equities and ETFs as fundamental data isn’t available for indices, forex, cryptos, etc. I’ve come up with an alternative using BARINDEX() instead of BARDATE() to avoid weekends and holidays:

    52 week low date:

    52 week lowest close date:

    In this example, the 52 week low for Home Depot was on June 22nd ($264.51), but the lowest close ($266.58) occurred on September 26th:

    Capture

    1 user thanked author for this post.
    #69493
    Thomas
    • Topics: 131
    • Replies: 179
    • Posts: 310

    Hi,

    For those interested in this topic here is a summary of the scripts:

    52-Week Highest High

    52-Week Highest Close Date

    52-Week Highest High Date

    52-Week Lowest Low

    52-Week Lowest Close Date

    52-Week Lowest Low Date

    Thank you Darren for your great support.

    Best wishes,
    Thomas

    • This reply was modified 1 month ago by Thomas.
    #69569
    Deepak
    • Topics: 88
    • Replies: 74
    • Posts: 162

    Hii Sir,

    Can we find first and last dates of 52 week lows using this script.

    Regards,
    Deepak

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

Pin It on Pinterest