OPEN-SOURCE SCRIPT

PHAI GIAU NHAT VN)

170

positive and negative are recreated each bar using nz(...[1]) to keep the old value if no new signal is present.

The line p_mom ? true : nz(positive[1], false) ensures the variable keeps the correct state across bars.

Clearly displays "UP" and "DOWN" signals.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.