Reply To: BARSTRUE Script

Optuma Forums Optuma Scripting BARSTRUE Script Reply To: BARSTRUE Script

  • Topics: 5
  • Replies: 292
  • Posts: 297

In your first script example, that scan would only return a pass if the number of bars that met the criteria over the last 10 days was zero.

If you look at the example in my reply you can see that the BarsTrue (when using a look back period of 10) will procedure a result that oscillates between 0 and 9.  A result of zero means none of the bars checked passed the criteria, and 9 means all bars checked passed the criteria.

For the simplest example, set the criteria to be Close() > Open() and use that with BarsTrue(), the output will change between 0 to 9.


To use it with a scan i’d just need to adjust the BarsTrue line to output a Boolean result.  For example:

Would mean the criteria would have to have passed 5 out of 10 bars to pass.

With your second script, the line would output the Moving Average value.  To convert it to a Boolean you have to setup a rule.  I’m not sure what you’re looking for but some common examples are


Anything that returns a 1 or 0 result will work with BarsTrue()

  • This reply was modified 2 weeks, 4 days ago by MatthewMatthew.

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.