On Balance Volume Script

Optuma Forums Optuma Scripting On Balance Volume Script

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #54143
    • Topics: 6
    • Replies: 7
    • Posts: 13

    Hi all, I’m new to scripting and have been working through the training which is great.

    If I was to do OBV manually (I know there is the OBV function, but I wish to change some of the internal variables) with scripting what would the code be? I can’t work out how to get it to accumulate, ie adds to the previous value.

    Here is my attempt:

    I know it should be Offset=1 + Offset=2 + Offset=3 + …..Offset=8425…. but this doesnt work in practice as every instument has a different start date.

    It would be great if someone can paste the OBV script here.

    Many thanks,

    • Topics: 43
    • Replies: 312
    • Posts: 355

    Hi Liam,

    That’s a pretty good way of doing it. The Accumulate function is ACC() so your last line would be ACC(V3).

    Put it in a Show View tool and it will match the OBV tool, allowing you to tweak it as required.

    Note the you can use CLOSE(1) for the previous close instead of using the OFFSET function, or you could remove VAR1 altogether and use the CHANGE() function in VAR2:

    VAR2 = IF(CHANGE()> 0,1,-1);

    • Topics: 6
    • Replies: 7
    • Posts: 13

    Great, many thanks.

Viewing 3 posts - 1 through 3 (of 3 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.