how to get total amount of positive close in (N) periods

how to get total amount of Negative close in (N) periods

```
Pclose = Close> Ref(Close, -1);
Nclose = Close < Ref(Close, -1);
main = Close;
permain = Param( "Periods", 14, 2, 200, 1 );
Pmain = IIf( Close > Ref(Close, -1), main, 0); // main Positive
Nmain = IIf( Close < Ref(Close, -1), main, 0); // main Negative
postive=Sum(Pmain, permain); // calculate all positive close periods
nagitve=Sum(Nmain, permain); // calculate all Negative close in N periods
fullmain = postive/ nagitve; // main ( main Positive / main Negative)
```

when i use sum function it give the total number happened

thank you