Skip to content
Algo Trade Analytics Docs
Pine library page — review pending. This page is preserved for compatibility but is not part of the reviewed search index. Check the official Pine Script v6 reference before relying on its explanation, signature, or example.

fixnan() - Pine Script Function

fixnan() forward-fills a series by replacing each na with the last non-na value. Use it when data sources produce occasional gaps.

fixnan(source) → series _
NameTypeDescription
sourceseries _Series to forward-fill (any type except tuples).

Series without na gaps.

  • Unlike nz(), fixnan() forward-fills the last non-na value but does not substitute an arbitrary default when all previous values are na.
  • Works on numbers, colors, strings, and bool series.
//@version=6
indicator("fixnan example", overlay=false)
extClose = request.security(syminfo.tickerid, "60", close)
filled = fixnan(extClose)
plot(extClose, "Raw", color=color.new(color.red, 40))
plot(filled, "Forward filled", color=color.blue)