Documentation/AlgoCode/Function reference

crosses above

True when a crosses from below b to above b on this bar.

Reference/Language/Language

a crosses above b

Uses this bar and the previous bar. Preferred English form of crossover(a, b). Typical for EMA crosses and zero-line breaks.

Return value

boolean

Example

fastLen = input 9 as "Fast EMA"
slowLen = input 21 as "Slow EMA"
fast = ema(close, fastLen)
slow = ema(close, slowLen)
plot fast as "Fast" blue
plot slow as "Slow" orange
when fast crosses above slow
  buy
when fast crosses below slow
  exit

See also