Bardate

V1 = GETDATA(CODE=SPY:US);
V2 = GETDATA(CODE=RSP:US);
V3 = GETDATA(CODE=IJH:US);
V4 = GETDATA(CODE=IJR:US);
V5 = GETDATA(CODE=QQQ:US);
V6 = MA(V1, STYLE=Exponential, CALC=Close, BARS=5) > MA(V1, BARS=200, STYLE=Exponential, CALC=Close);
V7= MA(V2, STYLE=Exponential, CALC=Close, BARS=5) > MA(V2, BARS=200, STYLE=Exponential, CALC=Close);
V8 = MA(V3, STYLE=Exponential, CALC=Close, BARS=5) > MA(V3, BARS=200, STYLE=Exponential, CALC=Close);
V9 = MA(V4, STYLE=Exponential, CALC=Close, BARS=5) > MA(V4, BARS=200, STYLE=Exponential, CALC=Close);
V10 = MA(V5, STYLE=Exponential, CALC=Close, BARS=5) > MA(V5, BARS=200, STYLE=Exponential, CALC=Close);
V11 = (V6+V7+V8+V9+V10);
V12 = V11 CrossesAbove 2;
V13 = V11 CrossesBelow 3;
V14 = V11 > 2;
V15 = V11 < 3;
IF(V14,BARDATE(V12),BARDATE(V13))

It is picking up 1/21/22 for date of last change. What am I doing incorrectly in script? I want to pick up last 
change in a script in the header.
Thanks, Jamie 



1-Trend-Model-Index-Detail.owb (325 KB)

Hi,

When i open your workbook the chart header shows the date as March 21st, 2022.

ex2

When I check the chart that date seems correct (the date the rank last crossed above 2)…

Ex1

This appears to match your script’s last line (If the rank is above 2 show the date the rank crossed above 2, otherwise show the last date the rank crossed below 3)

Hi Matthew, That is the script that is not giving the most recent 5D/200D cross?The data is thru 4/6/21 on the charts below on my computer. I did change the formula to 2.01 instead of 2 and 2.99 instead of 3 to get it to work.

V12 = V11 CrossesAbove 2.01;
V13 = V11 CrossesBelow 2.99;
V14 = V11 > 2;
V15 = V11 < 3;
IF(V14,BARDATE(V12),BARDATE(V13))

thanks, Jamie