Extract first
Keeps only the first value of a multi-value indicator, such as the trend-strength line of ADX.
ExtractFirst wraps another indicator and reads its value on each bar. A single number passes through unchanged. A tuple or list gives back its first item. A source that returns nothing, or an empty tuple or list, gives no value. It has no settings; it lets an indicator that returns several values feed a rule or chart that expects one.
How to read it
- On the probe's price input the line sits over the candles and lies exactly on the close.
- Fed a multi-value indicator, it shows only that indicator's first value, such as ADX's trend strength.
- Read it as the first value of its source, not as a signal of its own.
What it outputs
- First value
- The source's value for the bar, or item 0 of a tuple or list. No value when the source returns nothing.
Pitfalls
- On the probe's SPY closes the output matched the close on every bar (correlation 1.0), so fed a price it only redraws the candles.
- Only item 0 is kept. For a tuple such as (adx, pdi, mdi) the two direction lines are dropped without any warning.
- A source that returns nothing gives no value, so expect gaps in the line rather than a flat zero.