Metastock
Formulas
 W
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 StepByStep
 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 
In
an up trend, three or four successive lower CLOSES and the
EMA(21) is rising.
SimpleX LONG:
C <= Ref(C,1) AND
Ref(C, 1) <= Ref(C, 2) AND
Ref(C, 2) <= Ref(C, 3) AND
Mov(C, 21, E) > Ref(Mov(C, 21, E), 1)
OR
C <= Ref(C,1) AND
Ref(C, 1) <= Ref(C, 2) AND
Ref(C, 2) <= Ref(C, 3) AND
Ref(C, 3) <= Ref(C, 4) AND
Mov(C, 21, E) > Ref(Mov(C, 21, E), 1)
SimpleX SHORT:
C >= Ref(C,1) AND
Ref(C, 1) >= Ref(C, 2) AND
Ref(C, 2) >= Ref(C, 3) AND
Mov(C, 21, E) < Ref(Mov(C, 21, E), 1)
OR
C >= Ref(C,1) AND
Ref(C, 1) >= Ref(C, 2) AND
Ref(C, 2) >= Ref(C, 3) AND
Ref(C, 3) >= Ref(C, 4) AND
Mov(C, 21, E) < Ref(Mov(C, 21, E), 1)
Rig this up with an OB/OS oscillator and you've got an entry
that is, well, at least worth considering.
(Go
Top) 
MetaStock
Weekly Indicators
I had basically put the weekly indicators on daily charts
thing on the back burner for the time being, but someone
mentioned the subject in an off list email, and I decided
that maybe I should post these two indicators. They look
right to me, but double check them. Remember, they plot
the previous weeks value beginning the first trading day
of the following week, and that value remains constant throughout
that week. These are designed for backtesting.....so if
you just gotta know on this Friday evening what the weekly
value of the indicator is going to be for the following
week, simply look a weekly chart.
Stochastic: The %K and %K slowing can be coded to accommodate
more parameters by using the user Input function, but when
you do this the %D always calculates using the default value
of the %K slowing, giving erroneous values. So I just left
it as is. Youcan plug in your own values...I just used the
MetaStock default values as a starting point. I made the
%K D as two separate indicators so that you can plot the
%D a different color and/or dashed. The Momentum indicator
uses the Input function just fine.
{`Wkly Stoch 5 per %K, slowing=3, no %D}
{start week}
sw:=If(DayOfWeek()<=Ref(DayOfWeek(),1),1,0);
yestClo:=If(sw>0,Ref(C,1),0);
{lowest low last 5 weeks}
LLow:=(ValueWhen(1,sw>0,
Ref(LowestSince(5,sw>0,L),1)));
{highest high last 5 weeks}
HHigh:=(ValueWhen(1,sw>0,
Ref(HighestSince(5,sw>0,H),1)));
{5 per %K, slowing=3}
y:=(ValueWhen(1,sw>0,(yestCloLLow))+
ValueWhen(2,sw>0,(yestCloLLow))+
ValueWhen(3,sw>0,(yestCloLLow)))/
((ValueWhen(1,sw>0,HHigh)+
ValueWhen(2,sw>0,HHigh)+
ValueWhen(3,sw>0,HHigh))
(ValueWhen(1,sw>0,LLow)+
ValueWhen(2,sw>0,LLow)+
ValueWhen(3,sw>0,LLow)))*100;
y;
{`Wkly Stoch 3 per %D of a 5 per %K, slowing=3}
{start week}
sw:=If(DayOfWeek()<=Ref(DayOfWeek(),1),1,0);
yestClo:=If(sw>0,Ref(C,1),0);
{lowest low last 5 weeks}
LLow:=(ValueWhen(1,sw>0,
Ref(LowestSince(5,sw>0=1,L),1)));
{highest high last 5 weeks}
HHigh:=(ValueWhen(1,sw>0,
Ref(HighestSince(5,sw>0,H),1)));
{5 per %K, slowing=3}
y:=(ValueWhen(1,sw>0,(yestCloLLow))+
ValueWhen(2,sw>0,(yestCloLLow))+
ValueWhen(3,sw>0,(yestCloLLow)))/
((ValueWhen(1,sw>0,HHigh)+
ValueWhen(2,sw>0,HHigh)+
ValueWhen(3,sw>0,HHigh))
(ValueWhen(1,sw>0,LLow)+
ValueWhen(2,sw>0,LLow)+
ValueWhen(3,sw>0,LLow)))*100;
{This plots the 3 period %D (ma) of the above.}
z:=(ValueWhen(1,sw>0,y)+ValueWhen(2,sw>0,y)+
ValueWhen(3,sw>0,y))/3;
z
{`Wkly Momentum for DAILY Chart }
{This plots WEEKLY Momentum on DAILY charts. Ken 4/16/99}
n:=Input("Periods",1,20,10);
{start week}
sw:=If(DayOfWeek()<=Ref(DayOfWeek(),1),1,0);
(ValueWhen(1,sw>0,Ref(C,1))/
ValueWhen(n+1,sw>0,
Ref(C,1)))*100
(Go
Top) 
{Weekly
Pivot Point Projection 8/4/99}
Dw:=If(DayOfWeek()<=Ref(DayOfWeek(),1),1,0);
{Weekly Typical Price}
PP1:=If(Dw=1,
{then}(Ref(HighestSince(1,Dw=1,H),1)+
Ref(LowestSince(1,Dw=1,L),1) +
Ref(C,1))/3,
{else}0);
{Weekly High}
Wh1:=If(Dw=1,
{then}Ref(HighestSince(1,Dw=1,H),1),
{else}0);
{Weekly Low}
Wl1:=If(Dw=1,
{then}Ref(LowestSince(1,Dw=1,L),1),
{else}0);
Wh:=ValueWhen(1,Wh1>0,Wh1);
Wl:=ValueWhen(1,Wl1>0,Wl1);
PP:=ValueWhen(1,PP1>0,PP1);
{Resistance 1}
R1:=(2*PP)Wl;
{Support 1}
S1:=(2*PP)Wh;
{Resistance 2}
R2:=(PPS1)+R1;
{Support 2}
S2:=PP(R1S1);
R2;
R1;
S1;
S2;
(Go
Top) 
COLA:
TRIX(3)
COLB: REF(TRIX(3),1)
COLC: MOV(TRIX(3),8,TIMESERIES)
COLD: REF(MOV(TRIX(3),8,TIMESERIES),1)
COLE: C
Filter enabled:yes
when(cola,>,colc)and when(colb,<,cold)and when(cola,<,0)and
when(cola,>,2)
(Go
Top) 
{The
actual ATR does not use a simple moving average. Welles
Wilder uses his own smoothing (a modified exponential average)
which is the function named "Wilders" in MetaStock. Try
your formula this way:}
periods:=Input("ATR
Periods?",1,100,10);
TH:=If(Ref(C,1) > H,Ref(C,1),H);
TL:=If(Ref(C,1) < L,Ref(C,1),L);
TR:=THTL;
Wilders(TR,periods)
(Go
Top) 
The
Larry Wiliams' indicator named WillSpread is quite easy
to plot in MetaStock for Windows version 6.5. Using version
6.5 of MetaStock for Windows, please follow these steps.
 Plot
the underlying commodity.
 Drag
the Spread Indicator from the indicator quick list to
this commodity chart.
 Select
either Tbonds or Tbills as the security to use to spread.
I recommend you plot this in a new inner window.
 Drag
the Price Oscillator from the indicator quick list and
drop it on the SPREAD plot, not the price plot. The parameters
Mr. Williams' uses are 7 and 11 time period exponential
moving averages. You also want to use "points" as the
method. This plot is the WillSpread indicator.
 At
this point, you may change the Spread Indicator plot's
color to match the background of the chart, or perhaps
move the WillSpread indicator to a separate inner window.
If
you save this first effort as a template, perhaps named
WillSpread, you are able to apply this template to any commodity
you wish and the indicator will be automatically calculated
against that commodity.
You
may also use the "Next Security" function within MetaStock
for Windows to view each of your commodities by setting
the options for next security to "Keep line studies". If
you apply this template to the first commodity in your futures
folder, you may then use the right arrow to move down the
folder contents. Each new commodity will have the WillSpread
calculated as it is loaded.
(Go
Top) 
{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)
(Go
Top) 
MetaStock
is a marvellous program for traders, but can appear complicated
and intimidating at first. In reality, it's easy and fun,
if you take it slowly, step by step.
Let's
consider a common trader's question: "How can MetaStock
help me find all the stocks where the 3 day moving average
has just crossed above the 10 day moving average?"
MetaStock's
Explorer tool allows you to search all the stocks in the
ASX, and within a minute or two (depending on your computer's
speed!) generate a list of all stocks meeting this particular
criteria.
Here's
a step by step guide for beginners:
1.
Open up your Explorer tool in MetaStock by clicking on the
little "binoculars" symbol in the upper right field of your
screen, or find it under Tools in the dropdown menu.
2.
You will be presented with the Explorer screen showing a
list of readymade Equis Explorations plus various options
to view or edit them. More about these later. Look instead
at the list of options to the right.
3.
Choose the "New" button and click. You've just starting
writing your own MetaStock Exploration! MetaStock gives
it the name "<New Exploration>" but let's rename it
"Moving Average Crossover" for the sake of this exercise.
4.
Note that the Explorer screen has an upper section labelled
"Notes" and then, just below, seven columns, with tabs,
labelled "A" to "F," plus "Filter." For now we're just going
to work with the "Filter" column. Click on its tab and you're
ready to write a MetaStock formula in this column.
5.
Enter the following without the quotation marks: "Cross(
Mov(c,3,s) , Mov(c,10,s) )" but don't worry about the *spaces*
between letters and punctuations marks, nor about capitalisation.
6.
Here's a quick explanation to ponder, before we go further.
What you've just entered under MetaStock Explorer's Filter
is a much more simple formula than you realise! It means
only "Crossover A over B" or "Crossover 3 over 10" in ordinary
English. MetaStock writes this as "Cross( A , B )" where
A and B are other MetaStock formulas, any formulas you like.
In this case, we're putting two different moving averages
in the place of A and B. MetaStock writes the English language
phrase "Moving Average of the past 3 days" as "mov(c,3,s)"
and the second moving average is exactly the same, with
the numeral 10 substituted for the 3.
7.
Your first MetaStock Exploration is now finished. Click
"OK" in the lower left of the Explorer field to save it
and you will quickly find your own "Moving Average Crossover"
Exploration added to those already on MetaStock's readymade
list.
8.
Next, click on the "Explore" button and MetaStock will prompt
you for the path to the place on your computer where you
have all your ASX (or other) data. Choose which securities
you want to scan. I suggest that you choose them all to
start with, and save this as a "List" named "All" so that
when you make more Explorations you won't have to go through
this step again. You can just choose the "All" list whenever
you want to scan stocks. (Take note at this point that MetaStock
has excellent assistance for you under its "Help" tab as
well as one of the best software manuals ever written.)
9.
MetaStock will quickly verify that your stocks are where
you say they are, and prompt you for an "OK". Once you do
this, you can watch a nifty screen where MetaStock outlines
its search for all the stocks that match your search (Filter)
criteria. How long this process takes depends once again
on the speed of your computer!
10.
When Explorer is finished you should choose the "Report"
option to find a filtered list of all the stocks which *today*
have their 3 day moving average rising above their 10 day
moving average. MetaStock allows you to open each or all
of these stocks in full screen pages for further analysis.
(Go
Top) 
In
the May 1998 issue of STOCKS & COMMODITIES, a Traders'
Tip provided MetaStock formulas for calculating support
and resistance levels and the WRO and WSO support and resistance
oscillators. The Traders' Tip was based on my article, "Automated
Support And Resistance," also in that issue. Since then,
I've received many Email messages from STOCKS & COMMODITIES
readers about it. While the method was well received, the
formulas provided were a bit confusing and could use some
clarification. Further, execution was slow and screening
of large numbers of stocks was difficult. Since then, I
have
developed a faster and improved method for computing these
indicators.
To
begin, the support levels S1 through S6 and the resistance
levels R1 through R6 are separate indicators (12 in all),
and each should be entered using the custom indicator option
in the indicator builder.
S1 Indicator:
ValueWhen(1, Ref(L,4) = LLV(L,9), Ref(L,4))
S2 Indicator:
ValueWhen(2, Ref(L,4) = LLV(L,9), Ref(L,4))
S3 Indicator:
ValueWhen(3, Ref(L,4) = LLV(L,9), Ref(L,4))
S4 Indicator:
ValueWhen(4, Ref(L,4) = LLV(L,9), Ref(L,4))
S5 Indicator:
ValueWhen(5, Ref(L,4) = LLV(L,9), Ref(L,4))
S6 Indicator:
ValueWhen(6, Ref(L,4) = LLV(L,9), Ref(L,4))
R1 Indicator:
ValueWhen(1, Ref(H,4) = HHV(H,9), Ref(H,4))
R2 Indicator:
ValueWhen(2, Ref(H,4) = HHV(H,9), Ref(H,4))
R3 Indicator:
ValueWhen(3, Ref(H,4) = HHV(H,9), Ref(H,4))
R4 Indicator:
ValueWhen(4, Ref(H,4) = HHV(H,9), Ref(H,4))
R5 Indicator:
ValueWhen(5, Ref(H,4) = HHV(H,9), Ref(H,4))
R6 Indicator:
ValueWhen(6, Ref(H,4) = HHV(H,9), Ref(H,4))
These 12 indicators should be individually plotted with
the price data as points, not lines (click on each and change
the style to the one on the bottom of the style menu). The
color red is recommended for the support levels S1 through
S6 and the color blue for the resistance levels R1 through
R6. Entering these formulas and changing the style takes
a bit of time, but once done, they can be saved as a template
and easily applied to anotherstock.
If you are interested only in computing the WRO and WSO
indicators, then these formulas can be entered as shown
here. It is not necessary to compute S1 through S6 or R1
through R6, since the new formulas are now selfcontained.
The new WRO and WSO formulas also contain max and min functions
to ensure that the change for each level is either zero
or 1. This avoids a rare but occasional error when the price
change is very large over a short period.
WSO Indicator:
L1:=ValueWhen(1,Ref(L,4)=LLV(L,9),Ref(L,4));
L2:=ValueWhen(2,Ref(L,4)=LLV(L,9),Ref(L,4));
L3:=ValueWhen(3,Ref(L,4)=LLV(L,9),Ref(L,4));
L4:=ValueWhen(4,Ref(L,4)=LLV(L,9),Ref(L,4));
L5:=ValueWhen(5,Ref(L,4)=LLV(L,9),Ref(L,4));
L6:=ValueWhen(6,Ref(L,4)=LLV(L,9),Ref(L,4));
L1M:= Max(0,Min(1,Int(L1/C)));
L2M:= Max(0,Min(1,Int(L2/C)));
L3M:= Max(0,Min(1,Int(L3/C)));
L4M:= Max(0,Min(1,Int(L4/C)));
L5M:= Max(0,Min(1,Int(L5/C)));
L6M:= Max(0,Min(1,Int(L6/C)));
100*(1(L1M+L2M+L3M+L4M+L5M+L6M)/6)
WRO Indicator:
L1:=ValueWhen(1,Ref(H,4)=HHV(H,9),Ref(H,4));
L2:=ValueWhen(2,Ref(H,4)=HHV(H,9),Ref(H,4));
L3:=ValueWhen(3,Ref(H,4)=HHV(H,9),Ref(H,4));
L4:=ValueWhen(4,Ref(H,4)=HHV(H,9),Ref(H,4));
L5:=ValueWhen(5,Ref(H,4)=HHV(H,9),Ref(H,4));
L6:=ValueWhen(6,Ref(H,4)=HHV(H,9),Ref(H,4));
L1M:= Max(0,Min(1,Int(L1/C)));
L2M:= Max(0,Min(1,Int(L2/C)));
L3M:= Max(0,Min(1,Int(L3/C)));
L4M:= Max(0,Min(1,Int(L4/C)));
L5M:= Max(0,Min(1,Int(L5/C)));
L6M:= Max(0,Min(1,Int(L6/C)));
100*(1(L1M+L2M+L3M+L4M+L5M+L6M)/6)
The WRO and WSO oscillators are generally plotted together
on a separate scale from the price plot. It is helpful to
add horizontal lines at zero and 100 on this same scale.
Horizontal lines can be added by clicking on the indicator
and selecting "horizontal lines" from the Indicator Properties
menu.
These formulas run much faster (by 40 times) than the earlier
formulas, and theyХve been tested successfully with both
endofday data and realtime data using MetaStock Professional
Version 6.51.
(Go
Top) 
if(H,>,ref(hhv(H,40),1),1,
if(L,<,ref(llv(L,40),1), 1,0))
(Go
Top) 
mov(oscp(43,86,S,%),43,S)
(Go
Top) 
mov(oscp(10,20,S,%),10,S)
(Go
Top) 
In
his book New Concepts in Technical Trading Systems,
J. Welles Wilder Jr. talks about volatility and describes
his Volatility Index and Volatility System. Both of these
can be performed in MetaStock™ for Windows. This document
describes how to construct both the index and the system.
The
Volatility Index (VI) is described by Wilder as:
VI
Today = (13 * VI Prev + TR1) / 14 *where TR1 is today's
true range.
He
defines the true range as the greatest of the following:

The
distance from today's high to today's low

The
distance from yesterday's close to today's high, or

The
distance from yesterday's close to today's low.
In
MetaStock version 5.0 or higher you would use the following
function.
VI
Today = ATR(14)
The
Volatility System is:
Enter
Long
Cross(C,Ref(LLV(C,7),1)+(Ref(ATR(7),1)*3))
Enter
Short
Cross(Ref(HHV(C,7),1)(Ref(ATR(7),1)*3),C)
(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.
