ZigZag Based on price oscilation.
- Use Alt Timeframe: enables optional timeframes, use higher timeframes to reduce noise.
- Timeframe: said Alt Timeframe.
study("[RS]ZigZag PA", overlay=true) useAltTF = input(true, title='Use Alt Timeframe') tf = input('15', title='Alt Timeframe') 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 ? highest(2) : _isDown[1] and _isUp and _direction[1] != 1 ? lowest(2) : na sz = useAltTF ? (change(time(tf)) != 0 ? security(tickerid, tf, zigzag()) : na) : zigzag() plot(sz, title='zigzag', color=black, linewidth=2)