Page 7                                                      

RSI and Moving Averages

{place in filter section}

C>MOV(C,5,E) AND C>MOV(C,200,E) AND CROSS(RSI(14),30)

{from Michael Arnoldi}

 

Alligator System Modifications

from Murray Richards . . .

Drag this to the chart and change it to a histogram and plot green

AO oscillator Green
If( Mov(( H+L)/2, 5, S)- Mov(( H+L)/2, 34, S),
>,Ref(Mov( ( H+L)/2, 5, S)- Mov(( H+L)/2, 34, S),-1),( Mov(( H+L)/2, 5, S)-
Mov(( H+L)/2, 34, S )),0)

Put in the same window and plot it red as a histogram
A Oscillator red
If( Mov( ( H+L)/2, 5, S)- Mov( ( H+L)/2, 34, S),
<,Ref(Mov( ( H+L)/2, 5, S)- Mov( ( H+L)/2, 34, S),-1), Mov( ( H+L)/2, 5,
S)- Mov( ( H+L)/2, 34, S),0)

Acc
Mov(( H+L)/2, 5, S)- Mov(( H+L)/2, 34, S)-
Mov(Mov(( H+L)/2, 5, S)- Mov(( H+L)/2, 34, S) , 5, S)

Put in its on window as a histogram and plot red
AC Red
If( Fml( "Acc" )<Ref( Fml( "Acc" ),-1) ,Fml( "Acc" ),0 )

Put in the same window and plot green

AC green
If( Fml( "Acc" )<Ref( Fml( "Acc" ),-1) ,Fml( "Acc" ),0 )


Start a new expert and chose highlights
color red

Fml( "AC RED" )AND Fml( "A Oscillator red" )


Color green

Fml( "AC Green" ) AND Fml( "A Oscillator Green " )

Save as a template


Working with DMI

{Smoothed DMI Index (20 Period Moving Average)}

Mov(PDI(14)-MDI(14),20,S)


OPEN LONG:
close>hhv(low,21)


CLOSE LONG:
close<llv(high,21)


by Dick Brow


Shark-32 System, Walter Downs

The Shark exit signals don't appear to be all that good. In some
cases, the sell signals provide good opportunities for short-selling,
but the signals appear to be too few and far between to rely on them
for sell signals for long trades. The Shark pattern occurs too
infrequently, and there's no guarantee it'll occur when the trend
reverses. With long trades, you'd have to look to other indicators,
such as CCI, as you say, or maybe Parabolic SAR. You could use price
breaking below certain moving averages, too -- or moving- average
crossovers.

Seems like entry but no exits in Shark. maybe standard CCI(13) with
200 and -150 triggers.

The shark pattern signals, in the third window in the chart I sent,
were really just alerts showing that the shark pattern had occurred on
those days. The shark system is based on the close rising above levels
set when the shark pattern occurs. The levels are set by the high and
low in the shark pattern, and the close must break through them within
25 days of the signal.

The shark pattern, in other words, isn't a buy or sell signal.

The buy signals were shown in the second window of the chart I sent.
The window is labeled "Shark buy signal." Also, the signals are marked
by green arrows over the price plot in the first window of the chart.

I didn't include sell signals in the chart I sent earlier today. In
the case of MU, the sell signals weren't very good, to be honest.

==========================

The Shark system is really based on two separate events: the occurrence
of the pattern and then the signal.

The pattern isn't the signal. The system gives a signal if and when
the stock breaks above the high point in the pattern over the next 25
days. The high on the first day of the pattern sets that high point.
It's like a resistance level, set by the highest point in the shark
fin. Sometimes the stock doesn't break above it, so there's no signal.
The Shark pattern shows consolidation, which may indicate an expansion
in price to come. But the breakout doesn't always occur.

If the stock breaks below the low point in the pattern, there's a sell
signal.

==========================

The idea behind the system is: Look for a three-bar shark pattern,
based on progressively smaller ranges. It looks like a shark fin. Once
that pattern appears, a level is set by the highest point in the fin,
which is the high(-2). In the scan, I call that level "Sharkhigh." To
get a buy signal, the price has to close above that level within 25
days. If you want to plot "sharkhigh" over a chart with the price, you
can do it with the "BuyOK" part of the Metastock formula by plotting
this in the Expert Adviser:

Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);

