if() for custom index

Optuma Forums Optuma Scripting if() for custom index

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

    After reading your latest blog post on custom indexes it got me thinking if I could calculate some of my excel charts directly in Optuma.

    One of them operates as a lagging indicator that combines a number of factors of price, volume, and time through nested if statements. The idea being that in a chosen group of stocks I can see how many are trending with the chosen indicators.

    A simplified version of my excel formula to sum the total of stocks that have their price sitting above the 20 period moving average each day.

    sum(if(Stock1 Price>20MA,true=1,false=0),if(Stock2 Price>20MA,true=1,false=0)…

    I’m slowly getting my head around Optuma scripting, but before I get too far in three questions:

    • Is it possible to use if() in the custom codes builder?
    • What is the syntax of the if() statement – excel is: if(logical test, value if true, value if false)
    • Is there a tool or feature of Optuma that can do this that I have not found


    • Topics: 53
    • Replies: 428
    • Posts: 481

    Hi Rhiannon,

    We have a custom Market Breadth module which will calculate any true/false condition for a universe of stocks (eg CLOSE()>MA(BARS=20) in your example) to create a time series. This is an optional add-on module available here:

    Custom Market Breadth Module

    For more on using the IF() statement see this post:

    Using the IF function to create a ranking value

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.