Search code examples
pine-scriptboolean-expression

Built in ema function in boolean expression


I came across this expression.

longExit() => ema(close, 80) and rsi(close, 2) >= 80

I assume this is a function definition which returns a boolean. When does the first node (ema(close, 80)) evaluate to be true? The documentation says that the built-in ema function returns a float.


Solution

  • It looks like a wrong use. It will evaluate to be true pretty much all the time except when that node returns 0 which is false in boolean.