Problem with inconsistent updating of recursive loop

Hi all,

I’ve built a recursive loop to pass an integer “Hold Period” and the previous day’s closing price, “Prev adjClose”, a double, to future days. The Hold Period updates as I expect increasing by 1 each day, however, the previous day’s closing price is always the current day’s close. It has - to me - the same exact type of recusion setup logic as Hold Period so I don’t understand why one works and not the other.

Expected:
Day 1 => adjClose = 20, Prev adjClose=
Day 2 => adjClose = 20.15, Prev adjClose=20

Actual:
Day 1 => adjClose = 20, Prev adjClose=20
Day 2 => adjClose = 20.15, Prev adjClose=20.15

I’d appreciate thoughts on how I’ve setup this improperly.

Recursive test.knwf (89.7 KB)

Hi Rob,

welcome to the forum!
Unfortunately your workflow did not include the input table so it’s hard to give some proper advice.
Could you provide some data for testing?

4 Likes