Shark:=If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2))=1,
{ try Ref(L,-1)>Ref(L,-2)), without the "=1"}
If(apex <= (Ref(H,-2)-(WB*Symmetry)) AND Apex >=
(Ref(L,-2)+(WB*Symmetry)) ,1,0),0);

Buyok:=Cross(C,ValueWhen(1,Shark=1,Ref(H,-2)));
{try Buyok:=ValueWhen(1,Shark=1,Ref(H,-2));}

Chk:=Cum(Buyok)-ValueWhen(1,Shark=1,Cum(Buyok));

ValidChk:=Alert(Shark=1,25);

Buy:= Buyok=1 AND Ref(Chk,-1)=0 AND ValidChk=1;

Buy OR Ref(Buy,-1) OR Ref(Buy,-2) OR Ref(Buy,-3) OR Ref(Buy,-4) OR
Ref(Buy,-5);

From: Brooke
=================================
For the pattern in the Indicator Builder:

Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);

If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2)),
If(apex <= (Ref(H,-2)-(WB*Symmetry)) AND Apex >=
(Ref(L,-2)+(WB*Symmetry)) ,1,0),0);

That's like a resistance level that the price has to break through. It
lasts for 25 days or until a new Shark signal appears.

=================================

Combining Statistical and Pattern Analysis, Shark – 32 - Walter T.
Down, TASC 10/1998
Equis

First, choose Expert Adviser from the Tools menu in MetaStock 6.5.
Next, choose New and enter the following formulas:

Name:
Click the Name tab and enter "Shark – 32" in the Name field.

Trends:
Click the Trends tab and enter the following formulas in the Bullish
and Bearish fields.

Bullish: Mov(C,5,S)>Mov(C,20,S);

Bearish: Mov(C,5,S)<Mov(C,20,S);

Highlights:

Click the Highlights tab, choose New, and enter "3rd Bar" in the Name
field. Now change the color in the Color field to Blue. Finally, enter
the following formula in the Condition field, and then choose OK.

Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);
Shark:=If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2))=1,If(Apex <=
(Ref(H,-2)-(WB*Symmetry)) AND Apex >= (Ref(L,-2)+(WB*Symmetry))
,1,0),0);
Shark;

Using the same method as above, enter the following 2 highlight
formulas.

Name: 2nd Bar
Color: Blue
Condition:
Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);
Shark:=If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2))=1,If(Apex <=
(Ref(H,-2)-(WB*Symmetry)) AND Apex >= (Ref(L,-2)+(WB*Symmetry))
,1,0),0);
Ref(Shark,+1)=1;

Name: 1st Bar
Color: Blue
Condition:
Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);
Shark:=If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2))=1,If(Apex <=
(Ref(H,-2)-(WB*Symmetry)) AND Apex >= (Ref(L,-2)+(WB*Symmetry))
,1,0),0);
Ref(Shark,+2)=1;

Symbols:
Click the Symbols tab, choose New and enter "Shark Buy" in the Name
field. Now enter the following formula in the Condition field.

Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);
Shark:=If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2))=1,If(apex <=
(Ref(H,-2)-(WB*Symmetry)) AND Apex >= (Ref(L,-2)+(WB*Symmetry))
,1,0),0);
Buyok:=Cross(C,ValueWhen(1,Shark=1,Ref(H,-2)));
Chk:=Cum(Buyok)-ValueWhen(1,Shark=1,Cum(Buyok));
ValidChk:=Alert(Shark=1,25);

{Note* The above ValidChk variable makes the Shark signal valid for 25
periods. If the price does not cross above the High value of the base
within 25 periods, you will not receive a signal. You can change the
number of periods by changing 25 to the number of periods you desire.
*}

Buy:= Buyok=1 AND Ref(Chk,-1)=0 AND ValidChk=1;
Buy;

Click the Graphic tab. Change the symbol in the Graphic field to Buy
Arrow. Now change the color in the Color field to Green. Finally, type
"Buy" in the Label field, and then choose OK.

Using the Same method as above, enter the following Symbol formula.

