windowed
Create a sliding window over an array. Returns overlapping sub-arrays of the given size.
array(required): the source arraysize(required): window size
utlx
windowed([1, 2, 3, 4, 5], 3) // [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
windowed([1, 2, 3, 4, 5], 2) // [[1, 2], [2, 3], [3, 4], [4, 5]]utlx
let prices = $input.dailyPrices
{
movingAvg3day: map(windowed(prices, 3), (w) -> avg(w)),
consecutiveDups: filter(windowed($input.events, 2), (pair) -> pair[0].type == pair[1].type)
}