format

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, str, format

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

Constants

ConstantTypeDescription
format.inheritFormatInherits the display format from the parent series. Use with script.indicator().
format.mintickFormatRounds a number to the nearest mintick value when passed to str.tostring().
format.percentFormatFormats output values as a percentage (appends %). Use with script.indicator().
format.priceFormatFormats output values as prices. Use with script.indicator().
format.volumeFormatFormats output values as volume (e.g., 51835.183K). Use with script.indicator().

Compatibility

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