|
|
Metastock
Formulas
- B
Click
here to go back to Metastock Formula
Index
IMPORTANT:
These formulas aren't my complete collection. For my complete
collection of instantly usable, profitable
and powerful MetaStock formulas Click
Here
|
Would
You Like To Use MetaStock To Its Full Potential? Discover the Amazingly
Simple Secret to Master Metastock Step-By-Step
- click
here
A | A 1 | B | B 1 | C | C 1 | D | D 1 | E | F | G | H | I | J | K | L | M | M 1 | N | O | P | R | S | S 1 | T | U | V | W | Z |
Perhaps
the above is enough for many traders, but a few further
MetaStock nuances can add to the value of the information
you've uncovered. For example, wouldn't you like to know
which stocks have met the chosen crossover criteria in the
past, say, five days? And wouldn't it be handy to be
able to sort your newly discovered stocks in order of price
or volume? If so, read on for a few more simple tips.
1.
Go back to the main Explorer tool section, highlight your
"Moving Average Crossover" Exploration, and hit the "edit"
key this time. You can now make alterations to your Exploration.
Ignore the upper "Notes" section and click on Column A first.
You will see a large white field for entry of formulas and
a small field in the lower left, entitled "Col Name." Simply
put a "c" in the large formula section and "Close" in the
column name section. Repeat these actions for Column B,
with "v" and "Volume" respectively. Now when your Exploration
presents you with your data, you can easily sort by price
(c) or volume (v).
2.
Finally, click on the "Filter" tab again to slightly modify
your Exploration formula. The way you have it set up initially
tells MetaStock to find all stocks which meet the criteria
today. You now want it to find all stocks that have met
these criteria over the past five days. The answer is the
MetaStock Alert function, which is written "Alert( A , Number
) where "A" is any formula you care to choose, and "Number"
is the number of days. So now you put your original formula
in the place of A. The result is: "Alert( Cross( Mov(C,3,E)
, Mov(C,10,E) ) ,5)" without the quotation marks. Save your
new Exploration with the "OK" button and you're ready to
find all stocks whose 3 day moving average passed above
the 10 day moving average in the past five trading days!
The
above information should allow you to write further Explorations
by simply changing the numbers. If you prefer to use Exponential
Moving Averages instead of Simple Moving Averages, change
"s" to "e" in the formulas. You can also open up the ready
made Equis Explorations, investigate how they're written,
and change them with the "Edit" command (then saving with
a new name). A further step is to investigate the hundreds
of formulas available here on this web site and modify them
in the same way. This is the quick and easy way to learn
how to program with MetaStock. Follow the examples given
by all the kind and clever MetaStock users who have gone
before you, and tweak, tweak, tweak.
(Go
Top) |
The
Barnes' Acceleration measures rate of price change as opposed
to price
levels
If the Barnes' Acceleration sustains the value of -1 for
many days then the
security may be ready to show strong trend or it may already
be trending.
Examine the chart for prolonged values at -1. This may indicate
an upcoming
stall or turnaround. The number of days needed may be different
depending on
the type of issue. A utility stock may need to sustain the
-1 level for 10
days whereas a highly volatile technology stock may need
to sustain the -1
trend for as little as 5 days.
From the 1981 Technical Commodity Yearbook, Robert M. Barnes
formula 1: if(mov(fml("Barnes' acceleration",2) - ref(fml("Barnes'
acceleration",2),-1),20,e)>0.0001,1, if(mov(fml("Barnes'
acceleration",2) -
ref(fml("Barnes'
acceleration",2),-1),20,e)<-0.0001,-1,0))
formula 2: mov((c-ref(c,-1))/ref(c,-1),daysm,e)
(Go
Top) |
Based
on the premise that closing price may be predictable based
on previous
closes
See (1981 Technical Commodity Yearbook Robert M. Barnes
Van Nostrand
Reinhold 1981) for theory and applications.
formula 1: if(fml("Barnes' adaptive forecast",2)>0.05,1,if(fml("Barnes'
adaptive forecast",2)<-0.05,-1,0))
formula 2: mov(c,dayf,e) - ref(mov(c,dayf,e),-1)
(Go
Top) |
See
(1981 Technical Commodity Yearbook Robert M. Barnes Van
Nostrand
Reinhold 1981) for theory and applications.
if (c - mov( c, dayf, e) > pf,
{ Then Action } 1,
{ Else Action } if ( mov( c, dayf, e) - c > pf, { Then
} -1, { Else } 0))
{ Notice that comments may be placed within braces }
(Go
Top) |
cum
((if ((mov((C-ref(C,-1)),21,s))>0,1,-1) * pwr(((mov((pwr(C-ref(C,-1),2)),21,s))+1),.5))
+ ((pwr(((pwr(C-ref(C,-1),2))+1),.5))) * if ((C>ref(C,-1)),1,-1))
(fml(" BPDL Trend Filter") - (ref((fml(" BPDL Trend Filter")),-21)))
/ ((hhv(fml(" BPDL Trend Filter"),21)) - (llv(fml("BPDL
Trend Filter"),21)))
BUY -1 SELL 1
(Go
Top) |
Col
A: CLOSE
Filter BarsSince(EngulfingBull())<=5 AND BarsSince(ROC(C,60,%)<-15)<=5
ANDBarsSince(Stoch(9,1)<10)<=5
Filter enabled Yes
Periodicity Daily
Records required 1300
(Go
Top) |
enter
long
When(Mov( Mid(C, opt1) ,opt1,E),>,Mov(Mid(C, opt1),opt2,E))AND
When(Ref(Mov(Mid(C,opt1),opt1,E),-1), <= ,(Ref(Mov((Mid(C,opt1)),opt2,E),-1)))AND
When(Mov(Abs((Mo(opt3))),opt4,E),>,Ref(Mov(Abs((Mo(opt3))),opt4,E),-1))
enter short
When(Mov( Mid(C, opt1) ,opt1,E),<,Mov(Mid(C, opt1),opt2,E))AND
When(Ref(Mov(Mid(C,opt1),opt1,E),-1), >= ,(Ref(Mov((Mid(C,opt1)),opt2,E),-1)))AND
When(Mov(Abs((Mo(opt3))),opt4,E),>,Ref(Mov(Abs((Mo(opt3))),opt4,E),-1))
OPT 1: 5 to 20 step 1
OPT 2:10 to 16 step1
OPT3:5 to 15 step 1
OPT4:20 to 29 step 1
but you are free to change any value of OPT!
(Go
Top) |
Col
A: CLOSE
Col B: ROC(C,5,%)
Filter: (ROC(C,5,%)>10 OR ROC(C,5,%)<-10) AND C>5
Filter enabled: Yes
(Go
Top) |
{created
by Jim Greening}
The basic idea behind a MetaStock binary wave is to use
"if" statements on several MetaStock indicators and have
them return plus one for a bullish indication, minus one
for a bearish indication, and zero for a neutral condition.
Then you add them all up for your binary wave indicator.
I decided to format all my indicators so they could be plotted
as a histogram. For these indicators plotting as histograms,
positive is bullish and negative is bearish. To cut down
on whipsaws, I decided that over +5 would be bullish, under
-13 would be bearish and anything in between would be neutral.
Therefore my binary wave formulas are:
BW2 Demand Index
If(Tema(DI(),21) > 5,+1,If(Tema(DI(),21) < -13,-1,0))
BW3 Linear Regression Slope
If(Tema(10000*LinRegSlope(C,34)/C,34) > 5,+1,
If(Tema(10000*LinRegSlope(C,34)/C,34) < -13,-1,0))
BW4 CCI
If(Tema(CCI(21),21) > 5,+1, If(Tema(CCI(21),21) <
-13,-
1,0))
BW5 ROC
If(Tema(ROC(C,21,%),21) > 2,+1,If(Tema(ROC(C,21,%),21)
<
-2,-1,0))
BW6 Money Flow
If(Tema(MFI(21),21)-50 > 5,+1,If(Tema(MFI(21),21)-50
< -5,-1,0))
BW7 CMO
If(Tema(CMO(C,21),21) > 5,+1,If(Tema(CMO(C,21),21)
< -5,-1,0))
BW8 VAR ma
If(Mov(C,21,VAR) > Mov(C,55,VAR) AND
HHV(Mov(C,233,VAR),5) =
HHV(Mov(C,233,VAR),13),+1,If(Mov(C,21,VAR) <
Mov(C,55,VAR) AND LLV(Mov(C,233,VAR),5) =
LLV(Mov(C,233,VAR),13),-1,0))
The next formula just adds up the binary wave.
BW Add
Fml("BW2") + Fml("BW3") + Fml("BW4") + Fml("BW5") +
Fml("BW6") + Fml("BW7") + Fml("BW8")
Next, I decided to do something a little different. Since
the whole purpose of this test is to catch a trending stock,
I decided to add an amplifier that would get larger as the
trend got stronger. Since I like Fibonacci numbers, I decided
to use Rsquared as a measure of trend strength and base
my amplifier on Fibonacci numbers. The formula I finally
came up with after a lot of tinkering follows.
BW Amplifier
If(RSquared(C,21) > 0.8,5,If(RSquared(C,21) >
0.6,3,If(RSquared(C,21) > 0.4,2,
If(RSquared(C,21)>0.2,1,0.5))))
The last step in constructing the binary wave was to decide
on the smoothing and put it all together. Of course, I used
tema smoothing.
Tema Binary Wave Composite
Periods := Input("Enter Tema Smoothing
Periods",8,233,21);
Tema(Fml("BW Add")*Fml("BW Amplifier"),Periods)
The final step is to come up with a system test for the
Tema Binary Wave Composite. Remember, the binary wave is
just made up of a bunch of technical indicators that I give
a +1 value when bullish, 0 when neutral, and -1 when bearish.
Then they are summed and smoothed. So in general a positive
value is bullish and a negative value is bearish. Also a
rising number is bullish and a falling number is bearish.
Therefore you could use a zero crossover to the upside as
a buy signal and a crossover to the downside as a sell signal.
If you had a good algorithm, you could also use a rise from
a negative peak (or trough) as a buy signal and a fall from
a positive peak as a sell signal. I decided to use a 8 day
moving average of the BW with a crossover of the BW for
my algorithm in an attempt to get an early signal on a rise
from a negative peak. It does have the disadvantage of finding
way too many peaks so I only use it as an Alert. For confirmation
I use the QStick function and a variable moving average
function.
QStick was developed by Chande as a way to quantify candlesticks.
Since the difference between the open and close prices lies
at the heart of candlestick charting, QStick is simply a
moving average of that difference. Negative values of QStick
correlate to black candlesticks, positive values to white
candlesticks. Since in general black candles are bearish
and white candles are bullish, this indicator can also be
plotted as a histogram and interpreted the same was as the
Binary Wave. The formula is:
Periods := Input("Enter Periods",1,233,34);
Tema(Qstick(Periods),Periods)
Now to get my open long signal I use the ALERT signal with
an 8 day vma BW crossover of the BW. Then to actually get
the signal, I have to have both the QStick rising and the
21 day vma greater then the 55 day vma.
Therefore my buy signal became:
Enter Long
Alert(Cross(Fml("Tema Binary Wave Comp"),
Mov(Fml("Tema Binary Wave Comp"),8,S)),21) AND
HHV(Tema(Qstick(34),34),5) = HHV(Tema(Qstick(34),34),13)
AND
Mov(H,21,VAR) > Mov(H,55,VAR)
Since the market has an upward bias, I wanted my sell signal
to be more restrictive. Therefore instead of trying to catch
a fall from a positive peak as my sell alert, I wanted a
crossover of an optimized negative number. I still used
QStick and vma to confirm and also added that the close
should be lower than yesterdays low.
Therefore, my sell signal became:
Enter Short
Alert(Cross(-opt2,Fml("Tema Binary Wave Comp")),8) AND
Tema(Qstick(34),34) < -0.1 AND
C < Ref(L,-1) AND
Mov(L,21,VAR) < Mov(L,55,VAR)
Then I wanted exit conditions that were less then full signal
reversals. I decided that the BW being less than a negative
number would be my primary close long signal, but I also
wanted confirmation from other indicators. After a lot of
trial and error I used the following:
Close Long
Fml("Tema Binary Wave Comp") < -opt1 AND
Tema(Qstick(34),34) < 0 AND
LLV(Mov(L,21,VAR),5) = LLV(Mov(L,21,VAR),13)
Close Short
Fml("Tema Binary Wave Comp") > 0 AND
Tema(Qstick(34),34) > 0.08
Finally I also used Fibonacci numbers for my optimization:
Opt 1: Min 3, Max 13, Step 5
Opt 2: Min 3, Max 13, Step 5
(Go
Top) |
{I
was reading in Perry Kaufman's latest book and he described
a little
oscillator he called "Body Momentum". This simply calculates
the momentum of
the closes above the opens versus the closes below the opens.
The theory is
that as prices move up, closing prices will be higher than
opening prices
and vice-versa for down. If this oscillator is above 70
then the whites
(Candle-sticks) dominate and below 30 the blacks are dominant.}
{I also added a 3 day moving average to the calculation
(for smoothing).}
{Here is the code:}
Lb:=Input("Look-Back Period?",3,60,14);
B:=CLOSE - OPEN;
Bup:= Sum(B > 0, Lb);
Bdn:= Sum(B < 0, Lb);
BM:=(Bup/(Bup+Bdn))*100;
Mov(Bm,3,S)
(Go
Top) |
From:
Ton Maas
According to most analysts, the Chaikin Oscillator, a diverse
accumulation/distribution line, is a very good alternative
to the OBV (On Balance Volume) indicator. Chaikin Oscillator
basics are that a healthy trend will be confirmed by a healthy,
positive volume development in the trend direction. The
MFI (Money Flow Index) can also substitute for the Chaikin
Oscillator.
Chaikin Oscillator formula:
Mov(cum(((C-L)-(H-C)/(H-L))*V),3,E)-Mov(cum(((C-L)-(H-C)/(H-L))*V),10,E)
(Go
Top) |
Recently,
the "group" was able to supply me with the formula for making
a Histogram out of the "bands". I find this the most useful
application of Bollinger's formula. The following is the
picture I draw:
((C+2*Std(C,20) - Mov(C,20,S)) / (4*Std(C,20)))*4 - 2
Under "properties", I then drop in +2 and -2 (because I'm
not bright enough to program them in permanently). I think
this is a much better view of the bands. As the price moves
up and down as a % of the band width, all the classic applications
of other "oscillator type" indicators work well (divergence,
support/resistance, and overbought/oversold conditions when
the price exceeds the Standard Dev. of +/-2).
This is just one of ten indicators that I use ... but, for
traders trying to understand Bollinger's "envelopes", I
think this reconfiguration gives a simpler, cleaner view
which allows the technician to analyse the underlying issue
without the "squiggles".
(Go
Top) |
I
use the following indicators to show the price reversal
of Bollinger Band penetration:
Name: Upper BB Hookdown
Formula:
UpperBB:= Mov(C,20,S) +(2*(Std(C,20)));
C < UpperBB AND Ref(C,-1) > Ref(UpperBB,-1);
Name: Lower BB Hookup
Formula:
LowerBB:= Mov(C,20,S) -(2*(Std(C,20)));
C > LowerBB AND Ref(C,-1) < Ref(LowerBB,-1);
(Go
Top) |
I
am sure Steve has done something better, but here is a simple
(MetaStock) formula allowing you to draw Bollinger Bands
as an oscillator:
100*(C-Mov(C,20,S)+2*Stdev(C,20))/(4*Stdev(C,20))
(Go
Top) |
enter
long
high>(mov(Close,20,S)-std(Close,20,2)) and
ref(low,-7)<ref((mov(Close,20,S)-std(Close,20,2)),-7)
exit long
close<(mov(Close,20,S)+std(Close,20,2)) and
ref(close,-7)>ref((mov(Close,20,S)+std(Close,20,2)),-7)
and
Mov((RSI(14)- LLV(RSI(14),14))
/(HHV(RSI(14),14)-(LLV(RSI(14),14))),14,E)*100<70 and
ref((Mov((RSI(14)- LLV(RSI(14),14))
/(HHV(RSI(14),14)-(LLV(RSI(14),14))),14,E)*100),-3)>70
and
(mov(Close,20,S)+std(Close,20,2))>(mov(c,89,s)+(.062*(mov(c,89,s))))
(Go
Top) |
John
Bollinger describes BWI (Band Width Indicator) as the width
of the bands divided by the average of the price:
4*(std(C,20))/mov(C,20,S)
I don't know if adding the moving average changes the usefulness
of the prospecting; anyway, this is what Bollinger is suggesting.
I have written a MetaStock exploration to spot stocks whose
BWI has reached extreme low readings. This shows when the
BWI is at lower than its highest level for the last 250
days, divided by 3:
hhv(4*(std(C,20))/mov(C,20,S),250)/3
The stocks that pass this screening are usually in a non-trending
mood, or rather in an
horizontal trend where the Bollinger Bands normally represent
support and resistance levels. Otherwise, there are cases
where the stock is just pausing before resuming a trend.
In this second case the BWI doesn't remain under the trigger
level for a long time.
A further remark is that when the stock enters a low-BWI
period, it is often retesting a
previous support or resistance level.
Although I think BWI extreme lows are an interesting way
to find low risk / low volatility stocks, they don't give
any clue as of the direction of the following move.
(Go
Top) |
From:
Philip Schmitz
MetaStock v6 does not appear to provide an indicator which
shows the width of Bollinger
Bands, so I have concocted a simple one to suit my own needs:
"Band Width" = BBandTop(C, 70, E , 2) - BBandBot(C, 70,
E , 2)
As a next step, I would like to devise an indicator which
tells me how the current value of
"Band Width" relates to the overall range of Band Widths
for a specified period, or, since my interest is commodities,
the life of the contract -- in other words all data loaded.
Where, on a percentage basis, does it fall?
(Go
Top) |
BOSS
-- Synergy with Bollinger by John Lowe (March 1998 issue
of TAM, a Dutch
TA mag)
In this article John Bollinger gets mentioned as insisting
on using a Price/Close
indicator in conjunction with a combined Price/Volume indicator.
For example, Price
as a moving or exponential average, the Typical Price(High+Low+Close/3)
or one of
the other on this theme of existing varieties. Bollinger
strives for synergy, which has
to be confirmed by two of three indicators based on:
Closing-price, price and volume, the Bollinger Optimised
Synergy System (BOSS):
1st criteria -- Bollinger Bands are best used in conjunction
with Wilders' RSI(9 or 14),
an indicator based on closing price.
2nd criteria -- Price and volume, combined in the Chaikin
Oscillator, are the other part
of the BOSS.
According to most analysts, the Chaikin Oscillator, a diverse
accumulation/distribution line, is a very good alternative
to the OBV indicator.
Chaikin Oscillators' basics are that a healthy trend will
be confirmed by a healthy,
positive volume-development in the trend-direction. The
Chaikin Oscillator can be
substituted for with the Money Flow Index (MFI).
Chaikin Oscillator formula:
Mov(cum(((C-L)-(H-C)/(H-L))*V),3,E)-Mov(cum(((C-L)-(H-C)/(H-L))*V),10,E)
(Go
Top) |
A:Close
B:{Signal Buy=-1,Sell=1}
If(ADX(14)>30 and PDI(14)>MDI(14),-1,If(ADX(14)>30
and PDI(14)<MDI(14),1,0))
C:{setup}Ref(H,-2)>=Ref(H,-1) and Ref(H,-1)>=H and
Ref(L,-2)<=Ref(L,-1) and Ref(L,-1)<=L
D:{Entry}If(ADX(14)>30 and PDI(14)>MDI(14) and
Ref(H,-2)>=Ref(H,-1) and Ref(H,-1)>=H and
Ref(L,-2)<=Ref(L,-1) and
Ref(L,-1)<=L,HHV(H,3)+.125,IF(ADX(14)>30 and
PDI(14)<MDI(14) and Ref(H,-2)>=Ref(H,-1) and
Ref(H,-1)>=H and Ref(L,-2)<=Ref(L,-1) and
Ref(L,-1)<=L,LLV(L,3)-.125,0))
E:{Stop}If(ADX(14)>30 and PDI(14)>MDI(14) and
Ref(H,-2)>=Ref(H,-1) and Ref(H,-1)>=H and
Ref(L,-2)<=Ref(L,-1) and
Ref(L,-1)<=L,LLV(L,3)-.125,IF(ADX(14)>30 and
PDI(14)<MDI(14) and Ref(H,-2)>=Ref(H,-1) and
Ref(H,-1)>=H and Ref(L,-2)<=Ref(L,-1) and
Ref(L,-1)<=L,HHV(H,3)+.125,0))
F:ADX(14){Higher the better}
Filter:ColB and ColC
(Go
Top) |
Boomers
buysig
enter long
((adx(14)+adx(27))/2)>30 and pdi(27)>mdi(27)
exit long
c<=prev(llv(c,15)-.5, 1) or c<=.75*hhv(c,10)
Boomers watchsig**
enter long
prev(h,1)<=prev(h,2) and prev(l,1)>=prev(l,2) and
BullHarami()
exit long
c<=prev(llv(c,15)-.5, 1) or c<=.75*hhv(c,10)
Boomers watchsig 2**
(Ref not prev)
enter long
ref(h,-1)<=ref(h,-2) and ref(l,-1)>=ref(l,-2) and
BullHarami()
exit long
c<=ref(llv(c,15)-.5,-1) or c<=.75*hhv(c,10)
(Go
Top) |
These
are a collection of bottom signals. The search returns 1
for Ok and 0 for not ok.
- CLOSE
- EngulfingBull()
- MorningDojiStar()
- MorningStar()
- WhiteSoldiers()
(Go
Top) |
BradCCI:
From Bill S.
Plot 1: BradCCI Line 1: (((H+L+C)/3)-Mov(C,28,S))/(.015*Std(C,28))
Plot 2: BradCCI Line 2: Std(((h+l+c)/3),28)
To Line 1, you can also add trend lines, if you wish:
Plot 1:
1. BradCCI Line 1: (((H+L+C)/3)-Mov(C,28,S))/(.015*Std(C,28))
2. trend(100,100)
3. trend(-100,-100)
4. trend(0,0)
(Go
Top) |
Name:
RSI derivative index (EL) - C. Brown {EasyLanguage}
Formula:
Base:=Mov(RSI(14),6,S);
ATRcustom:=HHV(
ValueWhen(1,RSI(14)>Ref(RSI(14),-1),ATR(1))OR
ValueWhen(2,RSI(14)>Ref(RSI(14),-1),ATR(1))OR
ValueWhen(3,RSI(14)>Ref(RSI(14),-1),ATR(1)),14);
Part1:=
{up coefficient is a factor 2.3 and added}
(2.3*(Mov(ATRcustom, 15,S)));
Part2:=
{down coefficient is factor 2.1 and subtracted}
(2.1*(Mov(ATRcustom, 15,S)));
{Part3=if RSI closes up or equal to, than part1,
else, if RSI closes down, part2}
If( Base>=Ref(Base,-1),
{RSI up=TRUE, then} Base+Part1,{else}
{RSI up=FALSE,then} Base-Part2)
(Go
Top) |
The
system is a trend follower that appears to get you in at
the early in a trend. If the trend breaks down for any reason,
the system seems to take you out with relatively little
pain, and there is a relatively high
percentage of losing trades (usually around 50%). Therefore,
the system seems to perform best on issues that are prone
to make prolonged moves. The trick is to find those issues.
I do admit that the system is not perfect;
for instance, it is my belief that the exit could be improved
on winners to preserve more profit. However, I've been unable
to develop an alternative exit that improves the system
return.
I've been trading this system myself for about a year and
have had good results. Even in the April-September period
when everything seemed to stall and move sideways, I was,
at least able to hold my own and maintain my capital until
the October break-always started to occur. For awhile, until
I got bored with it, I phantom traded this system in the
Yahoo Investment Challenge. I typically made about 20% a
month using the system in that venue.
Buy
n :=opt2{Time periods};
BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 + LLV(HIGH,n);
Cross(CLOSE,bullfear) AND
DX(10) > opt1
Sell
n :=opt2{Time periods};
BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 + LLV(LOW,n);
CLOSE < bearfear
Optimize the time periods from 10 to 50 in increments of
1 while testing the DX from 5 to 30 in increments of 5 (you
can do it in increments of 1 but it takes longer). Once
the Optimal time period is determined in this manner,
then retest with the determined optimal time period and
the DX in increments of 1. Note that this system is intended
to be a stop and reverse system and you can use it to go
short as well if you'd like to.
(Go
Top) |
enter
long:
n :=opt2{Time periods};
BullFear := (HHV(HIGH,n) - LLV(HIGH,n))/2 + LLV(HIGH,n);
Cross(CLOSE,bullfear) AND
DX(10) > opt1
close long:
n :=opt2{Time periods};
BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 + LLV(LOW,n);
CLOSE < bearfear
(Go
Top) |
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?
(Go
Top) |
ColA:
CLOSE
Filter BarsSince(EngulfingBear())<=5 AND BarsSince(ROC(C,60,%)>15)<=5
AND BarsSince(Stoch(9,1)>90)<=5
Filter enabled Yes
Periodicity Daily
Records required 1300
(Go
Top) |
The
Breadth Thrust indicator is a market momentum indicator
developed by Dr. Martin Zweig. The Breadth Thrust is calculated
by taking a 10-day exponential moving average of the advancing
issues divided by the advancing plus declining issues.
According
to Dr. Zweig a Breadth Thrust occurs when, during a 10-day
period, the Breadth Thrust indicator rises from below 40
percent to above 61.5 percent. A "Thrust" indicates that
the stock market has rapidly changed from an oversold condition
to one of strength, but has not yet become overbought.
Dr.
Zweig also points out that there have only been 14 Breadth
Thrusts since 1945. The average gain following these 14
Thrusts was 24.6 percent in an average time frame of 11
months. Dr. Zweig also points out that most bull markets
begin with a Breadth Thrust.
To
plot the Market Breadth in MetaStock™ for Windows
you will need to:
-
Create
a composite security of the Advancing Issues + Declining
Issues in The DownLoader™.
-
In
MetaStock open a chart of the composite and a chart
of the Advancing Issues.
-
Tile
the charts so you can see both of them on the screen.
-
Drag
the plot of the composite into the chart of the Advancing
Issues.
-
Create
the custom indicator: mov( C / P, 10, E ), then plot
it on top of the plot of the composite (the composite's
plot will turn a purplish color ). If you get a flat
line then it was not plotted directly on top of the
composite's plot.
-
You
can then right-click on the Breadth Thrust, select Breadth
Thrust Properties, go to the Horizontal Lines page and
add horizontal lines at 40 and 60.
(Go
Top) |
If
you have Metastock formulas you would like to share,
Please email to
We look forward to hearing from you!
To learn
more about how to use Metastock and its formula click
here.
copyright
2003 MetaStock Website Home
Metastock®
is a registered trademark of Equis International.
|
|