Fix Starting Point for Calculation

Optuma Forums Optuma Scripting Fix Starting Point for Calculation

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #62629
    • Topics: 90
    • Replies: 119
    • Posts: 209


    I want to calculate a breadth indicator using the S&P 500 Advancing and Declining issues with a fixed starting point.

    The calculation is the following:
    Suppose the oscillator stands at 100 at yesterdays close.
    Suppose today there are 220 advancing issues and 385 declining issues of the S&P 500.

    The calculation for yesterday was: N(yesterday) = 100;
    N(today) = (0.9 * N(yesterday)) + (0.1 * (Advances(today) – Declines(today))

    using the data from the above example:
    N(today) = (0.9 * 100) + (0.1 * (220 – 385) =  73.5

    My script above is wrong because of the starting point. Var3 has to be a “different one” but I don’t know what is the right code.

    Any help is very appreciated.


    • This topic was modified 1 week, 4 days ago by AvatarThomas.
    • Topics: 32
    • Replies: 1,707
    • Posts: 1,739

    Hi Thomas,

    The value of 100 is not needed.

    Optuma will sort out the first value. You can use BarIndex to do an IF() and do a special case when it is 0, but it should not be necessary.

    Hope that helps.

    1 user thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 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.