Login Page - Create Account

Support Board


Date/Time: Sun, 12 May 2024 05:54:04 +0000



Post From: Return Last Two Zig Zag Reversal Values - Possible to store n number of values?

[2019-07-30 19:19:09]
Sawtooth - Posts: 3995
Is there a way to store the prior x values without using one column for each value in a spreadsheet as is demonstrated in the following copied from the help files?
Yes, use the INDEX/NMATCH function combination, like this:

(where the Zigzag study is ID1 and 'Additional Output For Spreadsheets' is set to Yes.)
In cell O3:
=ID1.SG3@3>0
This will return a 1 at every Zigzag leg.
In cell P3:
=INDEX(ID1.SG3@3:OFFSET(ID1.SG3@3,$J$30-1,0),NMATCH(1,1,O3:OFFSET(O3,$J$30-1,0),0),1)
This will return the Reversal Price to Row 3 of the most recent Zigzag leg.
In cell Q3:
=INDEX(ID1.SG1@3:OFFSET(ID1.SG1@3,$J$30-1,0),NMATCH(2,1,O3:OFFSET(O3,$J$30-1,0),0),1)
This will return the Reversal Price to Row 3 of the second most recent Zigzag leg.
An alternate way to return the Reversal Price to Row 3 of the second most recent Zigzag leg:
In cell Q3: =IF(O3,P4,Q4).
Date Time Of Last Edit: 2019-07-30 21:23:40