Try the TIMESINCESIGNAL() function instead. This will count days since it turned up (positive number) or since it turned down (negative).

//Define moving average
10MA = MA(STYLE=Weighted, BARS=10);
//Time since the 10MA turned up or down
T1=TIMESINCESIGNAL(10MA Turns);
//Is 10MA sloping Up?
Up1 = 10MA IsUp;
//Multiply T1 by -1 to get negative numbers
T2 = T1 * -1;
//If Up1 is true use positive number, else use negative
IF(Up1 == 1,T1,T2)

The blue Show Bars indicate when the 10WMA turns, so SAR:ASX turned up 42 days ago, whereas OML:ASX turned down 23 days ago:

Thanks Darren, but I haven’t explained my goal properly. I want to know how many of the bars since the signal were down rather than just how long ago it was.

For example, I’d like the script to tell me it turned 8 bars ago and since then have 5 or more bars been “IsDown”?

Ah OK sorry. You don’t need to specify a date in the ACCSINCESIGNAL function - it implies the date when the turn is triggered. To count the number of down days since a turn:

10MA = MA(STYLE=Weighted, BARS=10) Turns;
C1 = CHANGE()<0;
//How many times has C1 occuured since 10MA occurred?
ACCSINCESIGNAL(C1, 10MA)

So taking the previous example, both SAR:ASX and OML:ASX have had 15 down days since the 10WMA turned (including signal day):