Name: Shark Sell
Condition:
Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);
Shark:=If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2))=1,If(apex <=
(Ref(H,-2)-(WB*Symmetry)) AND Apex >= (Ref(L,-2)+(WB*Symmetry))
,1,0),0);
Sellok:=Cross(ValueWhen(1,Shark=1,Ref(L,-2)),C);
Chk:=Cum(Sellok)-ValueWhen(1,Shark=1,Cum(Sellok));
ValidChk:=Alert(Shark=1,25);

{Note* The above ValidChk variable makes the Shark signal valid for 25
periods. If the price does not cross below the Low value of the base
within 25 periods, you will not receive a signal. You can change the
number of periods by changing 25 to the number of periods you desire.*}

Sell:= Sellok=1 AND Ref(Chk,-1)=0 AND ValidChk=1;
Sell;
Symbol: Sell Arrow
Color: Red
Label: Sell

 

Building Metastock System Tests

Here's an excellent short article from Jim Greening, showing how MetaStock system tests can be built up . . .

This week I'm going to discuss my third MetaStock Profit System Test - 03_Tema PDI - MDI, ADX (Vol Required). This test is based on Wilder's directional movement indicators. As the MetaStock manual indicates, Wilder says a buy signal occurs when PDI - MDI moves above zero and a sell signal occurs when PDI-MDI falls below zero. I started with that thought and experimented a little. Wilder used 14 day periods to calculate his PDI and MDI functions. Since I like Fibonacci numbers, I used 13 days instead. Also I like to smooth my indicators so I used Tema smoothing. My custom PDI - MDI formula then became:

Tema PDI - MDI
Periods := Input("Enter Tema Smoothing Periods",8,55,13);
Tema(PDI(13) - MDI(13),Periods)

I started with the idea that I would take the PDI-MDI crossover of an optimized number as my basic buy and sell trigger. However, this number did not have to be zero and did not have to be the same for entering long and entering short. After a lot of trial an error I decide -1, -3, or -5 would be my enter long number and -5, -13, or -21 would be my enter short number. This makes sense since the market is biased to the up side, so entering a little under zero would get us in a little earlier. Also down moves tend to be fast an extreme and this would only let us in short for larger, faster down moves which is what I wanted. Finally I wanted some way to reduce the number of false signals and I wanted to do that with directional movement indicators only so this test would be completely uncorrelated with my other tests.
For long positions, I notice that most up moves started when adx was low and that adx climbed during the move to a max and then started to fall at the end of the move. Therefore, I thought an adx max and min for a buy signal would help reduce false signals. After some experimenting, I set the min at 8 and the max at 21. I also noticed that most good buy points occurred when MDI and ADX were close together so I decided that the difference between the two should be small. After more experimenting, I decided on the following for my open long signal:

Open Long:
Alert(Cross(Fml("Tema PDI - MDI"),opt1),13) AND
MDI(13) - ADX(13) <= 4 AND
MDI(13) - ADX(13) >= -2 AND
ADX(13) >= 8 AND
ADX(13) <= 21

To close my open long position I wanted the PDI-MDI to be less than opt1. When a stock starts to drop, the MDI starts to rise, so I wanted the MDI to be greater than a certain number to close a position. Finally, since markets are biased upwards, I also wanted the 55 day variable moving average to be dropping before I closed the position. Therefore, the close long became:

Close Long:
Fml("Tema PDI - MDI") < opt1 AND
MDI(13) > 21 AND
LLV(Mov(L,55,VAR),5) = LLV(Mov(L,55,VAR),13)

To open a short position, I wanted the PDI-MDI to cross below a fairly high negative number. I wanted confirmation in that the adx was still fairly high when that happened. The answer was:

Open Short:
Alert(Cross(opt2,Fml("Tema PDI - MDI")),8) AND
ADX(13) > 34

To close the short position, I only wanted PDI-MDI to be greater than a certain positive number. I don't like a lot of confirmations for closing shorts. With the bias being up, you need to close shorts fast. My close Short and optimization became:
Close Short:
Fml("Tema PDI - MDI") > 13

Optimization:
Opt1: Min = -1 Max = -5 Step = 2
Opt2: Min = -21 Max = -5 Step = 8

