# Z-Score calculation for a win-loss streak

I am trying to find the correlation between wins and losses by applying Z-Score according to formula attached below. I put them in an array by assigning 1 to wins and -1s to losers. I am trying to determine if winners follow winners or losers follow losers. What I wanna ask is before applying Z-Score into this should I remove non-streaks from this array? (When I include non-streaks I find Z-Score -125 which is not a logical number)

my array=[1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,1...]

The formula of the z-score is

Z=(N*(R-0.5)-P)/((P*(P-N))/(N-1))^(1/2)

N - total number of trades in a series
R - total number of series of profitable and losing trades
P = 2*W*L;
W - total number of profitable trades in the series;
L - total number of losing trades in the series.


Your source is not particularly clear about why what they're doing is a Z-score. To give some background, what they're doing is calculating $$\frac{R-\mu_{R}}{\sigma_{R}}$$ where R is the number of runs and the mean and standard deviation are of the number of runs. It's really more of a test statistic than a Z-score per se. The denominator in their formula is actually the same standard deviation as is used in the Wald-Wolfowitz runs test but divided by $N$ (which cancels out from the mean). While I get a slightly different result if I calculate the Z-score solely using the Wald-Wolfowitz values for the mean of runs, it is conceptually the same thing.