How To Calculate Probabiltiy

Lets say you've developed a trading system. Now you need to evaluate it to make sure the results are better than chance. You need to calculate the probablilty.

A - total number highs and lows that occured during a the
    entire time period
w - window width (2 days, 2 weeks, 2 months, 2 years etc.)
t - total time window width you're analyzing in days
B - number of Highs and Lows (or indicator cross'if thats
    what you watch for) observed during the time being
    analyzed
K - Number of  times the signal coincided with a price high
    or low (i.e. the number of 'hits' )

note* (K<=B)
note*  the asterick symbol below (*) implies multiplication
 
Then
 
P = Probaility =  A*w / t
N = multiplier  = B! / (K! * (B-K)!)   where:
 
K! is K factorial; B! is B factorial  etc.  

lets say K = 3 then K! = 3 * 2 * 1  = 6
 
p = N*(PK)*((1-P)(B-K))  = total probability
    (probability that what is being observed is due to chance)