Basic price bar transforms
Returns a reusable (chainable) basic bar transform (e.g. HL2, OHL3, etc.) by isolating a single component part value or calculated value from the full OHLCV bar candle parts.
// C# usage syntax
IReadOnlyList<TimeValue> results =
bars.Use(candlePart);
// alternate syntax
IReadOnlyList<TimeValue> results =
bars.ToBarPart(candlePart);Parameters
| param | description |
|---|---|
candlePartCandlePart | The OHLCV element or simple price transform |
Historical price bars requirements
You must have at least 1 period of bars.
bars is a collection of generic TBar historical price bars. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.
CandlePart enum options
| enum / value | description |
|---|---|
CandlePart.Open0 | Open price |
CandlePart.High1 | High price |
CandlePart.Low2 | Low price |
CandlePart.Close3 | Close price |
CandlePart.Volume4 | Volume |
CandlePart.HL25 | (High+Low)/2 |
CandlePart.HLC36 | (High+Low+Close)/3 |
CandlePart.OC27 | (Open+Close)/2 |
CandlePart.OHL38 | (Open+High+Low)/3 |
CandlePart.OHLC49 | (Open+High+Low+Close)/4 |
Response
IReadOnlyList<TimeValue>- This method returns a time series of all available indicator values for the
barsprovided. - It always returns the same number of elements as there are in the historical price bars.
- It does not return a single incremental indicator value.
TimeValue type
| property | description |
|---|---|
TimestampDateTime | Date from evaluated TBar |
Valuedouble | Price of CandlePart option |
Utilities
See Utilities and helpers for more information.
Chaining
Results can be further processed on Value with additional chain-enabled indicators.
// example
var results = bars
.Use(CandlePart.OHLC4)
.ToRsi(..);This indicator must be generated from bars and cannot be generated from results of another chain-enabled indicator or method.
See Chaining indicators for more.
Streaming
Subscribe to a BarHub for streaming scenarios:
BarHub barHub = new();
BarPartHub observer = barHub.ToBarPartHub(CandlePart.HL2);
// call from your WebSocket or SSE message handler
void OnBarReceived(IBar bar) => barHub.Add(bar);
// results fill as the handler runs
IReadOnlyList<TimeValue> results = observer.Results;See Buffer lists and Stream hubs for full usage guides.
Buffering
Use a BarPartList for incremental buffering scenarios:
BarPartList buffer = new(CandlePart.Close);
// call from your WebSocket or SSE message handler
void OnBarReceived(IBar bar) => buffer.Add(bar);
// results fill as the handler runs
IReadOnlyList<TimeValue> results = buffer;