The format namespace provides named constants that control how script output values are displayed in the indicator pane legend and how numbers are rendered by str.tostring(). These constants are passed to the format parameter of script.indicator() or to str.tostring().

Quick Example

from pynecore.lib import script, close, string as pstr, format

@script.indicator(title="Price Display", format=format.price, overlay=False)
def main():
    price_str: str = pstr.tostring(close, format.mintick)

Constants

ConstantTypeDescription
format.inheritFormatInherits the display format from the parent series. Use with script.indicator().
format.mintickFormatRounds to whole ticks and prints the tick’s decimals in str.tostring() (1.1 → 1.10000).
format.percentFormatFormats output values as a percentage; str.tostring() prints two decimals and % (0.5 → 0.50%).
format.priceFormatFormats output values as prices. Use with script.indicator().
format.volumeFormatFormats output values as volume (e.g., 5183 → 5.183K). Use with script.indicator().

Compatibility

All five constants are fully supported. This namespace contains no functions or variables.