Barstrue function for ytd programming

Hello everyone,

I am trying to build statistic tools for research purpose. My objectif is to find:

1 how many new ytd low a security made since the beginning of this year.
2 how many 1 year low the security made during the last 1 year period.

So i find the barstrue function should be used at given circumstance as shown in the page https://help.optuma.com/kb/faq.php?id=1118

So my question is, how to change the script here. Can i write lookback=ytd ? or Lookback=1 year ? I can’t find further information in the knowledge base. So if you guys can help me on that, i would be very thankful.

BTW, can we just make it available in the optuma ? So everyone can use it directly. I don’t know if this would be a new feature, i really want to know what you guys think of.

Thanks

Yan

Hi,

LowestLow doesn’t have a Year to Date look back option, but it does have a Range, so you can set it up to search for items just from 1st of Jan 2021 to 31 Dec 2021.

Once you have that, you can check for all the new Lowest Lows set for that same range with a script like this:

V1 = LOWESTLOW(RANGE=Range, RANGESTART=2021-01-01, RANGEEND=2021-12-31) ;
V2 = LOW() == V1 ;
ACC(V2)

You can see on the following example the result for the year so far is 15.

Ex3

The second criteria is similar to the first, only a few adjustments are required…

V1 = LOWESTLOW(BACKTYPE=Years, BARS=1, INCBAR=True);
V2 = LOW() == V1 ;
ACC(V2, RANGE=Look Back Period, BACKTYPE=Years, BARS=1)

Ex4

[postquote quote=65366]

Hi Matthew, thanks for your reply.

The script works on the chart perfectly. I can use it for a specific year that’s true.

In fact, my intention was to create a watchlist to see how many lows they created each years. I guess that i can make script for each year, but can optuma create a tool that when we open a watchlist with for example 2010-2020 automatically ?

Just an idea to see if anyone else is interest in digging deeper the market. I didn’t know whether i should put this in the new feature demand part. Still, very happy to see all the solutions from you guys and the explanation of look back option. Hope that other people who reach this topic could use that too.

Thanks again

Yan