Calculate yearly return for an security listed at the middle of the year

Optuma Forums Optuma Scripting Calculate yearly return for an security listed at the middle of the year

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #56719
    AvatarYan
    • Topics: 4
    • Replies: 5
    • Posts: 9

    Hi there,

    I bring up this topic to see if anyone suffers from the same issue when calculate yearly return.

    In fact, as shown in the picture, the stock is listed on 19th Oct 2018. If i use the following script to calculate its return in 2018:

    M1 = YEARNUM() == 2018;
    M2 = YEARNUM() == 2017;
    V1 = VALUEWHEN(M1);
    V2 = VALUEWHEN(M2);
    ((V1/V2)-1)12

    As the year 2017 has the value of 0, the result is -100% which is obviously not correct.

    So in order to make this script work, how to do the modification here.

    Thanks in advance for your reply ~~

    cheers

Viewing 1 post (of 1 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