That's it. Any comments or questions?

JimG


Are There Weekly Patterns in the Stock Market?

Do price pressures build up over the weekend that cause predictable distortions in the stock market on Monday? If the market is up or down a certain number of days in a row, what are the chances it will follow the trend the next day? Is the trend on Monday reversed on Tuesday? To find out, we loaded our S&P 500 data back to 1980, and ran a test. The results were this - the trend on Monday (either up or down) was reversed 55% of the time, a fairly significant result. This might tell us that the weekend causes an emotional buildup that moves the market an excessive amount on Monday, which is then corrected by Tuesday. Larger stocks, as represented by the Dow Jones Industrial Average, reversed slightly less - 54% of the time. Small stocks, as represented by the Russell 2000 (data back to 1990) showed the opposite pattern, going with the trend 60% of the time.

In the futures markets, the US dollar (data back to 1990) reversed 54% of the time, and the 30 year treasury bond (data back to 1987) reversed 53% of the time.

In recent years, the pattern has been less pronounced. In fact, if you study just the last two years, you get reversals of 53% in the Dow, 52% in the S&P 100, a continuation in the trend 50.5% of the time in the S&P 500 and a continuation 54% of the time in the Russell 2000 . The US dollar has reversed 58% of the time in the last two years, the CRB index 54% of the time, while other futures have shown continuation trends - 55% for gold, 54% for treasury bonds, and 55% for crude oil.

Next, we studied every possible price trend for the five day period. A nice Thursday trend emerged - if Monday and Tuesday went one direction, and then Wednesday reversed this trend, there was a 62% chance that Thursday would continue this reversal (we’ll represent this as XXOO, where X just means one direction, not necessarily up or down, and O means the other direction). If the first four days of the week all moved in the same direction (XXXX), Friday had a 61% chance of doing the same (XXXXX). And if Tuesday reversed Monday, but was then reversed by Wednesday, and the trend continued Thursday, there was a 63% chance that Friday would continue the trend set Wednesday (XOXXX).

The MetaStock formulas for the Tuesday calculation are included below. Formulas for the remaining days of the week build on these formulas, and are too extensive to include here (you need 2 formulas for Tuesday, 4 for Wednesday, 8 for Thursday, and 16 for Friday).

To build an exploration that looks for stocks with a high incidence of Tuesday reversal, simply put the formula "Tuesday % occurrence. of XX vs. XO" in a column in the Explorer, run an exploration on all of your securities, then sort by the aforementioned formula.

======================
Formula "Tuesday XX Pattern"

{ Looks for XX pattern, returns +1 if it finds it }
If(Ref(DayOfWeek(),-2) = 5 {2 days ago was Fri} AND
Ref(DayOfWeek(),-1) = 1 {Yesterday was Mon}
AND
DayOfWeek() = 2 {Today is Tuesday}
AND { Either both days were up or down }
((Ref(CLOSE,-2) > Ref(CLOSE,-1) AND
Ref(CLOSE,-1) > CLOSE ) OR
(Ref(CLOSE,-2) < Ref(CLOSE,-1) AND
Ref(CLOSE,-1) < CLOSE )) ,
+1, { +1 if XX pattern }
0) { Otherwise 0 }

======================
Formula "Tuesday XO Pattern"

{ Looks for XO pattern, returns +1 if it finds it }
If(Ref(DayOfWeek(),-2) = 5 {2 days ago was Fri} AND
Ref(DayOfWeek(),-1) = 1 {Yesterday was Mon}
AND
DayOfWeek() = 2 {Today is Tuesday}
AND { Tuesday is opposite direction of Monday }
((Ref(CLOSE,-2) > Ref(CLOSE,-1) AND
Ref(CLOSE,-1) < CLOSE ) OR
(Ref(CLOSE,-2) < Ref(CLOSE,-1) AND
Ref(CLOSE,-1) > CLOSE )) ,
+1, { +1 if XO pattern }
0) { Otherwise 0 }

======================
Formula "Tuesday % occurrence. of XX vs. XO"
{ Gives the % occurrence of XX (that Tuesday goes the same direction as Monday) }

