Suppose you feel that some combination of events might result in a move up or down most of the time. The most obvious way to test such a theory is to crank up a trading strategy, enter the rules describing the events, and backtest. But some among you will feel more comfortable with knowing the mean and standard deviation of expected movements following such events. You’ll gain confidence knowing that 68% of the samples fell within plus or minus 1 standard deviation from the mean of such movements, and that 95% fell within plus and minus 2 standard deviations (assuming standard normal distributions, large enough sample size, etc.)
Fortunately there are two built-in indicators that can do those things for you if you have such a statistical bent. They are in the category called Selective Calculation, and they are named Selective Simple Moving Average, and Selective Standard Deviation. Here is how they work:
Example 1. You’d like to know if the S&P 500 goes up on Fridays if it went up the day before. You load up SPY and you insert the AND2 indicator from the Boolean category. Operand1 of the AND2 will be the Friday indicator. Operand2 will be the A>B indicator, where A is the one day lag of the spread between close and open – LAG(SPREAD(CLOSE,OPEN),1). B will be zero. This plots true (1.0) on all the Fridays where the day before saw a rise in price, and false (0) on all other days.
Now we are ready to insert the two selective indicators mentioned above. Both indicators will have exactly the same parameters. The Time Series parameter will be the spread between the Close and the Open. That is what we are taking the average and standard deviation of on the appropriate Fridays. The Condition parameter is just the AND2 that we built. The Periods parameter is the number of previous appropriate Fridays that we are sampling. At least 50 is probably reasonable.
Ploting the selective indicators as of November 19, 2004, we see that the mean of Friday movements as -.07, an average loss. The standard deviation, however, is .73, from which you might draw the conclusion that 68% of the past 50 movements were between 0.66 and -0.80. Maybe not the best risk!
Example 2. Your brother in law told you that you can you will get rich quick if you follow his simple plan. His plan is to take a long position for three days if SPY closes higher than yesterday, or the three day change in SPY volume is positive (rising volume). You can’t believe your brother in law could be so astute, so you decide to test his plan and prove statistically that he doesn’t know what he is talking about.
For the Condition parameter of the selective indicators, you will need an OR2 (Boolean again). Both operands of the OR2 are A>B, where B is 0 in both cases. For operand1, A is the 1 day momentum of the Close. For operand2, A is the 3 day momentum of the Volume.
The Time Series parameter of the Selective indicators needs to be the 3 day Lead of the 3 day change in Close. So you are measuring how much the SPY rises in 3 days. You discover that the average (using a sample size of 50) is about 0.28, and even higher throughout November 2004. Could your brother-in-law actually be right? The Standard deviation is 1.25, so surely he will have drawdown, but on average over time he makes some money. In fact, looking back, you see that the selective average was as high as 1.00 in 2003 and early 2004, while the standard deviation was as low as 1.00. Although he didn’t do well last summer, it looks like he made money for a year before that, and may be making money now again. Ok, so maybe he’s not so dumb after all.