Supported for-in empty array slice result negative body history

Category: market_structure

This script is a technical test case designed to validate Pine Script's behavior when a 'for-in' loop iterates over an empty array slice. It specifically checks the return value of the loop and its usage as a historical series index.

Formula

\text{source} = [0, 0] \\ \text{values} = \text{slice}(\text{source}, 1, 1) = [] \\ \text{length} = (\text{for } v \in \text{values} \rightarrow -1) = \text{na} \\ \text{result} = \text{close}[\text{na}]

See signal primitives, usage in published strategies and more on WOBR StrategyVerse.


Open in the WOBR AI app → · WOBR.AI home