Logging & Enums
log/warn/debug/print_series/print_df plus Source/DataMode/PlotType/Timeframe enums.
log
log(message)
Print a message to the Terminal panel (green, always visible).
Use for status updates, parameter values, and general output. Accepts any value, converts to string.
Parameters
message(Any, defaultrequired): Value to print
Returns
None
Example
from quant_charts import log
log("Starting calculation")
log(f"Period: {self.period}, Bars: {len(df)}")
log(f"Signal count: {signals.sum()}")
warn
warn(message)
Print a warning to the Terminal panel (yellow).
Use for non-fatal issues, edge cases, or unexpected conditions.
Parameters
message(Any, defaultrequired): Warning message
Returns
None
Example
from quant_charts import warn
warn("Insufficient data for 200-period SMA")
print_series
print_series(series, name?, head?)
Print summary of a Series/array: shape, range, NaN count, first N values.
Works with pandas Series, numpy arrays, and PriceSeries (close, high, etc.).
Parameters
series(array-like, defaultrequired): Data to inspectname(str, default"Series"): Labelhead(int, default10): Values to show
Returns
None
Example
from quant_charts import print_series, close
print_series(close, "Close Prices")
print_series(sma, "SMA(20)", head=5)
print_series(rsi > 70, "Overbought")
print_df
print_df(df, name?, head?)
Print summary of a DataFrame: shape, columns, dtypes, first N rows.
Useful for understanding what data is available in the DataFrame passed to calculate().
Parameters
df(DataFrame, defaultrequired): DataFrame to inspectname(str, default"DataFrame"): Labelhead(int, default5): Rows to show
Returns
None
Example
from quant_charts import print_df
print_df(df, "Price Data")
print_df(df[['close', 'volume']], "Close & Vol")
Source
Price source enum for input.source().
Each value resolves to its corresponding price series at runtime.
Parameters
Source.CLOSE(enum): Closing priceSource.OPEN(enum): Opening priceSource.HIGH(enum): Highest priceSource.LOW(enum): Lowest priceSource.HL2(enum): Median: (H+L)/2Source.HLC3(enum): Typical: (H+L+C)/3Source.OHLC4(enum): Average: (O+H+L+C)/4
Example
src = input.source(Source.CLOSE, "Price Source")
PlotType
Chart visualization styles for plot().
Parameters
PlotType.LINE(enum, defaultdefault): Standard line chartPlotType.HISTOGRAM(enum): Vertical bars from zero line. Supports per-barcolors=.PlotType.COLUMNS(enum): Vertical column bars. Supports per-barcolors=.PlotType.CROSS(enum): Per-point cross marker. Supports per-pointcolors=.PlotType.CIRCLES(enum): Per-point circle marker. Supports per-pointcolors=.PlotType.AREA(enum): Filled area under the linePlotType.STEPLINE(enum): Step/staircase line
Example
plot(data, "Momentum", plot_type=PlotType.HISTOGRAM)
Notes
- Per-bar
colors=arrays are valid only for HISTOGRAM, COLUMNS, CROSS, CIRCLES. - LINE / AREA / STEPLINE stay single-color (per-point coloring is not meaningful for continuous series).
Timeframe
Timeframe enum for the strategy/indicator decorator.
Sets the default execution/visibility timeframe. Users can override it per-instance via the Strategy TF pill in the chart top bar.
Parameters
Timeframe.S1(enum): 1-second barsTimeframe.S5(enum): 5-second barsTimeframe.S10(enum): 10-second barsTimeframe.S30(enum): 30-second barsTimeframe.M1(enum): 1-minute barsTimeframe.M5(enum): 5-minute barsTimeframe.M15(enum): 15-minute barsTimeframe.M30(enum): 30-minute barsTimeframe.H1(enum): 1-hour barsTimeframe.H4(enum): 4-hour barsTimeframe.D1(enum): Daily bars
Example
@strategy("Scalper", timeframe=Timeframe.M1, data_mode="ohlc")