Skip to content

Logical Operators

By Optuma Team · Updated 2020-04-03

The following Logical Operators are available for use in the Optuma Scripting Language:

  • AND
  • OR
  • NAND
  • NOR
  • XOR

The following table is a reference to how each Operator will function in scripting:

Opertator Matrix

In the following script, both criteria (V1 and V2) must pass for a True (1) result to be returned.

V1 = CLOSE() > OPEN() ;
V2 = CLOSE() > MA(BARS=50) ;
V1 and V2

Example 1

If we swapped the Logical Operator in the same script to NAND the results would invert and would only show a True result if only 1 or neither of the criteria passed.

V1 = CLOSE() > OPEN() ;
V2 = CLOSE() > MA(BARS=50) ;
V1 nand V2

Example 2

In the following script either criteria (V1 or V2) must pass for a True (1) result to be returned.

V1 = GANNSWING() TURNSUP ;
V2 = CLOSE() > MA(BARS=150) ;
V1 or V2

Example 3

If we swapped the Logical Operator of the same script to NOR the results would invert and only show a True result when both criteria did not pass.

V1 = GANNSWING() TURNSUP ;
V2 = CLOSE() > MA(BARS=150) ;
V1 nor V2

Example 4

In the following script only one of the two listed criteria (V1 or V2) can pass for a True (1) result to be returned. If both pass, or both fail the script will return a False (0) result.

V1 = MA(BARS=25) CrossesAbove MA(BARS=150) ;
V2 = CLOSE() > MA(BARS=150) ;
V1 xor V2

Example 4

Choose which categories of cookies you allow. Strictly-necessary cookies are always on. You can change this any time via the "Cookie Settings" link in the footer.

  • Functional

    Remember preferences like dismissed banners and your dark-mode choice.

  • Analytics

    Help us understand how the site is used so we can improve it.

  • Marketing

    Measure our advertising and help us reach people who may be interested in Optuma.