Skip to main content

Module source_mapped

Module source_mapped 

Source
Expand description

Generic Source propagation for any Indicator.

Every concrete indicator computes over bar.close (or another hardcoded OHLCV field) internally; Source existed as a type but had no way to reach an indicator’s computation. SourceMapped closes that gap generically, for the whole catalog at once, instead of threading a source field through every indicator’s internals: it rewrites each incoming bar to a synthetic one where every OHLC field equals the selected source’s extracted value (volume is preserved), then forwards that to the wrapped indicator. Any indicator that reduces its input to a single per-bar scalar (moving averages, oscillators, …) transparently starts computing over the chosen source.

This intentionally does not make sense for indicators that need genuine OHLC range data (True Range/ATR, volume/price profiles, structure/pivot detection): source-mapping them would flatten high == low == open == close, degenerating their range-dependent math. That mirrors the usual convention, where a source parameter is only ever offered on scalar-series functions.

Structs§

SourceMapped
Wraps inner, feeding it a synthetic bar of source.extract(bar) on every OHLC field (volume unchanged) instead of the original bar.