funasoft
Pine Script Rookie
Pine Script Rookie
Posts: 3
Joined: December 9th, 2023

need to convert code from version 2 to version 5

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 !

Return to “Pine Script Q&A”