{It returns the number of periods the close is moving in the
same direction. A positive number indicates ascending close
prices, a negative descending ones and zero unchanged ones}
If(C>Ref(C,-1) AND Ref(C,-1)>Ref(C,-2),PREV+1,
If(C<Ref(C,-1) AND Ref(C,-1)<Ref(C,-2),PREV-1,
If(C>Ref(C,-1) AND Ref(C,-1)<=Ref(C,-2),1,
If(C<Ref(C,-1) AND Ref(C,-1)>=Ref(C,-2),-1,
0))))
This formula might be useful as a component of other indicators,
systems or explorations, rather than as a stand-alone indicator.
(Go
Top) |
This constructs the template mentioned in the ADX article of
the October 1999 issue of TASC by Paul Babbitt.
1. Chart your stock/index/whatever, using a "Clean" template,
then do the same again, so that the two overlapping charts are
displayed.
2. On the menu bar, click Windows, then Columns. The two charts
will then be displayed side-by-side.
3. Change the left-hand chart from Daily to Weekly. Right click
on the date scale and select X-Axis. Set the displayed range of
dates to what you want, e.g., 1996 to 1999. Make sure the loaded
dates range starts earlier. Click the Margin tab and set the
margin to 1.
4. From the Indicator drop-down list select Moving Average and
drag it to the left-hand chart. A 40 period on the weekly chart
corresponds to a 200 day MA.
5. For the right-hand chart, leave it at a daily interval but
set the X-Axis as in paragraph 3 above to, say, a 3-month
display.
6. Drag the Bollinger Band indicator to the right-hand chart.
7. Drag the Directional Movement ADX indicator to the top of the
right-hand chart until the cursor changes to a box, then
release. Set the horizontal lines as desired.
8. Similarly drag the RSI indicator to the bottom of the
right-hand chart.
(Go
Top) |
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
(Go
Top) |
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);
{simply place the above in the filter section}
(Go
Top) |
You could use the Reference (Ref) function to shift your
indicator back in time and you could add or multiply by a
constant or variable to give your indicator a vertical shift.
I've never used a time series moving average so I'm kind of out
of my league, but I guess it could look like this:
TSMA:= Mov(CLOSE,5,TIMESERIES);
ShiftedTSMA:= Ref(TSMA, -1) + 2;
ShiftedTSMA
(Go
Top) |
MetaStock for Windows System Tester
01_R2/Regress Slope/MFI/TSF - (Vol Rqd)
Enter Long:
Alert(RSquared(C,21) < 0.15,21) AND
LinRegSlope(C,34) > opt1 AND
HHV(LinRegSlope(C,34),5) =
HHV(LinRegSlope(C,34),13) AND
HHV(MFI(55),5) = HHV(MFI(55),13) AND
HHV(TSF(C,55),5) = HHV(TSF(C,55),13)
Close Long:
LLV(TSF(C,55),5) = LLV(TSF(C,55),13) AND
LinRegSlope(C,34) < opt1
Enter Short:
Alert(RSquared(C,21) < 0.15,13) AND
LinRegSlope(C,34) < opt2 AND
LLV(LinRegSlope(C,34),5) =
LLV(LinRegSlope(C,34),13) AND
LLV(MFI(55),5) = LLV(MFI(55),13) AND
LLV(TSF(C,144),5) = LLV(TSF(C,144),13)
Close Short:
HHV(TSF(C,144),5) = HHV(TSF(C,144),13)
OPTIMIZATION VARIABLES
OPT1: Min = -0.10 Max = 0.00 Step = 0.10
OPT2: Min = -0.20 Max = 0.00 Step = 0.10
STOPS ALL OFF
02_R2/Regress Slope/CMO - All
SIGNAL FORMULAS
Enter Long:
Alert(RSquared(C,21) < 0.15,21) AND
LinRegSlope(C,34) > opt1 AND
HHV(LinRegSlope(C,34),5) =
HHV(LinRegSlope(C,34),13) AND
CMO(C,55) > 0 AND
C = HHV(C,5)
Close Long:
LinRegSlope(C,34) < opt1 AND
CMO(C,55) < 0 AND
C = LLV(C,5)
Enter Short:
Alert(RSquared(C,21) < 0.15,13) AND
LinRegSlope(C,34) < opt2 AND
LLV(LinRegSlope(C,34),5) =
LLV(LinRegSlope(C,34),13) AND
CMO(C,55) < 0 AND
C = LLV(C,5)
Close Short:
LinRegSlope(C,34) > opt2 AND
CMO(C,55) > 0 AND
C = HHV(C,5)
OPTIMIZATION VARIABLES
OPT1: Min = -0.10 Max = 0.00 Step = 0.10
OPT2: Min = -0.20 Max = 0.00 Step = 0.10
STOPS ALL OFF
03_R2/Regress Slope/Qstick - (OHLC Rqd)
SIGNAL FORMULAS
Enter Long:
Alert(RSquared(C,21) < 0.15,21) AND
LinRegSlope(C,34) > opt1 AND
HHV(LinRegSlope(C,34),5) =
HHV(LinRegSlope(C,34),13) AND
Qstick(55) > opt1 AND
HHV(Qstick(55),5) = HHV(Qstick(55),13)
AND C=HHV(C,5)
Close Long:
LinRegSlope(C,34) < opt1 AND
Qstick(55) < opt1 AND
C = LLV(C,5)
Enter Short:
Alert(RSquared(C,21) < 0.15,13) AND
LinRegSlope(C,34) < opt2 AND
LLV(LinRegSlope(C,34),5) =
LLV(LinRegSlope(C,34),13) AND
Qstick(55) < opt2 AND
LLV(Qstick(55),5) = LLV(Qstick(55),13)
AND C = LLV(C,5)
Close Short:
LinRegSlope(C,34) > opt2 AND
Qstick(55) > opt2 AND
C = HHV(C,5)
OPTIMIZATION VARIABLES
OPT1: Min = -0.10 Max = 0.00 Step = 0.10
OPT2: Min = -0.10 Max = 0.00 Step = 0.10
STOPS ALL OFF
04_R2/Regress Slope/CCI/TSF - All
SIGNAL FORMULAS
Enter Long:
Alert(RSquared(C,21) < 0.15,21) AND
LinRegSlope(C,34) > opt1 AND
HHV(LinRegSlope(C,34),5) =
HHV(LinRegSlope(C,34),13) AND
HHV(CCI(55),5) = HHV(CCI(55),13) AND
CCI(55) > 0 AND
HHV(TSF(C,55),5) = HHV(TSF(C,55),13)
AND C = HHV(C,5)
Close Long:
LLV(TSF(C,55),5) = LLV(TSF(C,55),13) AND
LinRegSlope(C,34) < opt1 AND
CCI(55) < 0 AND
C = LLV(C,5)
Enter Short:
Alert(RSquared(C,21) < 0.15,13) AND
LinRegSlope(C,34) < opt2 AND
LLV(LinRegSlope(C,34),5) =
LLV(LinRegSlope(C,34),13) AND
LLV(CCI(55),5) = LLV(CCI(55),13) AND
LLV(TSF(C,144),5) = LLV(TSF(C,144),13)
AND C = LLV(C,5)
Close Short:
HHV(TSF(C,144),5) = HHV(TSF(C,144),13) AND
C = HHV(C,5)
OPTIMIZATION VARIABLES
OPT1: Min = -0.10 Max = 0.00 Step = 0.10
OPT2: Min = -0.20 Max = 0.00 Step = 0.10
STOPS ALL OFF
(Go
Top) |
exploration by Jim Greening
HHV(C,21) < 1.1*Mov(C,21,S) AND
LLV(C,21) > 0.9*Mov(C,21,S)
{place the formulas above in the filter section; nothing else is
required}
(Go
Top) |
Periodicity: Daily
Formulas
ColumnA: Top
Mov(Peak(1,H,1),45,S)-Ref(Mov(Peak(1,H,1),45,S),-45)
ColumnB: Bottom
Mov(Trough(1,L,1),45,S)-Ref(Mov(Trough(1,L,1),45,S),-45)
Filter:
ColA < 1 AND ColA > -1 AND ColB < 1 AND ColB > -1
(Go
Top) |
{from Equis}
PI:=3.1415926;
SD:=180/6;
S1:=Sin(1*180/6)*C;
S2:=Sin(2*180/6)*Ref(C,-1);
S3:=Sin(3*180/6)*Ref(C,-2);
S4:=Sin(4*180/6)*Ref(C,-3);
S5:=Sin(5*180/6)*Ref(C,-4);
Num:=S1+S2+S3+S4+S5;
Den:=Sin(SD)+Sin(2*SD)+Sin(3*SD)+Sin(4*SD)+Sin(5*SD);
Num/Den
I use the peak and trough function in MetaStock to show support
and resistance levels. It could also be used as a trailing
stoploss method.
(Go
Top) |
ROC(Mov(C,13,E),21,%)
(Go
Top) |
The following custom formula will return the slope of a
Linear Regression Line.
tp:=Input("Time Periods",1,200,21);
((tp*(Sum(Cum(1)*C,tp)))-(Sum(Cum(1),tp)*(Sum(C,tp))))/((tp*Sum(Pwr(Cum(1),2),tp))-Pwr(Sum(Cum(1),tp),2))
(Go
Top) |
This is my own version of the well-known indicator, TRIX. I
have had much better results with this than the canned version
that comes with every charting program.
trix(12)-ref((trix(12)),-1)
(Go
Top) |
Mov((H+L)/2,5,S)-Mov((H+L)/2,35,S)
(Go
Top) |
Mov((RSI(8)-LLV(RSI(8),8))/(HHV(RSI(8),8)-(LLV(RSI(8),8))),5,w)*100
A formula like this works best with confirming indicators. If
the MACD 13-34-89 is above the zero line (purple line in window
2 above), it confirms and uptrend and the indicator is usually
more accurate. If the MACD 13-34-89 is below the zero line, then
a "short" indication from the StochRSI may give better
results.StochRSI 13 also gives excellent indicators- in this
index it had 4 out of 5 winning signals in two year period. The
time between signals is of course longer. Check this method out
on your favorite issues.
(Go
Top) |
enter long
mov(stoch(55,21),5,w)>ref(mov(stoch(55,21),5,w),-1)
and mov(stoch(55,21),5,w)<75 and
mov(stoch(55,21),5,w)>20
exit long
(mov(stoch(55,21),5,w)<75 and
ref(mov(stoch(55,21),5,w),-1)>75)
enter short
(mov(stoch(55,21),5,w)<70 and
ref(mov(stoch(55,21),5,w),-1)>70) and
mov(stoch(55,21),5,w)<ref(mov(stoch(55,21),5,w),-1)
exit short
mov(stoch(55,21),5,w)>ref(mov(stoch(55,21),5,w),-1)
and mov(stoch(55,21),5,w)<75 and
mov(stoch(55,21),5,w)>20
(Go
Top) |
SMI-Plex:=
StochMomentum(2,1,2)+StochMomentum(3,2,1)+StochMomentum(4,2,3)+StochMomentum
(5,3,5)+StochMomentum(8,21,13)+StochMomentum(13,25,2)
SMI13E-Plex:=
Mov(StochMomentum(2,1,2)+StochMomentum(3,2,1)+StochMomentum(4,2,3)+StochMome
ntum(5,3,5)+StochMomentum(8,21,13)+StochMomentum(13,25,2),13,E)
(Go
Top) |
{Appeared in the January 1993 issue of Stocks &
Commodities magazine}
100 * ( Mov( Mov(C - (.5 * ( HHV(H,13) + LLV(L,13))),25,E),2,E)
/ (.5*Mov(
Mov( HHV(H,13) - LLV(L,13),25,E),2,E)))
(Go
Top) |
Though not directly related to the volume percent indicator,
I have recently been using a volume indicator that I wrote
myself in MetaStock's formula language. It uses the same idea
that Chande used to turn RSI into the StochRSI oscillator and
the preprogrammed Price Volume Trend function. Price Volume
Trend is similar to On Balance Volume, except that as the volume
is accumulated, it is weighted according to the percent price
change from the previous close.
I use fast and slow "stochastic" lines to judge when either
accumulation or distribution is taking place. I used a look back
period of 19 days which fits my style. Signals are generated by
the fast crossing above or below the slow lines. I have not
worked with it enough to say whether or not divergences offer
signals too.
Formulas for the StochPVT are shown below:
{Fast line}
Mov((PVT()-LLV(PVT(),19))/
(HHV(PVT(),19)-LLV(PVT(),19)), 5, S)
{Slow Line}
Mov(Mov((PVT()-LLV(PVT(),19))/
(HHV(PVT(),19)-LLV(PVT(),19)), 5, S),3,S)
(Go
Top) |
Although I keep the best of the bunch as a "super secret" for
friends, relatives, and clients ... here is a smattering of
formulae that might be useful. StoRSI's perform very differently
when you plug in various numbers. Experiment and determine which
are most suitable for your style and markets. Substitute
numbers, apply moving averages, get creative. These are just a
few:
((RSI(21)-LLV(RSI(21),8))/((HHV(RSI(21),13))-LLV(RSI(21),13)))
((RSI(21)-LLV(RSI(21),21))/((HHV(RSI(21),21))-LLV(RSI(21),21)))
((RSI(14)-LLV(RSI(14),14))/((HHV(RSI(14),14))-LLV(RSI(14),14)))
Mov((RSI(21)-LLV(RSI(21),13))/(HHV(RSI(21),8)-(LLV(RSI(21)+.00001,13))),8,E)*100
Mov((RSI(5)-LLV(RSI(5),5))/(HHV(RSI(5),5)-
(LLV(RSI(5),5))),3,E)*100
Mov((RSI(13)-LLV(RSI(13),13))/(HHV(RSI(13),13)-
(LLV(RSI(13),13))),3,E)*100
(Go
Top) |
periodsshort:=Input("periods if short",1,50,10);
periodslong:=input("periods
if long",1,50,10);
HHV(H,periodsshort)-atr(periodsshort);{stop loss level for short
positions}
LLV(L,periodslong)+ATR(periodslong);{stop loss level for long
positions}
(Go
Top) |
{The StTO is really nothing unique. It is basically a
momentum indicator and plots very similar to the "Chande
Momentum Oscillator" with the main difference being the "StTO"
doesn't seem to swing as far as the CMO. I am not sure how the
math is calculated for the CMO, but the (basic) math for the
StTO is:
(Close- Yesterday's Close) /(H-L)}
{Here is the MetaStock code I use:}
{name: StTO}
{Short-term Trend Oscillator}
Lb:=Input("Smoothing Period?",1,60,5);
Num:=C-Ref(C,-1);
Den:=H-L;
Mn:=If(Mov(Num,Lb,S)=0,.01,Mov(Num,Lb,S));
Md:=If(Mov(Den,Lb,S)=0,.01,Mov(Den,Lb,S));
(Mn/Md)*100
(Go
Top) |
STARC BAND Formula = (Mov(Typical(),5,S))
Starc Upper Band:
Fml( "STARC BAND" )+ (ATR(15)*1.33)
Starc Lower Band:
Fml( "STARC BAND" )-(ATR(15)*1.33)
Any five day moving average will work.
(Go
Top) |
I wrote this MetaStock Expert for calculating the support 1 &
2 and resistance 1 & 2 as per Futures magazine, October 1999,
page 52.
FIRST RESISTANCE: WRITEVAL(-L+(2* (H+L+C)/3),1.2)
SECOND RESISTANCE: WRITEVAL(((H+L+C)/3) +((-L+(2*
(H+L+C)/3))-(-H+(2* (H+L+C)/3))),1.2)
FIRST SUPPORT:
WRITEVAL(-H+(2*(H+L+C)/3),1.2)
SECOND SUPPORT: WRITEVAL(((H+L+C)/3)
-((-L+(2* (H+L+C)/3))-(-H+(2* (H+L+C)/3))),1.2)
(Go
Top) |
AVd:=If(CLOSE>Ref(Peak(1,H,1) ,-1),
{then}1,
{else}If(CLOSE<Ref(Trough(1,L,1),-1),
{then}-1,
{else}0));
ANv:=ValueWhen(1,AVd<>0,AVd);
SuRe:=If(ANv=-1,
{then}Peak(1,H,1),
{else}Trough(1,L,1));
SuRe;
{StochCMO}
mp1:=Input("RSI Periods",1,377,13);
mp2:=Input("Stoch Periods",1,377,13);
mp3:=Input("Slowing Periods",1,377,1);
mp4:=Input("EMA Periods",1,377,5);
Mov(Sum((CMO(c,mp1)-LLV(CMO(c,mp1),mp2)),mp3)/Sum((.0000001+(HHV(CMO(c,mp1),
mp2)-(LLV(CMO(c,mp1),mp2)))),mp3),mp4,E)*100
(Go
Top) |
from Glen Wallace
"Buy at the open plus half the average true range of the last
ten days?"
HIGH >= OPEN + 0.5*Ref(ATR(10), -1)
"If these two moving averages cross today, buy on tomorrow's
open."
MA1:= Mov(CLOSE, 10, SIMPLE);
MA2:= Mov(CLOSE, 20, SIMPLE);
Ref(Cross(MA1, MA2), -1)
(with System Testing Options | Testing tab | Entry Price set to
"Open" and delay set to
zero)
"Exit five bars after entry."
EntryCondition:= {your trade entry conditions};
BarsSince(EntryCondition >= 5)
(Go
Top) |
if(oscv(1,50,S,%),>,0,
if(V,>,ref(V,-1),1,0),0)
(Go
Top) |
The following custom formula returns the
slope of a line. For example, this formula returns the slope of
a 14 day run of the security's closing prices.
( (14 * (Sum(Cum( 1 ) * C ,14 ) ) ) -
(Sum(Cum( 1 ) ,14 ) * (Sum( C ,14) ) ) ) / ( (14 *
Sum(Pwr (Cum( 1 ) ,2 ) ,14 ) ) - Pwr(Sum(Cum( 1 ) ,14 ) ,2 ) )
To apply this to different lines you would
replace C with the desired syntax for the line. For
example the slope of a 25 period simple moving average would be:
( ( Sum(Cum(1) * Mov(C,25,S),14) ) -
(Sum(Cum(1),14) * Sum(Mov(C,25,S),14) / 14) ) / (
(Sum(Power(Cum(1),2),14) ) - (Power(Sum(Cum(1),14),2) / 14) )
You could also make this a universal formula
by using the P variable. You could then plot the formula
on top of any line.
( (14*(Sum(Cum(1)*P,14) ) ) -
Sum(Cum(1),14)*(Sum(P,14 ) ) ) / ( (14*Sum(Pwr(Cum(1),2
),14 ) )-Pwr(Sum(Cum(1),14),2 ) )
(Go
Top) |
For interpretation refer to the article "Standard
Error Bands", in the September 96 issue of TASC, written by
Jon Anderson.
21 period Upper Band (smoothed):
Mov((21 * Sum(Cum(1) * C,21) - Sum(Cum(1),21)
* Sum(C,21)) / (21 * Sum(Pwr(Cum(1),2),21) -
Pwr(Sum(Cum(1),21),2)) * Cum(1) + (Mov(C,21,S) -
Mov(Cum(1),21,S) * (21 * Sum(Cum(1) * C,21) - Sum(Cum(1),21) *
Sum(C,21))/ (21 * Sum(Pwr(Cum(1),2),21) -
Pwr(Sum(Cum(1),21),2)))
+2*(Sqrt(((Sum(Power(C,2),21)-(Power(Sum(C,21),2)/21))
-((Sum(Cum(1)*C,21))-((Sum(Cum(1),21)*Sum(C,21)/21)))/
((Sum(Power(Cum(1),2),21))-(Power(Sum(Cum(1),21),2)/21))
*((Sum(Cum(1)*C,21))-((Sum(Cum(1),21)*Sum(C,21)/21))))
/19)),3,S)
21 period Lower Band (smoothed):
Mov((21 * Sum(Cum(1) * C,21) - Sum(Cum(1),21)
* Sum(C,21)) / (21 * Sum(Pwr(Cum(1),2),21) -
Pwr(Sum(Cum(1),21),2)) * Cum(1) +(Mov(C,21,S) - Mov(Cum(1),21,S)
* (21 * Sum(Cum(1) * C,21) - Sum(Cum(1),21) * Sum(C,21))/ (21 *
Sum(Pwr(Cum(1),2),21) - Pwr(Sum(Cum(1),21),2))) -
2*(Sqrt(((Sum(Power(C,2),21)-(Power(Sum(C,21),2)/21))
-((Sum(Cum(1)*C,21))- ((Sum(Cum(1),21) * Sum(C,21)/21))) /
((Sum(Power(Cum
(1),2),21))-(Power(Sum(Cum(1),21),2)/21))*((Sum(Cum(1)*C,21))-
((Sum(Cum(1),21)*Sum(C,21)/21)))) /19)),3,S)
21 period R2 (smoothed):
Mov((Pwr(Corr(Cum(1),C,21,0),2)),3,S)
21 period Regression Slope:
(((Sum(Cum(1)*C,21))-(Sum(Cum(1),21)*Sum(C,21)/21)) /
((Sum(Power(Cum(1),2),21))-(Power(Sum(Cum(1),21),2)/21)))
21 period %A:
((C-Fml("21 period lower band (smoothed)")) /
(Fml("21 period upper band(smoothed)") -Fml("21 period lower
band (smoothed)")))
21 period Regression (smoothed):
Mov((21*Sum(Cum(1)*C,21)-Sum(Cum(1),21)*Sum(C,21))/
(21*Sum(Pwr(Cum(1),2),21)-Pwr(Sum(Cum(1),21),2))*Cum(1)
+(Mov(C,21,S) - Mov(Cum(1),21,S) * (21*Sum(Cum(1) * C,21) -
Sum(Cum(1),21)*Sum(C,21))/(21*Sum(Pwr(Cum(1),2),21)
-Pwr(Sum(Cum(1),21),2))),3,S)
(Go
Top) |
The following formula is a three day moving
average of a 14 day Stochastic. In MetaStock for Windows this
would be the indicator line that is plotted with the built in
Stochastic indicator
Mov( ( ( ( C - LLV( L,14 ) ) /( HHV( H,14 ) -
LLV( L,14 ) ) ) * 100 ) ,3 ,S )
(Go
Top) |
if(ref(stoch(14,3),-1),=,llv(stoch(14,3),3),2,
if(stoch(14,3),=,llv(stoch(14,3),3),1,0))
(Go
Top) |
if(ref(stoch(14,3),-1),=,hhv(stoch(14,3),3),2,
if(stoch(14,3),=,hhv(stoch(14,3),3),1,0))
(Go
Top) |
Think of security prices as the result of a
head-to-head battle between a bull (the buyer) and a bear (the
seller). The bulls push prices higher and the bears push prices
lower. The direction prices actually move reveals who is winning
the battle.
Support levels indicate the price where the
majority of investors believe that prices will move higher, and
resistance levels indicate the price at which a majority of
investors feel prices will move lower.
To create the Support and Resistance
indicator in MetaStock use the following custom formula:
LookBack := Input("Look Back
Periods",1,1000,10);
Resistance :=ValueWhen(1,Cross(Mov(C, LookBack,
S),C),HHV(H, LookBack));
Support :=ValueWhen(1,Cross(C,Mov(C, LookBack,
S)),LLV(L, LookBack));
Resistance;
Support;
To use this formula most effectively, use the
parameters dialogue to change the style to a dotted line while
increasing the line weighting.
(Go
Top) |
In this issue, Dennis L.Tilley uses support and resistance to
confirm price and SMA crossover signals in his article "Simple
Moving Average with Resistance and Support".
In MetaStock for Windows, you can easily recreate the SMARS
Indicators discussed in Tilley's article. First, choose
Indicator Builder from the Tools menu in MetaStock 6.5. Next,
choose New and enter the following formulas:
Resistance and Support |
LookBack := Input("Look
Back Periods",1,1000,10);
Resistance :=ValueWhen(1,Cross(Mov(C,
LookBack, S),C),HHV(H, LookBack));
Support :=ValueWhen(1,Cross(C,Mov(C,
LookBack, S)),LLV(L, LookBack));
Resistance;
Support; |
|
Resistance and Support * F |
PrCnt:=Input("Percentage",0,100,10);
LookBack:= Input("Look Back
Periods",1,1000,10);
Resistance:=ValueWhen(1,Cross(Mov(C,LookBack,S),C),HHV(H,LookBack));
Support:=ValueWhen(1,Cross(C,Mov(C,LookBack,S)),LLV(L,LookBack));
Resistance * ((100-prcnt)/100);
Support * ((prcnt/100)+1); |
|
*Note: It is much easier to see the difference between the
actual "Resistance and Support" lines and the "Resistance and
Support * F " lines if you change the color and/or style of one
of them.
To Display the Indicators in MetaStock 6.5 Drag the "Moving
Average" indicator from the Indicator QuickList into the price
window. Choose Simple as the method, enter the time periods and
then click OK.
Now, drag the "Resistance and Support" indicator from the
QuickList into the price window. You will be prompted to enter
the "Look Back" periods. You should select the same time periods
you used with the "Moving Average".
Finally, drag the "Resistance and Support * F" indicator into
the price window. You will be prompted to enter the "Percentage"
and the "Look Back" periods. If you would like the indicator to
be a 10% difference from the "Resistance and Support" line, you
would enter 10. You should select the same time periods you used
with the "Moving Average".
(Go
Top) |
The following MetaStock formulas are from the 1998 January
TASC article "Smoothing Techniques for more Accurate Signals",
by Tim Tillson. Refer to his article for interpretation.
"More sophisticated smoothing techniques can be used to
determine market trend. Better trend recognition can be lead to
more accurate trading signals."
ILRS |
Periods:=Input("Periods?",2,63,11);
Size:=LastValue(Cum(1));
Start:=LastValue(Ref(Mov(P,Periods,S),Periods-Size));
Cum(LinRegSlope(P,Periods))+Start;
|
|
T3 |
Periods:=Input("Periods?",1,63,5);
a:=Input("Hot?",0,2,.7);
e1:=Mov(P,Periods,E);
e2:=Mov(e1,Periods,E);
e3:=Mov(e2,Periods,E);
e4:=Mov(e3,Periods,E);
e5:=Mov(e4,Periods,E);
e6:=Mov(e5,Periods,E);
c1:=-a*a*a;
c2:=3*a*a+3*a*a*a;
c3:=-6*a*a-3*a-3*a*a*a;
c4:=1+3*a+a*a*a+3*a*a;
c1*e6+c2*e5+c3*e4+c4*e3; |
|
(Go
Top) |
|