Total amount of positive and Negative

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

this working

arry = Close ; /// ///
perRS= Param( "Periods", 14, 2, 200, 1 );
Parry =IIf( Close > Ref(Close, -1), abs(arry), 0); //Positive close 
Narry = IIf( Close < Ref(Close, -1), abs(arry), 0); // Negative close 


totalup=Sum(Parry, perRS);
testdw=Sum(Narry, perRS);

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.