Cum(Fml("Tuesday XX pattern"))/
(Cum(Fml("Tuesday XX pattern")) + Cum(Fml("Tuesday XO pattern")) ) * 100

======================

Note that unchanged days, either Monday or Tuesday, are ignored in the calculations.

by John DeBry

 

Kauffman's Adaptive RSI

MetaStock formula derived from calculations in Trading Systems and Methods, Third Edition, by Perry J. Kaufman.
This formula adapts the standard RSI to a smoothing constant.


Period := Input("Period",1,10000,20);

sc := Abs(RSI(Period)/100 - .5)*2;

If(Cum(1) <= Period, CLOSE,
PREV + sc*(CLOSE - PREV))
 

Market Pressure-Ultimate

This is the basic calculation:
If today's close is greater than yesterdays close and
today's volume is greater than yesterdays volume, write down today's volume * close, otherwise,
If today's close is less than yesterdays close and
today's volume is less than yesterdays volume, write down today's volume as a negative number * close, otherwise write down 0.

Then add up the past 7 days and * 4, add this to
the past 14 days total and * 2, add this to
the past 28 days total.
Plot this grand total in your chart for each new trading day.

Simple Interpretation:
Market Pressure - Ultimate can show divergences with the instrument it is plotted against.
It may show signs of support and resistance when the indicator hits areas of support/resistance on its own graph.
Comparing rates of change/moving averages of the indicator against that of the instrument may reveal accumulation/distribution pressures.

Metastock code for Market Pressure - Ultimate:

Sum(If(C > Ref(C,-1)
AND V > Ref(V,-1),
V * C,
If(C < Ref(C,-1)
AND V < Ref(V,-1),
Neg(V) * C,0)),7) * 4 +

Sum(If(C > Ref(C,-1)
AND V > Ref(V,-1),
V * C,
If(C < Ref(C,-1)
AND V < Ref(V,-1),
Neg(V) * C,0)),14) * 2 +

Sum(If(C > Ref(C,-1)
AND V > Ref(V,-1),
V * C,
If(C < Ref(C,-1)
AND V < Ref(V,-1),
Neg(V) * C,0)),28)


Changing Ways Accumulation/Distribution

