What exactly are you looking for? Only first three record of the table neither they are positive or negative, and if they are negative to calculate them?
Or only first three negative values that appearing in data set among others, i.e. in your pic there are 10 green values and then two red, so for you result should be 2? Two negative values?
And where do you calculate negative and positive, in script or in UI using expression? Simple way is in script add Negative, Positive flag, f.e.
if(C<0,0,1) as PNflag
In result you will see the table like that:
So, using similar logic in script helps you further to count negative values in more esier way. This is true in order if you can identify positive or negative in script. In other way it will be more interesting solution using advanced formulas.