This is the code:
zigzag() =>
_isUp = close >= open
_isDown = close <= open
_direction = _isUp[1] and _isDown ? -1 : _isDown[1] and _isUp ? 1 : nz(_direction[1])
_zigzag = _isUp[1] and _isDown and _direction[1] != -1 ? ta.highest(2) : _isDown[1] and _isUp and _direction[1] != 1 ? ta.lowest(2) : na
I get this error : Undeclared identifier '_direction'
thanks !