This is the calculation for the first formula (Today's Change):
Today's close - yesterdays close

This is the main formula, incorporating the first calculation:
If today's change (1st formula) is greater than a 7 day exponential moving average of today's change and today's close is greater than yesterdays close, write down today's close + today's volume, otherwise,
If today's change is less than a 7 day exponential moving average of today's change and today's close is less than yesterdays close, write down the negative value of today's close + today's volume, otherwise write down 0.

Then add up all the days values and keep a cumulative running total for each new trading day.

Simple Interpretation:
Changing Ways Accumulation/Distribution can show divergences against the instrument.
When compared against volume activity, it can show what impact a day of high turnover had on the share price for the coming periods. This is to say that if a day had high volume and there was little movement in the indicator alongside this, then you can suggest that all the volume for that day was absorbed into the price and there is less likelihood of buying/selling pressure in that day taking hold in the market in future trading days.

Metastock code for Changing Ways Accumulation/Distribution:

Cum(If(Fml( "Today's Change" ) > Mov(Fml( "Today's Change" ),7,E) AND C > Ref(C,-1),
C + V,
If(Fml( "Today's Change" ) < Mov(Fml( "Today's Change" ),7,E) AND C < Ref(C,-1),
Neg(C + V) ,0)))

Where Fml( "Today's Change" ) = c - ref(c,-1)


Front Weighted 36 Day Moving Average

This indicator requires 3 sub calculations and then the totalling of all 3 to get the final indicator:

This is the basic calculation:
Take the closing prices of your instrument 34 days ago - 26 days ago (inclusive), multiply each daily value by 0.01 and write each value down.
Then take the closing prices of your instrument 25 days ago - 18 days ago (inclusive), multiply each daily value by 0.02 and write each value down.
Then take the closing prices of your instrument 25 days ago - 18 days ago (inclusive), multiply each daily value by 0.02 and write each value down.
Then take the closing price of your instrument 17 days ago and multiply by 0.03 ad write the value down.
Then take the closing price of your instrument 16 days ago - 8 days ago (inclusive), multiply by 0.031 and write each value down.
Then take the closing price of your instrument 7 days ago - 6 days ago (inclusive), multiply by 0.006 and write each value down.
Then take the closing price of your instrument 5 days ago - 1 day ago (inclusive), multiply by 0.07 and write each value down.
Then take the closing price of your instrument today, multiply by 0.079 and write this value down.

Finally, add up all the values that you wrote down and plot the value on the chart, repeat this for every new trading day.

Simple Interpretation:
Front Weighted 36 Day Moving Average is similar to all other moving averages. The interpretation is just as with all others, the trend is up when prices are above the moving average and the trend is down when prices are below the moving averages. This particular variation attempts to weight the data at the front more than that at the back, with a sliding scale for each trading days value.

Metastock code for Front Weighted 36 Day Moving Average:

Fml( "1FrontWeighted36BarMA1" ) +
Fml( "2FrontWeighted36BarMA2" ) +
Fml( "3FrontWeighted36BarMA3" )

Where Fml( "1FrontWeighted36BarMA1" ) =
0.01 * Ref(P,-34) +
0.01 * Ref(P,-33) +
0.01 * Ref(P,-32) +
0.01 * Ref(P,-31) +
0.01 * Ref(P,-30) +
0.01 * Ref(P,-29) +
0.01 * Ref(P,-28) +
0.01 * Ref(P,-27) +
0.01 * Ref(P,-26) +
0.02 * Ref(P,-25) +
0.02 * Ref(P,-24) +
0.02 * Ref(P,-23) +
0.02 * Ref(P,-22) +
0.02 * Ref(P,-21) +
0.02 * Ref(P,-20) +
0.02 * Ref(P,-19) +
0.02 * Ref(P,-18)

Where Fml( "2FrontWeighted36BarMA2" ) =
0.03 * Ref(P,-17) +
0.031 * Ref(P,-16) +
0.031 * Ref(P,-15) +
0.031 * Ref(P,-14) +
0.031 * Ref(P,-13) +
0.031 * Ref(P,-12) +
0.031 * Ref(P,-11) +
0.031 * Ref(P,-10) +
0.031 * Ref(P,-9) +
0.031 * Ref(P,-8) +
0.006 * Ref(P,-7) +
0.006 * Ref(P,-6) +
0.07 * Ref(P,-5) +
0.07 * Ref(P,-4) +
0.07 * Ref(P,-3) +
0.07 * Ref(P,-2)

Where Fml( "3FrontWeighted36BarMA3" ) =
0.07 * Ref(P,-1) +
0.079 * P

 

Excel Confidence %

This is the calculation:

Take toadies volume * 50 and find the square root of that number. Then divide 2.5 by your result. Then take the result of dividing by 2.5 and * today's close. Write this figure down.
Then plot a 10 day moving average of this figure. This is the fundamental calculation which we shall call a.

Take the value for a and take it away from the lowest value of itself over the past 5 days. Add up these results for the past 3 days. This number is called b.

Now take the highest value for a over the past 5 days and subtract the lowest value for a, also over the past 5 days. Call this number c.

Finally, divide b by c and multiply the answer by 100. (phew!)

Simple Interpretation:
Excel Confidence % should oscillate between 0 and 100, usually at the extreme ends of the scale. A value of 0 indicates no confidence in the market going up, whilst 100 indicates perfect confidence in the market going up. Although this obviously isn't the holy grail of indicators, it does offer some insight into what the market is thinking and how one can measure investor sentiment.
You might like to add a slower version of this (just increase the 3 day and 5 day calculations to something you believe to be appropriate - try 7 & 15) and trade the crossovers, as with stochastics.
You can also just trade the values ie 90 or higher, buy, 10 or lower, sell.

Metastock code for Excel Confidence %:

(Sum(
Mov(C * (2.5/ Sqrt(50 * V)),10,S)-
LLV(Mov(C * (2.5/ Sqrt(50 * V)),10,S),5), 3 ) /
Sum(
HHV(Mov(C * (2.5/ Sqrt(50 * V)),10,S),5) -
LLV(Mov(C * (2.5/ Sqrt(50 * V)),10,S),5), 3) ) * 100