Counting Concurrent Events

Back to Special Queries

This query counts the number of consecutive days MSFT is up, by using two if statements. 

The first if statement incriments the variable ( daysUp ) when 1 day move > 0
The second resets the counter when 1 day move is not > 0

SHOW 
	1: daysUp 
WHEN 
       IF 1 day move of MSFT is more than 0 
          THEN daysUp = daysUp + 1 
       ENDIF 
    AND 
       IF 1 day move of MSFT is not more than 0 
	THEN daysUp = 0 
       ENDIF 

 

 


5/18/98 - changed second if to use is not more than 0 so the conditions are identical.