Professional Documents
Culture Documents
1 2 3 Ross Hook
Col A: Peak(1,H,10)<=1.1*Peak(2,H,10)
AND Peak(1,H,10)>=0.9*Peak(2,H,10)
AND Trough(1,L,10)>=1.1*Trough(2,H,10)
AND Trough(1,L,10)<=0.9*Trough(2,H,10)
AND LLV(L,25)
Col B: Peak(1,H,5)<=1.1*Peak(2,H,5)
AND Peak(1,H,5)>=0.9*Peak(2,H,5)
AND Trough(1,L,5)>=1.1*Trough(2,H,5)
AND Trough(1,L,5)<=0.9*Trough(2,H,5)
AND LLV(L,25)
Col C: Peak(1,H,1)<=1.1*Peak(2,H,1)
AND Peak(1,H,1)>=0.9*Peak(2,H,1)
AND Trough(1,L,1)>=1.1*Trough(2,H,1)
AND Trough(1,L,1)<=0.9*Trough(2,H,1)
AND LLV(L,25)
Filter colA=1 OR colB=1 OR colC=1
1234's Sell
A:Close
B:ADX(14){The higher the better}
C: PDI(14)<MDI(14)
D:If(H>Ref(H,-1) and Ref(H,-1)>Ref(H,-2) and
Ref(H,-2)>Ref(H,-3),1,0)
E:{Entry}LLV(L,3)-.125
F:{stop}HHV(H,3)
Filter:ColB>30 and ColC and ColD=1
Ref((C-L)/(H-L),-1)<=.30 AND
((C-L)/(H-L)) >= .70 AND
Ref(ATR(1),-1) >ATR(10) AND
ATR(1) >= ATR(10)
21 Day Trigger
Look at these two oscillators in MSWIN, and compare them to Dahl. Put a
21 day EMA on each, think of the 21 day ema as a trigger. See what they
tell you -- Dahl is long term, Ian is shortest term.
5 Day High
{"Today must make a five-day high and today the close must be below the
open."}
{Place the following in the MetaStock Explorer filter section.}
{If you want both the conditions to be satisfied in the same query, just
join the two filters by the AND operator:}
{One problem with the 52-wk High and 52-wk Low formula--every day
you've got
to change the values for dayofmonth(), Month() and Year() functions. The
formula given above assumes that you would be running the query on May
07,
1998. Change the values of the above functions accordingly.}
Also, I have found the following helpful: try using the custom ADX formula
posted on the MetaStock website. Wilder wrote the original ADX in such a
fashion that it rounds the readings out to the nearest whole number. The
"regular" canned MetaStock ADX does this, while the custom ADX does
not. The non-rounded readings are just a shade more sensitive, which can
be helpful.
ADX Raw
{MetaStock code written by Equis and published in the Oct99 TASC}
ADXRaw
Alligator Indicators
Following are the Bill William's Alligator indicators I put together.
Please read his book "Trading Chaos" and pick up a demo of his
"Investor's Dream" software from his web site to see how they are used.
Chaos Blue BL
{Alligator Blue Balance Line - Jaw }
{13 bar smoothed average offset 8 bars }
Ref(Wilders(MP(),13),-8);
----------------------------------------------
Chaos Red BL
{Alligator Red Balance Line - Teeth }
{8 bar smoothed average offset 5 bars }
Ref(Wilders(MP(),8),-5);
----------------------------------------------
Chaos Green BL
{Alligator Green Balance Line - Lip }
{5 bar smoothed average offset 3 bars }
Ref(Wilders(MP(),5),-3);
----------------------------------------------
Chaos Gator
{ Chaos Alligator }
{ Plot as histogram }
----------------------------------------------
Chaos AO
{ Chaos Awsome Oscillator - measures momentum }
( A very close approximation of MFI }
{ Plot as histogram }
Mov(MP(),5,S) - Mov(MP(),34,S);
----------------------------------------------
Mov(Mov(MP(),5,S) - Mov(MP(),34,S),5,S)
----------------------------------------------
Chaos AC
{ Chaos Accelerator/Decelerator Oscillator }
{ Measures acceleration }
{ Plot as histogram }
----------------------------------------------
Chaos Fractal
{ Chaos Fractal (simple version +1=Up, -1=Dn) }
High1 := Ref(HIGH,-2);
High2 := Ref(HIGH,-1);
High3 := Ref(HIGH,0);
High4 := Ref(HIGH,1);
High5 := Ref(HIGH,2);
Low1 := Ref(LOW,-2);
Low2 := Ref(LOW,-1);
Low3 := Ref(LOW,0);
Low4 := Ref(LOW,1);
Low5 := Ref(LOW,2);
Fractal :=
If((High3 > High1) AND (High3 > High2) AND (High3 > High4) AND (High3
>
High5), +1,0);
Fractal :=
If((Low3 < Low1) AND (Low3 < Low2) AND
(Low3 < Low4) AND (Low3 < Low5),
If(Fractal > 0, 0, -1), Fractal);
Fractal;
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)
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)
AC green
If( Fml( "Acc" )<Ref( Fml( "Acc" ),-1) ,Fml( "Acc" ),0 )
Color green
Save as a template
{FUNCTIONS-IND-REFERENCE-INDEX:
FF=FASTLINE,SS=SLOWLINE,SETBARS=3DAYMOVAVE,
ENTRYADD=+1,EXITADD=+1}
{FUNCTIONS-VAR-REFERENCE-INDEX:
BBUY=(VAR),SSELL(VAR),CBUY(VAR),CSELL(VAR),FF(VAR),SS(VAR),
LXSTOP(VAR),SXSTOP(99999),MP(VAR)}
{FUNCTIONS-MISC-REFERENCE-INDEX:
AT0BBUY =BULLLONG
AT0SSELL =BEARSHORT
AT0CSELL =CLOSEBEARSHORT
AT0CBUY =CLOSEBULLLONG
AT0MP =MARKETPOSITION (-1=LONG,+1 SHORT)
AT0LXSTOP=CLOSELONGEXITLEVEL(STOPLOSS)
AT0SXSTOP=CLOSESHORTEXITLEVEL(STOPLOSS)}
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).
======================
Formula "Tuesday XX Pattern"
======================
Formula "Tuesday XO Pattern"
======================
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
ATR Modified
prd1:=input("enter ATR period",1,9999,7);
prd2:=(prd1*2)-1;
{max (absolute) of yesterday's close to today's high or today's low}
myatr1:=Max(Abs(Ref(C,-1)-H),Abs(Ref(C,-1)-L));
{max of yesterday's close to today's high or today's low or today's range}
myatr2:=Max(myatr1,H-L);
For Short:
LLV(L + 2.5*ATR(5),10)
Average-Modified Method
From The New Commodity Trading Systems and Methods,
by Perry J. Kaufman Chapter 4 - Moving Averages, pg. 60.
This formula is for version 6.5 of MetaStock for Windows 95& NT only and
cannot be written in previous version.
This is a modified simple moving average.
The formula will prompt you for input for the number of time periods to
use in the moving average.
Day:=Cum(1)+1;
Z:=Input("Periods",2,1000,5);
MV:=(1/Z);
If(Day<(Z+2),C,If(day=(Z+2),Mov(C,LastValue(Z),S),PREV+(MV*(C-
PREV))))
5 35 5 MACD
The 5,35,5 MACD is a variation of the standard 12,26,9 MACD and was
made popular by Chris Manning, who uses it to identify major market
divergence points:
((Mov( CLOSE, 5, E) - Mov( CLOSE, 35, E))-(Mov((Mov( CLOSE, 5, E) -
Mov( CLOSE, 35, E)),5,E)))
When first plotted on a chart, the 5,35,5 MACD will appear as a solid line
with no horizontal line at the value of zero. After applying the 5 35 5 MACD
indicator to your chart, use the following steps to create a histogram with
vertical line at zero.
1. Double click the indicator to open the properties dialogue box.
2. Select the Color\Style tab and using the Style drop-down list,
select the histogram setting (second from the bottom).
3. Select the Horizontal Lines tab and enter a value of zero (0) for
the horizontal line value. Click Add.
4. Click OK
Signal Formulas
Enter Long
Alert(Cross(Sum(L > Mov(C,20,E),2) = 2,.5),10) AND HIGH> =
Peak(1,Cross(Sum(L > Mov(C,20,E),2) = 2,.5) *
HHV(H,2),1) + .001{10 ticks} AND BarsSince(Cross(Sum(L >
Mov(C,20,E),2) = 2,.5)) <
BarsSince(LOW <= Mov(C,20,E))
Close Long
LOW <= Mov(C,20,E)
Enter Short
Alert(Cross(Sum(H < Mov(C,20,E),2) = 2,.5),10) AND LOW< =
Peak(1,Cross(Sum(H < Mov(C,20,E),2) = 2,.5) *
LLV(L,2),1) - .001{10 ticks} AND BarsSince(Cross(Sum(H < Mov(C,20,E),2)
= 2,.5)) < BarsSince(HIGH >= Mov(C,20,E))
Close Short
HIGH >= Mov(C,20,E)
RorPlot1
If(Round(
(6.854*LinearReg(C,13)
+4.236*LinearReg(LinearReg(C,13),11)
+2.618*LinearReg(LinearReg(LinearReg(C,13),11),7)
+1.618*LinearReg(LinearReg(LinearReg(LinearReg(C,13),11),7),5)
+LinearReg(LinearReg(LinearReg(LinearReg(LinearReg(C,13),11),7),5),3))
/16.326*100)/100 > PREV
,If(Round(
(6.854*LinearReg(C,13)
+4.236*LinearReg(LinearReg(C,13),11)
+2.618*LinearReg(LinearReg(LinearReg(C,13),11),7)
+1.618*LinearReg(LinearReg(LinearReg(LinearReg(C,13),11),7),5)
+LinearReg(LinearReg(LinearReg(LinearReg(LinearReg(C,13),11),7),5),3))
/16.326*100)/100 - (2.5*ATR(13)) > PREV
,Round(
(6.854*LinearReg(C,13)
+4.236*LinearReg(LinearReg(C,13),11)
+2.618*LinearReg(LinearReg(LinearReg(C,13),11),7)
+1.618*LinearReg(LinearReg(LinearReg(LinearReg(C,13),11),7),5)
+LinearReg(LinearReg(LinearReg(LinearReg(LinearReg(C,13),11),7),5),3))
/16.326*100)/100 - (2.5*ATR(13))
,PREV)
,LinearReg(C,13))
RorPlot2
Tperiod:=13;
CFlow:=100000;
If(
Sum(WC()*V,13) > CFlow
AND (LinearReg(WC(),13)
+LinearReg(LinearReg(WC(),8),13)
+LinearReg(LinearReg(LinearReg(WC(),5),8),13)
+LinearReg(LinearReg(LinearReg(LinearReg(WC(),3),5),8),13)
+LinearReg(LinearReg(LinearReg(LinearReg(LinearReg(WC(),2),3),5),8),13)
)/5
> (LinearReg(Ref(WC(),-1),13)
+LinearReg(LinearReg(Ref(WC(),-1),8),13)
+LinearReg(LinearReg(LinearReg(Ref(WC(),-1),5),8),13)
+LinearReg(LinearReg(LinearReg(LinearReg(Ref(WC(),-1),3),5),8),13)
+LinearReg(LinearReg(LinearReg(LinearReg(LinearReg(Ref(WC(),-
1),2),3),5),8),13))/5
AND LLVBars(WC(),Tperiod) = Tperiod-1
AND PREV = 0
AND Mov(WC(),13,S) > Mov(WC(),21,S)
,Tperiod-1
,If(PREV > Tperiod-2
AND Mov(WC(),13,S) > Mov(WC(),21,S)
{AND Ref(Fml("RorPlot3"),-1) > 24} {Invalid circular reference!}
AND Fml("RorPlot1") >= Ref(Fml("RorPlot1"),-1)
,PREV+1
,If(Mov(WC(),21,S) >= Mov(WC(),13,S)
OR Sum(WC()*V,13) > CFlow
OR Ref(Fml("RorPlot1"),-1) > Fml("RorPlot1")
{OR Ref(Fml("RorPlot3"),-1) < 25} {Invalid circular reference!}
,0,PREV)))
RorPlot3
Round(
If(Fml("RorPlot2")>0,
If(Fml("RorPlot2")<52,
(5200/(Fml("RorPlot2")+1))*((LinearReg(WC(),13)
{-Ref(WC(),-Fml("RorPlot2")) <--MS cannot handle variables in Ref
function!}
-Ref(WC(),-20)) {<-- replaced with 20 period Ref function!}
/LinearReg(WC(),13)),
100*((LinearReg(WC(),13)-LinearReg(Ref(WC(),-
51),13))/LinearReg(WC(),13))),0))
ATR - True & Reverse
{ True, Reverse & MetaStock ATR v3.0 }{ ©Copyright 2004 Jose Silva }
{ josesilva22@yahoo.com }
{ Reverse True Range is the the *smallest* of the following for each
period:
* The distance from today's High to today's Low;
* The distance from yesterday's Close to today's High;
* The distance from yesterday's Close to today's Low.}
{ user input }
plot:=Input("[1]True ATR, [2]Reverse ATR, [3]Both, [4]MS-ATR",1,4,1);
pds:=Input("Average True Range periods",1,252,10);
pdsN:=Input("normalizing periods (1=none)",1,2520,1);
smooth:=Input("Sine-weighted smoothing? [1]Yes, [0]No",0,1,0);
{ define True Range }
x1:=ValueWhen(2,1,C);
TrueRange:=Max(H-L,Max(Abs(x1-H),Abs(x1-L)));
RevTrueRange:=Min(H-L,Min(Abs(x1-H),Abs(x1-L)));
{ normalize ATR }
ATRraw:=If(plot=1,ATRtrue,If(plot=2,ATRrev,If(plot=4,ATRmeta,ATRtrue)));
ATRnorm:=100*(ATRraw-LLV(ATRraw,pdsN))/(HHV(ATRraw,pdsN)-
LLV(ATRraw,pdsN)+.000001);
ATRplot:=If(pdsN<2,ATRraw,ATRnorm);
rATRnorm:=100*(ATRrev-LLV(ATRrev,pdsN))/(HHV(ATRrev,pdsN)-
LLV(ATRrev,pdsN)+.000001);
rATRplot:=If(pdsN<2,RevTrueRange,rATRnorm);
{ plot ATR }
If(plot=3,rATRplot,ATRplot);
ATRplot
2-point plot
{ 2-point plot, coding example v2.5 }{ Trendline choice 1: last High/Low in
month }{ Trendline choice 2: lows at Jan/June 2004 }{ ©Copyright 2003-
2004 Jose Silva }{ josesilva22@yahoo.com }
{define events}
time1:=C=HHV(C,21);
time2:=C=LLV(C,21);
time2:=time2 AND time2<>time1;
{alternative events}
dateA:=Year()=2004 AND Month()=1;
dateA:=If(LastValue(Cum(dateA))=0,
Year()=LastValue(Year())-1
AND Month()=LastValue(Month()),dateA);
LoValA:=Lowest(ValueWhen(1,dateA,L));
timeA:=dateA AND L=LastValue(LoValA);
{choose events}
time1:=If(plot=1,time1,timeA);
time2:=If(plot=1,time2,timeB);
price1:=If(plot=1,C,L);
price2:=If(plot=1,C,L);
{sort events}
t1pds:=LastValue(BarsSince(time1));
t2pds:=LastValue(BarsSince(time2));
x1:=If(t1pds>=t2pds,time1,time2);
x2:=If(t1pds>=t2pds,time2,time1);
y1:=If(t1pds>=t2pds,price1,price2);
y2:=If(t1pds>=t2pds,price2,price1);
{fix coordinates}
y1:=ValueWhen(1,x1,y1);
y2:=LastValue(ValueWhen(1,x2,y2));
b1:=LastValue(BarsSince(x1));
b2:=LastValue(BarsSince(x2));
{trendline definition}
plot:=y1+BarsSince(x1)*(y2-y1)/(b1-b2+.000001);
plot:=Ref(Ref(plot,-b2),b2);{rem to extend plot}
If(choose=1,plot,time1+time2)
Barnes' Accelleration
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.
BUY -1 SELL 1
Periodicity Daily
Bianchi Approach
enter long
enter short
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!
Biggest Losers
Col A: CLOSE
Col B: ROC(C,5,%)
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.
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
Body Momentum
{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.}
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)
Mov(cum(((C-L)-(H-C)/(H-L))*V),3,E)-Mov(cum(((C-L)-(H-C)/(H-L))*V),10,E)
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".
Bollinger Bands 2
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))
Bollinger Bands Formula 7 Day
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))))
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.
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.
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.
Mov(cum(((C-L)-(H-C)/(H-L))*V),3,E)-Mov(cum(((C-L)-(H-C)/(H-L))*V),10,E)
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)
Bottom Reversal
These are a collection of bottom signals. The search returns 1 for Ok and 0
for not ok.
• CLOSE
• EngulfingBull()
• MorningDojiStar()
• MorningStar()
• WhiteSoldiers()
BradCCI
BradCCI: From Bill S.
Plot 1:
Brown's Indicator
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)
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
close long:
n :=opt2{Time periods};
BearFear := (HHV(LOW,n) - LLV(LOW,n))/2 + LLV(LOW,n);
CLOSE < bearfear
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:
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
Optimization:
Opt1: Min = -1 Max = -5 Step = 2
Opt2: Min = -21 Max = -5 Step = 8
Periodicity Daily
Breadth Thrust
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.
________________________________________
The following formula will match the authors slight modification to the
variable moving average:
VIDYA 21,5 Indicator
Length:=Input("Length",1,200,21);
Smooth:=Input("Smoothing",1,200,5);
AbsCMO:=(Abs(CMO(C,Length)))/100;
SC:=2/(Smooth+1);
VIDYA:=If(Cum(1)<=(Length+1),C,(SC*AbsCMO*CLOSE)+(1-
(SC*AbsCMO))*PREV);
VIDYA
The following Expert highlights will show you when the price has
undergone trend changes as discussed in the article. Enter each section as
a separate highlight in an Expert Advisor. To do this, create a new Expert
and select Highlights from the tab dialog. Then select New and name it
Bull. Paste the Bull trend formula into the condition box within the editor
and set the colour to green. Do this for the Bear and the Pause conditions
as well, selecting the matching colours, Attach this Expert to your chart
and if the conditions are met, the price bars will be displayed in the proper
colours.
Green Bars (Bull trend)
Length:=21;
Smooth:=5;
AbsCMO:=(Abs(CMO(C,Length)))/100;
SC:=2/(Smooth+1);
VIDYA:=If(Cum(1)<=(Length+1),C,(SC*AbsCMO*CLOSE)+(1-
(SC*AbsCMO))*PREV);
C>(Vidya*1.01)
(Go Top...)
Bang For The Buck
This indicator shows the possible dollar return (on a $10,000 account) for a
security on any given period. This is calculated by dividing a $10,000
account by the closing price. This number is then multiplied by the
average range of the security for the last 200 periods. The interpretation is
such that the higher the value, the higher the profit potential.
((10000/C)* (Mov(ATR(1),200,S))/100)
(Go Top...)
Breakout signals
{ Plots breakout long/short signals josesilva22@yahoo.com With thanks to
Roy Larsen for Init idea }
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
In:=x>Ref(HHV(x,pds1),-1);
Out:=x<Ref(LLV(x,pds2),-1);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
Flag:=BarsSince(Init OR In) < BarsSince(Init OR Out)+InInit;
In1:=Cum(Cum(In))=1;
Out1:=Cum(Cum(Out))=1;
If(display=1,Ref(Cum(Cum(In))=1,-delay),0);
If(display=1,-Ref(Out1 AND BarsSince(In1)>=BarsSince(Out1),-delay),0);
If(display=1,Ref((InInit AND Alert(InInit=0,2) OR Flag AND
Alert(Flag=0,2))-(Flag=0 AND Alert(Flag,2)),-delay),Flag)
Breakout signals
Signals a Buy Long on price breakout
Exploration filter
pds1:=21; {HHV (long) breakout periods}
pds2:=10; {LLV (short) breakout periods}
x:=4; {use Open=1 High=2 Low=3 Close=4 Vol=5}
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,C))));
In:=x>Ref(HHV(x,pds1),-1);
Out:=x<Ref(LLV(x,pds2),-1);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
Flag:=BarsSince(Init OR In) < BarsSince(Init OR Out)+InInit;
BuyLong:=InInit AND Alert(InInit=0,2) OR Flag AND Alert(Flag=0,2);
BuyLong
Breakin signals
Signals a Sell Long on price collapse
Exploration filter
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,C))));
In:=x>Ref(HHV(x,pds1),-1);
Out:=x<Ref(LLV(x,pds2),-1);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
Flag:=BarsSince(Init OR In) < BarsSince(Init OR Out)+InInit;
SellLong:=Flag=0 AND Alert(Flag,2);
SellLong
Candle Code
From "Lyn Maine"
Here is the formula from this months TASC called Candle code
this is only using 1 formula not like the one in TASC which is broken up into
several smaller ones.
CandleCode
Bdy:=Abs(O-C);
Lshd:=If(C>=O,O-L,C-L);
Ushd:=If(C>=O,H-C,H-O);
ThBotB:=BBandBot(Bdy,55,E,0.5);
ThTopB:=BBandTop(Bdy,55,E,0.5);
ThBotL:=BBandBot(Lshd,55,E,0.5);
ThTopL:=BBandTop(Lshd,55,E,0.5);
ThBotU:=BBandBot(Ushd,55,E,0.5);
ThTopU:=BBandTop(Ushd,55,E,0.5);
CCode:=If(C=O,1,0)*If(Ushd>=Lshd,64,48)+If(C=O,0,1)*(If(C>O,1,0)*(If(B
dy<=ThBotB,80,0)
+If(Bdy>ThBotB AND Bdy<=ThTopB,96,0)+ If(Bdy>ThTopB,112,0))+
If(C<O,1,0)*(If(Bdy<=ThBotB,32,0)+ If(Bdy>ThBotB AND
Bdy<=ThTopB,16,0)))
+(If(Lshd=0,3,0)+ If(Lshd<ThBotL AND Lshd>0,2,0)+ If(Lshd>ThBotL AND
Lshd<=ThTopL AND Lshd>0,1,0))+(If(Ushd>0 AND Ushd<=ThBotU,4,0)+
If(Ushd>ThbotU AND Ushd<=ThTopU,8,0)+ If(Ushd>ThTopU,12,0));
CCode;
close long:
((CCI(11)<80) AND
(Ref(CCI(11),-1)>80)) OR
((CCI(11)<-80) AND
Ref(CCI(11)>-80,-1))
enter short:
(Fml("Candle - Hanging Man'")=-1) AND
(CCI(11)>50)
close short:
((CCI(11)>-80) AND
(Ref(CCI(11),-1)<-80)) OR
((CCI(11)<80) AND
Ref(CCI(11)>80,-1))
(Go Top)
Candle Shadow Support
This is a custom - made Formula based on Candlesticks called CANDLE
SHADOW SUPPORT - RESISTANCE (by John D. Kontessis) Based on
extensive study of the following books "Japanese Candlestick Charting
Techniques", S.Nison, 1991 "Beyond Candlesticks" S.Nison, 1994 "Tehcical
Analysis" X.E. Kourouklis, METAPUBLICATIONS (in greek language only) As
we all know, one of the most important components of a candlestick is its
shadow. A candle's shadow tends to get longer as prices get closer to
support-resistance levels, as well as when they reach points of change in
Trend (e.g. pullbacks or entry in ranging periods). As prices reach a
Support level (or when building a support) the candles' lower shadows get
longer. Consequently, as prices reach a Resistance Level (or when building
a resistance) the candles' upper shadows get longer. The obvious problem
that an analyst faces is that such subtle changes are difficult to discern
and evaluate by naked eye only.
This problem can be easily solved by using the following two Formulas in
Metastock's Indicator Builder. After Opening the "Indicator Builder", choose
"New" and name the Formula : "CandleShadow Resistance ", enter the
following :
ShadowResistance:=If(OPEN<CLOSE,(HIGH-CLOSE),(HIGH-OPEN));
Mov(ShadowResistance,3,S); {for not so short-term results, use:
Mov(ShadowResistance,10,w)}
and press "ok".
Now let's build the second Formula: After Opening the "Indicator Builder",
choose "New" and name the Formula : "CandleShadow Support", enter the
following :
ShadowSupport:=If(CLOSE>OPEN,(OPEN-LOW),(CLOSE-LOW));
Mov(ShadowSupport,3,S); {for not so short-term results, use:
Mov(ShadowSupport,10,w)} and press "ok".
So far we have built two Formulas, who, after measuring the shadows of
the candles in our chart, they "draw" a 3-Day Mov.Average of the size of
the shadows (or alternatively a 10day weighted Mov.Average). The first
Formula "CandleShadow Resistance" measures the upper shadow and the
second Formula "CandleShadow Support" measures the lower shadow. You
can always experiment with the type of Mov.Averages (simple, weighted,
exponential etc) and the periods used so as to achieve the best "optical"
results. Now let's see these Formulas at work. In an UPTREND : Higher Tops
in "CandleShadow Resistance " and simultaneously lower tops in
"CandleShadow Support" , state a weakness of the uptrend.(bearish
signal). Lower Tops in "CandleShadow Resistance " and simultaneously
higher tops in "CandleShadow Support" , state a strength of the uptrend.
(bullish signal). In a DOWNTREND : Higher Tops in "CandleShadow
Resistance " and simultaneously lower tops in "CandleShadow Support" ,
state a strength of the downtrend. (bearish signal). Lower Tops in
"CandleShadow Resistance " and simultaneously higher tops in
"CandleShadow Support" , state a weakness of the downtrend. (bullish
signal). At your disposal for any questions or comments. John D.
(Go Top)
CCI Spike Trading System
{This system uses the momentum Commodity Channel Index (CCI)
indicator to
find short-term bottoms in the market. The CCI indicator is extremely
volatile and is generally difficult to use when trading the S&P 500 Index.
We, however, have turned this volatility into a trading advantage by using
the spread or gap between the CCI index and its moving average as a
reversal
signal. Specifically if the gap is larger then a certain percentage and CCI
indicator crosses above its moving average we buy the market. The
system
remains in the market for a short period of time, exiting the trade as the
indicators cross to the downside. As designed, this system only trades long
the market; it can however be altered to short the market. It is best used
in choppy bullish markets similar to the 1995 bull market.}
Ref(CCI(13)/(Mov(CCI(13),3,S)),-1)>1.5 AND
Cross(CCI(13),(Mov(CCI(13),3,S))) AND
Ref(CCI(13),-1)<-25
{Exit long:}
Cross((Mov(CCI(13),3,S)),CCI(13)) AND
Ref(CCI(13),-1)>200
(Go Top)
Chande and Kroll's R2 Indicator
rev. 01/06/97
In their book "The New Technical Trader," Chande& Kroll introduce the r2
indicator. They state that
"the primary use of r2 is as a confirming indicator" and that "it is a
lagging indicator that shows
the strength of the trend."
Pwr(Corr(Cum( 1 ),C,14,0),2)
Mov(Pwr(Corr(Cum( 1 ),C,14,0),2)*100,14,S)
(Go Top)
Chande and Kroll's R2 Indicator
rev. 01/06/97
In their book "The New Technical Trader," Chande& Kroll introduce the r2
indicator. They state that
"the primary use of r2 is as a confirming indicator" and that "it is a
lagging indicator that shows
the strength of the trend."
Pwr(Corr(Cum( 1 ),C,14,0),2)
Mov(Pwr(Corr(Cum( 1 ),C,14,0),2)*100,14,S)
(Go Top)
Chandelier Exit 2
Here is the Fast Chandelier Exit in full as supplied to me. It is part of an
exit strategy which you can adjust to your own trading style and comfort
levels. from Ian Burgoyne
ATRDays:=Input("ATR Days",1,30,10);
ATRHighMult:=Input("ATR Multiplier From High",1,5,3.0);
HighStop:= H - ATRHighMult*ATR(ATRDays);
CloseStop:= C - ATRCloseMult*ATR(ATRDays);
The more time I spend with the Chandelier exit, the more I admire its
strength as an exit and its simplicity. Because exits tend to be the weakest
part of a system, I would urge everyone to spend some time with it.
And Chuck LeBeau gets credit for the MetaStock code, not me. I just took
his framework and applied it to his exit.
{LONG EXIT}
LongEntry:= {this your entry system, eg. Cross(CLOSE, Mov(C,20,E))};
MoneyMgmtStop:= {this is your maximum loss, in points};
{DEFINE ENTRY PRICE, WITH EXIT BEING -- ENTRY PRICE AND NO TRADE
BEING 0}
EntryPrice:= If(PREV <= 0,
{Trade entered today?}
If(LongEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(LOW <= PREV - MoneyMgmtStop, -PREV,
If(LOW <= HighestSince(1,PREV=0, HIGH) - 3 * ATR(10), -PREV,
If(LOW <= HighestSince(1,PREV=0, CLOSE) - 2.5 * ATR(10), -PREV,
PREV))));
{SHORT EXIT}
ShortEntry:= {this your entry system, eg. Cross(Mov(C,20,E), CLOSE)};
MoneyMgmtStop:= {this is your maximum loss, in points};
{DEFINE ENTRY PRICE, WITH EXIT BEING -ENTRY PRICE AND NO TRADE
BEING 0}
EntryPrice:= If(PREV <= 0,
{Trade entered today?}
If(ShortEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(HIGH >= PREV + MoneyMgmtStop, -PREV,
If(HIGH >= LowestSince(1,PREV=0, LOW) + 3 * ATR(10), -PREV,
If(HIGH >= LowestSince(1,PREV=0, CLOSE) + 2.5 * ATR(10), -PREV,
PREV))));
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.
For those not familiar with it, the channel exit is quite a straight forward
trailing stop. Once you're in a trade (let's say, long), you maintain your
stops at the lowest low of the past number of days (optimized, in the code
below) until you are taken out of the market. This method attempts to let
profits run in the direction of the trend, but takes you out when price
makes a significant reversal and you risk giving back profits on a
retracement or the end of the trend.
Below is the code for a channel exit. It also includes a money management
stop to limit losses to an acceptable level until the channel exit exceeds it.
Work on variations of this basic theme, such as moving the stop up faster
where the market makes rapid gains and your lowest low in, say, 10 or 20
days is just too far away to adequately protect profits.
Glen Wallace
{LONG EXIT}
LongEntry:= {this your entry system, eg. Cross(CLOSE, Mov(C,20,E))};
MoneyMgmtStop:= {this is your maximum loss, in points};
{DEFINE ENTRY PRICE, WITH EXIT BEING -ENTRY PRICE AND NO TRADE
BEING 0}
EntryPrice:= If(PREV <= 0,
{Trade entered today?}
If(LongEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(LOW <= Max(PREV - MoneyMgmtStop, Ref(LLV(LOW,opt1),-1)), -PREV,
PREV));
EntryPrice < 0
{SHORT EXIT}
ShortEntry:= {this your entry system, eg. Cross(Mov(C,20,E), CLOSE)};
MoneyMgmtStop:= {this is your maximum loss, in points};
{DEFINE ENTRY PRICE, WITH EXIT BEING -ENTRY PRICE AND NO TRADE
BEING 0}
EntryPrice:= If(PREV <= 0,
{Trade entered today?}
If(ShortEntry, CLOSE, 0),
{Trade entered before today.Stopped today?}
If(HIGH >= Min(PREV + MoneyMgmtStop, Ref(HHV(HIGH,opt1),-1)), -PREV,
PREV));
Specifically, sell the opening the day after the BB Histo closes above 100.
"2) Buy or cover when the indicator goes from above 100 to below 100 or
from above 0 to below 0 X-number
of days after that occurs."
Buy, when the BB Histo dips below zero (the following morning).
"a) how many days after the signal does one act;"
close to close
BAR - Fractal-down
If(LOW < Ref(LOW, -1),1,0) AND If(LOW < Ref(LOW, -2),1,0) AND If(LOW <
Ref(LOW,+1),1,0) AND If(LOW < Ref(LOW,+2),1,0)
BAR - Fractal-up
(If(HIGH > Ref(HIGH, -1),1,0) AND If(HIGH > Ref(HIGH, -2),1,0) AND If(HIGH
> Ref(HIGH, +1),1 ,0)AND If(HIGH > Ref(HIGH,+2),1,0))
{and} If(CLOSE,<,Ref(LLV(C,80),-5),{and}
If(Mov(V,5,S),>=,1.5*(Ref(Mov(V,60,S),-5)),+1,0),0),0),0)
(Go Top)
Connors & Raschke's Historical Volatility System
Here is the Connors and Raschke's historical volatility system exploration
in August 1996 TASC Trader's Tips translated for MetaStock.
COLUMN FORMULAS
Column A : Vol ratio
std(log(C/ref(C,-1)),5)/std(log(C/ref(C,-1)),99)
Column B : NR4 day
if(HIGH-LOW,<,ref(llv(H-L,3),-1),1,0)
Column C : Inside
if(HIGH,<,ref(HIGH,-1),if(LOW,>,ref(LOW,-1),1,0),0)
Column D : High
HIGH
Column E : Low
LOW
FILTER FORMULA
Formula:
when(colA,<,0.5) AND (when(colB,=,1) OR when(colC,=,1))
(Go Top)
Consolidation Breakout, Downside
If(Ref(Fml("congestion index"),-5),<,10,
{and} If(Fml("congestion index"),>=,10,
{and} If(CLOSE,>,Ref(HHV(C,80),-5),
{and} If(Mov(V,5,S),>=,1.5*(Ref(Mov(V,60,S),-5)),
+1,0),0),0),0)
Col A: CLOSE
If(Ref(Fml("congestion index"),-5),<,10{%},
{and} If(CLOSE,<,Ref(LLV(C,80),-5),
{and} If(Mov(V,5,S),>=,1.5*(Ref(Mov(V,60,S),-5)),
+1,0),0),0),0)
(Go Top)
Consolidation Breakout, Upside
Col A: CLOSE
((HHV(C,80)-LLV(C,80))/LLV(C,80))*100
(Go Top)
Countback line for Metastock
(Note. This is very good, but the limitation is the lookback period. The
calculation point for the CBL line might be 5, 10, 15, 30 days away from
todays date.Also watch for the way 'gap' days are treated. Daryl Guppy)
Copied from StockCentral - Thanks Ken D
Well .... last weekend I replied to a post requesting a MetaStock solution
for calculating the Countback Line discussed in Daryl Guppy's book "Share
Trading: An Approach to Buying and Selling". Subequently, about 30
requests for the formulas I use were received. Not unexpectedly, a few
defects were found with the original offerings. This helped forge a
somewhat more robust solution, which is here given to the wider audience
of this Forum, so that further improvements may be forthcoming.
Alternatives of presentation style are many, according to taste, but we are
here requesting improvements in substance, identification of possible
flaws, or have real simplification benefits - please provide solutions where
possible.
CBLhi:
HighDays := Input("Enter # days to cover last HIGH for CBL calc'n:", 3, 55,
13);
If(HIGH < HHV(HIGH, HighDays), {then ...} PREV, {previous CBLhi, else...}
If(Ref(L,-2) < Ref(L,-1) AND Ref(L,-2) < L AND Ref(L,-1)< L, {then ...}
Ref(L,-2), {2nd day back low, else...} If((Ref(L,-3)< Ref(L,-2) AND Ref(L,-3)
< Ref(L,-1) AND Ref(L,-3) < L) AND (Ref(L,-2)< L OR Ref(L,-1) < L),
{then ... } Ref(L,-3), {3rd day back low, else...} If((Ref(L,-4)< Ref(L,-3)
AND Ref(L,-4) < Ref(L,-2) AND Ref(L,-4) < Ref(L,-1) AND Ref(L,-4) < L) AND
(Ref(L,-3)< L OR Ref(L,-2) < L OR Ref(L,-1) < L), {then... } Ref(L,-4), {4th
day back low, else...} If((Ref(L,-5)< Ref(L,-4) AND Ref(L,-5) < Ref(L,-3) AND
Ref(L,-5) < Ref(L,-2) AND Ref(L,-5) < Ref(L,-1) AND Ref(L,-5) < L) AND
(Ref(L,-4)< L OR Ref(L,-3) < L OR Ref(L,-2) < L OR Ref(L,-1) < L), {then ...}
Ref(L,-5), {5th day back low, else...} PREV )))))
CBLlo:
LowDays := Input("Enter # days to cover last LOW for CBL calc'n:", 3, 55,
13);
If(LOW > LLV(LOW, LowDays), {then ...} PREV, {previous CBLlo, else...}
If(Ref(H,-2) > Ref(H,-1) AND Ref(H,-2) > H AND Ref(H,-1)> H, {then ...}
Ref(H,-2), {2nd day back high,else...} If((Ref(H,-3)> Ref(H,-2) AND Ref(H,-
3) > Ref(H,-1) AND Ref(H,-3) > H) AND (Ref(H,-2)> H OR Ref(H,-1) > H),
{then ... } Ref(H,-3), {3rd day back high,else...} If((Ref(H,-4)> Ref(H,-3)
AND Ref(H,-4) > Ref(H,-2) AND Ref(H,-4) > Ref(H,-1) AND Ref(H,-4) > H)
AND (Ref(H,-3)> H OR Ref(H,-2) > H OR Ref(H,-1) > H), {then... } Ref(H,-
4), {4th day back high,else...} If((Ref(H,-5)> Ref(H,-4) AND Ref(H,-5) >
Ref(H,-3) AND Ref(H,-5) > Ref(H,-2) AND Ref(H,-5) > Ref(H,-1) AND Ref(H,-
5) > H) AND (Ref(H,-4)> H OR Ref(H,-3) > H OR Ref(H,-2) > H OR Ref(H,-1)
> H), {then ...} Ref(H,-5), {5th day back high,else...} PREV )))))
ut:=FmlVar("GANN-Trend","TDV");
uplot:=If(BarsSince(Ut=1)<
BarsSince(Ut=-1),1,0);
uplot=1;
dt:=FmlVar("GANN-Trend","TDV");
dplot:=If(BarsSince(dt=1)>
BarsSince(dt=-1),1,0);
dplot=1;
Then click on the "ribbon" option and turn off "Display Vertical Lines", I
also turn off the corner option.
3a. Under highlights tab create a new and call it "HiLo Change", choose
color, and enter this code:
HLd:=If(CLOSE>Ref(Mov(H,3,S),-1),
{then}1,
{else}If(CLOSE<Ref(Mov(L,3,S),
-1),
{then}-1,
{else}0));
HLv:=ValueWhen(1,HLd<>0,HLd);
HLv<>Ref(HLv,-1);
3b. Create new and call it "Up-Trend", choose color, and enter this code:
ut:=FmlVar("GANN-Trend","TDV");
uplot:=If(BarsSince(Ut=1)<
BarsSince(Ut=-1),1,0);
uplot=1;
3c. Create new and call it "Down-Trend", choose color, and enter this code:
dt:=FmlVar("GANN-Trend","TDV");
dplot:=If(BarsSince(dt=1)>
BarsSince(dt=-1),1,0);
dplot=1;
4a. Under "Symbols" tab create new and call it " UpSwing", enter this
code:
FmlVar("GANN-Swing","SD2")=1;
then under graphic choose "Buy Arrow", choose color (Dark Green), and
small size, then pick "Above Price Plot".
FmlVar("GANN-Swing","SD2")=-1;
then under graphic choose "sell arrow", choose color (Dark Red), and small
size, then pick "Below Price Plot".
As for the HiLo ....just plot it as a regular indicator and choose the last
"style" option under "color/style" tab.
(Go Top)
Creating Dynamic Vertical Lines
from Ken
These are dynamic moving vertical lines. Each new bar causes the line to
move orward one bar.
How to Create a Vertical Line in MetaStock
n:=89;
LastLoadedBarNum:=LastValue(Cum(1));
Cum(1)=(LastLoadedBarNum-n)+1
Chande, the original inventor, didn't use a moving average on the whole
thing. Chande's result was therefore sort of choppy. I guess along the way
people decided to add the EMA Periods to smooth things out.
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((RSI(mp1)-LLV(RSI(mp1),mp2)),mp3)/Sum((.0000001+
(HHV(RSI(mp1),mp2)-(
LLV(RSI(mp1),mp2)))),mp3),mp4,E)*100
Now, from various posts, etc., the following parameters (mp1, mp2 and
mp4)
*seem* to be the one's recommended. I'm trying to further find consensus
among users of StochRSI on what really appears to work for them.
StochRSI Set
--------------------
5 -- 5 -- 3
8 -- 8 -- 5
13 -- 13 -- 13
21 -- 15 -- 13
21 -- 21 -- 13
34 -- 34 -- 13
55 -- 55 -- 21
89 -- 13 -- 34
89 -- 89 -- 21
233 -- 233 -- 34
(Go Top)
Cyclical System
from Ton Maas ms-irb@wxs.nl
-----------------------
MetaStock 6.5 Indicator
-----------------------
Name:
Cyclical System - J O Katz
Formula:
{TASC Feb99}
thresh:= {omit whipsaw} 4;
k:= {roc comparison period} 3;
m:= {cycle period} 63;
hld:= {maximum period holding position} 10;
Value1:= {volatility}
Stdev(Mov(C,m,S)-Mov(C,m+k,S),20);
Value2:= {roc, relative comparison ratio}
Mov(C,m,S)-Mov(C,m+k,S);
tv1:= thresh*Value1;
EL:={Enter Long} Value2>tv1;
CL:={Close Long} Ref(Cross(Value2,tv1),-hld);
ES:={Enter Short} Value2<tv1;
CS:={Close Short} Ref(Cross(tv1,Value2),-hld);
JKcycl:=If((EL>0)=1,+10,
If((ES>0)=1,-10,0));
JKcycl
---------------------------
MetaStock 6.5 System Tester
---------------------------
Name:
Jeffrey Owen Katz - Cyclical System
Notes:
{February 1999 - TASC-article (see also TRADERS' TIPS)}
Formulas:
{copy-repeat all that is printed below when applying for the right rule}
thresh:= {omit whipsaw} 4;
k:= {roc comparison period} 3;
m:= {cycle period} 63;
hld:= {maximum period holding position} 10;
Value1:= {volatility}
Stdev(Mov(C,m,S)-Mov(C,m+k,S),20);
Value2:= {roc, relative comparison ratio}
Mov(C,m,S)-Mov(C,m+k,S);
tv1:= thresh*Value1;
Rules:
{Enter Long} Value2>tv1
{Close Long} Ref(Cross(Value2,tv1),-hld)
{Enter Short} Value2<tv1
{Close Short} Ref(Cross(tv1,Value2),-hld)
{After entering the formulas, click OK. Then click Options. On the Testing
page, set the Trade Delay to zero, set Positions to "both", and then set any
other desired options (apart from Optimizing, which is not advisable; leave
the factory default settings). Click OK to save the changes, and then open
a
chart and run the system.}
(Go Top)
Candle Strength Index
Periods:=Input("Enter Periods",2,13,2);
Mov(Mov(Mov(Fml("Candlecode"),Periods,S),Periods,S),Periods,S)
(Go Top)
Chande Momentum Oscillator Composite Average
(((CMO(C,5))+(CMO(C,10))+(CMO(C,20)))/3)
(Go Top)
Chande Momentum Oscillator Volatility
S1:= Stdev( CMO(C,5),5);
S2:= Stdev(CMO(C,10),10);
S3:= Stdev(CMO(C,20),20);
CMOV:=(S1*CMO(C,5))+(S2*CMO(C,10))+(S3*CMO(C,20))/(S1+S2+S3);
CMOV;
(Go Top)
Chande's Momentum Oscillator
The following are MetaStock formulas for Tuschar Chande's Momentum
Oscillator. For interpretation refer to the book The New Technical Trader, by
Tuschar Chande and Stanley Kroll.
CMO_1
Sum( If( C ,> ,Ref( C, -1 ) , ( C - Ref( C ,-1 ) ) ,0 ) ,14 )
CMO_2
Sum( If( C ,< ,Ref( C ,-1 ) , ( Ref( C ,-1 ) - C ) ) ,0 ) ,14 )
CMO_Final
100 * ( ( Fml( "CMO_1" ) - Fml( "CMO_2" ) ) / ( Fml( "CMO_1" ) +
Fml( "CMO_2" ) ) )
You could also combine the above three formulas into one formula. The
syntax would be:
100*((Sum(If(C,>,Ref(C,-1),(C-Ref(C,-1)),0),14))-(Sum(If(C,<,REF(C,-1),
(REF(C,-1)-C),0),14))) /((Sum(If(C,>,Ref(C,-1),(C-Ref(C,-1)),0),14)+
(Sum(If(C,<,REF(C,-1),(REF(C,-1)-C),0),14))))
*** These formulas were constructed using 14 time periods, you can
change this by replacing every occurrence of 14 with your desired time
period value.
(Go Top)
Chande's Trendscore
If(C>=Ref(C,-11),1,-1)+If(C>=Ref(C,-12),1,-1)+If(C>=Ref(C,-13),1,-1)+
If(C>=Ref(C,-14),1,-1)+If(C>=Ref(C,-15),1,-1)+If(C>=Ref(C,-16),1,-1)+
If(C>=Ref(C,-17),1,-1)+If(C>=Ref(C,-18),1,-1)+If(C>=Ref(C,-19),1,-1)+
If(C>=Ref(C,-20),1,-1)
(Go Top)
Comparitive Relative Strength in MetaStock™ for Windows
Comparative Relative Strength charts can be useful in deciding which
security to buy, by helping to pinpoint the best performer. They can also
be useful in developing spreads, i.e., purchase of the best performer
"long", and selling the weaker issues "short." Comparative Relative
Strength can be applied in MetaStock for Windows as follows:
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
Coppock Curve
The Coppock Curve was developed by Edwin Sedgwick Coppock in 1962. It
was featured in the November 94 issue of Technical Analysis of Stocks&
Commodities, in the article "The Coppock Curve", written by Elliot
Middleton.:
Taken from Stocks & Commodities, V. 12:11 (459-462): The Coppock Curve
by Elliott Middleton
"We are creatures of habit. We judge the world relative to what we have
experienced. If we're shopping for a mortgage and rates have been in the
teens (as they were in the early 1980s) and then drop to 10%, we are
elated. If, however, they've been at 8% and then rise to 10%, we are
disappointed. It all depends on your perspective.
The principle of adaptation-level applies to how we judge our income
levels, stock prices and virtually every other variable in our lives.
Psychologically, relativity prevails..
SIMPLEST FORMS
The moving average is the simplest form of adaptation-level. Moving
average crossover rules accurately signal the onset of periods of returns
outside the norm, whether positive or negative. This makes moving
average crossovers useful to traders who want to get a boost on entering
or exiting stocks or funds.
The oscillator is also based on adaptation-level, although in a slightly
different way. Oscillators generally begin by calculating a percentage
change of current price from some previous price, where the previous
price is the adaptation-level or reference point. The mind is attuned to
percentage changes because they represent returns. If you bought
Microsoft Corp. stock (MSFT) at $50 and it goes to $80, you make 60%
before dividends. If you bought Berkshire Hathaway (BRK) at $4,000 and it
rises to $4,030, the same dollar gain, you make 0.75% before dividends.
It's the percentage change that counts. Relativity again.
Coppock reasoned that the market's emotional state could be determined
by adding up the percentage changes over the recent past to get a sense
of the market's momentum (and oscillators are generally momentum
indicators ). So if we compare prices relative to a year ago - which
happens to be the most common interval - and we see that this month the
market is up 15% over a year ago, last month it was up 12.5% over a year
ago, and 10%, 7.5% and 5%, respectively, the months before that, then
we may judge that the market is gaining momentum and, like a trader
watching for the upward crossover of the moving average, we may jump
into the market."
The MetaStock™ formula for the Coppock Curve is:
(MOV(ROC(MOV(C,22,S),250,%),150,E))/100
Channel Analysis
Channel Analysis, beginning on page 18 of the July 1998 Technical Analysis
of Stocks & Commodities Magazine It's quite easy to create the Trend
Channels discussed in Thom Hartle's Channel Analysis article in MetaStock
for Windows.
After opening a chart, you may want to zoom in a little to make it easier to
draw the Trend Channels more precisely. You can do this by clicking on the
"+" button located on the Chart Toolbar at the bottom of the chart. Next
you may want to identify the bars for the support or resistant points by
drawing circles on the bars as Mr. Hartle did in the article, or you can use
symbols from the symbol palette.
Both can be chosen from the Drawing Toolbar which is on left side of the
chart. After identifying the points to draw the trendline, click on the
Trendline button, also located on the Drawing Toolbar, and draw the
trendline between the closing prices of the two bars. If you are using
MetaStock 6.5, you may want to right-click on the trendline, choose
properties, and then check the Snap to Price checkbox. This will make the
trendline line up exactly with the closing prices.
To create the second trendline of the Trend Channel, right-click on the first
trendline and choose Create Parallel Line. Drag this parallel line so it aligns
with the highest high between the two support points or the lowest low
between two resistance points. If desired, you can go to the properties of
each of these trendlines and choose to extend the lines to the right.
(Go Top...)
Combining Statistical and Pattern Analysis, Shark – 32
In MetaStock for Windows you can use the Expert Advisor to recreate the
"Shark – 32" signals on your charts as discussed in Walter T. Down's article
"Combining Statistical and Pattern Analysis".
First, choose Expert Advisor 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;
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
After you have finished creating the Symbol formulas, you can attach the
Expert to your chart by choosing Expert Advisor from the Tools Menu.
Select the Expert called "Shark – 32" from your list of Experts, choose
Attach, and then Close.
(Go Top...)
CCI Moving Average Crossover Test
System Explanation: Buy when the Moving Average crosses up through
the CCI and sell on the reverse condition.
Signal Formulas
Enter Long
When( CCI( opt1 ) ,< ,Mov( CCI( opt1 ) ,opt2 ,E ) ) AND
When( Ref( CCI(opt1) ,-1) ,>= ,Ref( Mov( CCI( opt1 ) ,opt2 ,E ) ,-1 ) )
Enter Short
When( CCI( opt1 ) ,> ,Mov( CCI( opt1 ) ,opt2 ,E ) ) AND
When( Ref( CCI(opt1) ,-1) ,<= ,Ref( Mov( CCI( opt1 ) ,opt2 ,E ) ,-1 ) )
Optimization Variables
Opt1: Min = 5 Max = 40 Step = 1
Opt2: Min = 5 Max = 40 Step = 1
(Go Top...)
Combining Trend and Oscillator Signals
The information for this test was published in the December 1996 issue of
Technical Analysis of Stocks and Commodities. The test appears in the
article "Combining Trend and Oscillator Signals" by Jeremy G. Konstenius.
Mr. Konstenius describes a trading system that combines Linear
Regression and Moving averages to generate trades.
To create this test in MetaStock do the following:
• Run MetaStock version 6.0 or higher
• Click Tools | System Tester | New
• Type a name for the test in the Name column
• Enter the following System Test rules and options.
Signal Formulas
Enter Long
C>Mov(C,OPT1,S) AND LinRegSlope(C,OPT2)>LinearReg(LinRegSlope(C
,OPT3),50)
Close Long
C<Mov(C,OPT1,S) OR LinRegSlope(C,OPT2)<LinearReg(LinRegSlope(C
,OPT3),50)
Enter Short
C<Mov(C,OPT1,S) AND LinRegSlope(C,OPT2)<LinearReg(LinRegSlope(C
,OPT3),50)
Close Short
C>Mov(C,OPT1,S) OR LinRegSlope(C,OPT2)>LinearReg(LinRegSlope(C
,OPT3),50)
Optimize
OPT1: Minimum 5 Maximum 50 Step 5
OPT2: Minimum 5 Maximum 50 Step 5
OPT3: Minimum 5 Maximum 50 Step 5
DayNr
(Go Top...)
Calendar Day of Year
{ Calendar Day of Year counter }{ count is independent of any missing
chart data }{ ©Copyright 2003 Jose Silva }{ josesilva22@yahoo.com }
Day
(Go Top...)
Calendar Weekday counter
{ Weekday (Mon~Fri) counter from 1960 }{ Count is independent of any
missing chart data }{ ©Copyright 2003 Jose Silva }
{ josesilva22@yahoo.com }
WkDayCount
WkDayCount-ValueWhen(2,1,WkDayCount)-1
+VolMissing
(Go Top...)
Calendar Week counter
{ Week counter v2.0, Gregorian calendar }{ Count is independent of any
missing chart data }{ ©Copyright 2003-2004 Jose Silva }
{ josesilva22@yahoo.com }
WkCount
(Go Top...)
Calendar Week of Year
{ Calendar Week of year counter v2.1 }{ count is independent of any
missing chart data }{ ©Copyright 2003 Jose Silva }
{ josesilva22@yahoo.com }
Week:=Int(Frac((d+.5+offset)/(374+offset))
*(374+offset)/7)+1;
Week
(Go Top...)
Calendar ASX non-Friday end-of-week(1)
{ ASX non-Friday end-of-week dates, 01/01/1980~31/12/1999 }
{ Plots correct end-of-week signals for ASX stocks, including ASX non-
Friday end-of-week dates since 01/01/1980 }{ josesilva22@yahoo.com }
day:=DayOfWeek()=dayChosen;
d:=DayOfMonth();
signalCount:=
If(day AND d<=7,1,
If(day AND d>7 AND d<=14,2,
If(day AND d>14 AND d<=21,3,
If(day AND d>21 AND d<=28,4,
If(day AND d>28,5,0)))));
signal:=weekChosen=signalCount;
If(plot=1,signal,signalCount)
(Go Top...)
Calendar Week of Month
{ Calendar-absolute Week-of-Month signals }{ Plot on own window below
chart }{ ©Copyright 2004 Jose Silva }{ josesilva22@yahoo.com }
WeekOfMonth:=Input("[1]st [2]nd [3]rd [4]th [5]th week in
month",1,5,1);
plot:=Input("[1]Week signals, [2]Week count",1,2,1);
d:=DayOfMonth();
weekNr:=If(d<=7,1,
If(d>7 AND d<=14,2,
If(d>14 AND d<=21,3,
If(d>21 AND d<=28,4,5))));
signal:=weekNr=WeekOfMonth;
If(plot=1,signal,WeekNr)
(Go Top...)
Cycle Length
{ Price peak/trough cycle length v4.0 }{ Warning: last peak/trough is
dynamic!}{ Plot in own window below price chart }
pk:=PeakBars(1,C,zzper)=0;
tr:=TroughBars(1,C,zzper)=0;
lastBar:=Cum(1)=LastValue(Cum(1));
lastLeg:=lastBar*LastValue(BarsSince(pk OR tr));
CycleUp:=pk*BarsSince(tr);
CycleUpAvg:=
Cum(CycleUp)/(Cum(CycleUp>0)+.000001);
CycleUpStdDev:=Stdev(CycleUp,pds);
CycleUpStdDevAvg:=Cum(CycleUpStdDev)
/(Cum(CycleUpStdDev>0)+.000001);
CycleDw:=tr*BarsSince(pk);
CycleDwAvg:=
Cum(CycleDw)/(Cum(CycleDw>0)+.000001);
CycleDwStdDev:=Stdev(CycleDw,pds);
CycleDwStdDevAvg:=Cum(CycleDwStdDev)
/(Cum(CycleDwStdDev>0)+.000001);
statCycle:=CycleUp-CycleDw;
lastLeg:=If(ValueWhen(1,pk OR tr,statCycle)<0,
lastleg,-lastleg)*lastBar;
cycle:=statCycle+lastLeg;
zz:=Zig(cycle,zzper,%);
plotUp:=If(plot=1,0,
If(plot=2,CycleUpAvg,
If(plot=3,CycleUpStdDevAvg,0)));
plotDw:=If(plot=1,cycle,
If(plot=2,-CycleDwAvg,
If(plot=3,-CycleDwStdDevAvg,zz)));
plotUp;plotDw
6/4/2004 ASX 1152 active stocks exploration, 3.25% ZigZag cycle lengths,
last price cycles:
4 trade days for positive price cycles;
5 trade days for negative price cycles;
9 trade days complete price cycles.
Column A: + cycle
Column B: - cycle
Column C: AbsCycle
Column D: + prev
Column E: - prev
{ previous complete (static) negative cycle }
x:=FmlVar("ZigZag Cycle Length","CYCLEDW");
-ValueWhen(1,x<>0,x)
Column F: TotalPrv
Filter:
{ *********************************** }
DayOfMonth()=day
AND Month()=mth
AND Year()=yr
AND V>0
6/4/2004 ASX 1152 active stocks exploration, 3.25% ZigZag cycle lengths,
mean price cycles: 3.7 trade days for positive price cycles; 4.5 trade days
for negative price cycles; 8.2 trade days complete price cycles.
Column A: + avg
Column B: - avg
Column C: TotalAvg
Column E: - StdDev
Column F: TotStdDv
Filter:
{ *********************************** }
DayOfMonth()=day
AND Month()=mth
AND Year()=yr
AND V>0
Dahl Oscillator
I came up with the following to put Dahl into an oscillator format. It is the
STOCHRSI formula, replacing RSI with a 55 day Dahl. Does this reflect your
thinking on the indicator? It seems to lead changes in Dahl by a period or
two, but doesn't seem as fast as the STOCHRSI indicator. Checking a few
stocks in my database, there are very few times that it goes below zero,
but it will 'peg out' at 100 for significant periods. Perhaps the 14 day
smoothing is too short in relation to the 55 period primary indicator. A
longer MA period seems to smooth it out significantly, which would seem
to defeat the purpose of using an oscillator.
If(SAR(.02,.2)<C,1,0) +
If((Mov(C,5,E)>Mov(C,13,E)),1,0) +
If((Mov(C,13,E)>Mov(C,40,E)),1,0) +
If((Mov(C,8,E)-Mov(C,17,E))> (Mov(Mov(C,8,E)-Mov(C,17,E),9,E)),1,0)+
If(Mov(C,50,SIMPLE) - Ref(Mov(C,50,SIMPLE),-15) > 0,1,0)+
If((Mov(ROC(C,12,%),3,E)>=-6 OR ROC(C,12,%)>0),1,0)+
If(OBV()>Mov(OBV(),40,S),1,0)+
If(V>Mov(V,120,S),1,0)
(Go Top)
Days Since Crossover
pds:=Input("Periods",2,200,14);
sd:=Input("Standard Deviations",.01,10,2);
D1:= RSI(pds);
alpha:=2/(pds+1);
mt:=alpha*D1+(1-alpha)*(If(Cum(1)<pds,D1,PREV));
ut:=alpha*mt+(1-alpha)*(If(Cum(1)<pds,D1,PREV));
dt:=((2-alpha)*mt-ut)/(1-alpha);
mt2:=alpha*Abs(D1-dt)+(1-alpha)*PREV;
ut2:=alpha*mt2+(1-alpha)*PREV;
dt2:=((2-alpha)*mt2-ut2)/(1-alpha);
but:=dt+sd*dt2;
blt:=dt-sd*dt2;
blt;
dt;
but;
(Go Top)
DEVSTOP
Divergence between the Close and an Indicator (Rev. 03/18/97 from Equis
Support) The following formula will calculate the correlation of the Close
and the MACD. It is written using a "long form" MACD so that the time
periods used by the MACD may be changed. This indicator shows
"divergence" between the close and the indicator: In the Windows versions
of MetaStock the formula is:
Correl(((Sum(Cum(1)*(Mov(C,12,E)-Mov(C,26,E)),100))-(Sum(Cum(1),100)*
Sum((Mov(C,12,E)-Mov(C,26,E)),100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),((Sum(Cum(1)*C,100))-
(Sum(Cum(1),100)* Sum(C,100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),12,0)
The interpretation of the indicator output is as follows: - .08 (80%) and
lower is divergence between the Close and the MACD. - 1 is very strong
divergence. + 1 is very strong correlation. The formula was constructed
this way so that most other indicators may be used in place of the MACD.
For example, here is the same indicator using the RSI(14):
Correl(((Sum(Cum(1)*(RSI(14)),100))-(Sum(Cum(1),100)*
Sum((RSI(14)),100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)), ((Sum(Cum(1)*C,100))-
(Sum(Cum(1),100)*Sum(C,100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),12,0)
(Go Top)
Double Inside Day
Col A: CLOSE
Col B: ROC(C,5,%)
Periodicity Daily
I know I'm a little slow, but I've just gotten around to working on the
Dynamic Multiple Time Frame indicators given by Robert Krausz in the
1999 Bonus Issue of TASC.
The code for the actual indicators can be found at the Equis website
(www.equis.com) so I won't post them again here. I've been testing a
system based on these indicators on Best Buy (a stock that seems to be
quite amenable to system trading) and getting very good results. The
system is currently for long trades only; I'll work on shorting later. Here's
what I've got so far
Enter Long:
day:=DayOfWeek();
Fml("dynamic balance")>Fml("dynamik balance point steps")
AND Fml("fixed balance point")>Ref(Fml("fixed balance Point"),-5)
OR Fml("tendency")>0 AND day=5
Close Long
Cross(Fml("dynamik balance point steps"),Fml("dynamic balance"))
AND Fml("fixed balance point")<Ref(Fml("fixed balance Point"),-5)
The problem is that the close is not defined, meaning that the two events
which initiate the close do not have to happen. The DBPS can cross the DB
without the 2nd condition occuring. Then, when later, the 2nd condition
does occur, sell is not triggered because the cross over has not happened
simultaneously with the 2nd condition. Theoretically, if we follow the
system strictly, this can lead to a complete loss. I understand that I can
set arbitrary stops, but I prefer to let the system do the work. Simply
reversing the entry signal and other tries, such as support breakthoughs,
drastically reduce the result.
(Go Top)
Dunnigan Trend
I like the Fibonacci Support & Resistance best of all, seems (IMHO)
that these support/resistance areas are very easy to visualize using
this formula."
(Go Top)
Dynamic Zones
Most indicators use a fixed zone for buy and sell signals. Here's a concept
based on zones that are responsive to past levels of the indicator.
The algorithm for the dynamic zones is a series of steps. First, decide the
value of the lookback period t. Next, decide the value of the probability
Pbuy for buy zone and value of the probability Psell for the sell zone.
The area above and below the dynamic zones constitute the upper and
lower 10% boundaries. The zones appear to evolve with the market
because they use a rolling 70-day period of indicator values in their
construction.
(Go Top)
Daily Close vs. High and Low Close
if((C-L)/(H-L),>,.66 ,1, if((C-L)/(H-L),<,.38,-1,0))
(Go Top)
Detrended Price Oscillator
The Detrended Price Oscillator (DPO) is an indicator that attempts to
eliminate the trend in prices. Detrended prices allow you to more easily
identify cycles and overbought/oversold levels. Here is the MetaStock
custom formula for the DPO:
Close-Ref( Mov(Close, X, Simple ), T)
***where X is the number of Time Periods for the Oscillator and T = X / 2 +
1.
For example, a 20 period DPO would be:
X = 20
T = (20/2 + 1) = 11
Close-Ref( Mov(Close, 20, Simple),11)
(Go Top)
Disparity Index
Steve Nison refers to the his Disparity Index "as a percentage display of
the latest close to a chosen moving average". This can be defined in
MetaStock using the formula:
( ( C - Mov( C ,X ,? ) ) / Mov( C ,X ,? ) ) * 100
** where X is the number of time periods and ? is the calculation type of
the moving average.
For example:
( ( C - Mov( C ,13,E ) ) / Mov( C ,13 ,E ) ) * 100
** where X = 13 time periods and ? = Exponential moving average.
For 32nds:
INT( C ) + ( ( FRAC( C ) / .03125 ) / 100 )
For 64ths:
INT( C ) + ( ( FRAC( C ) / .015625 ) / 100 )
**Where C is for the security's closing price and can be replaced with O, H,
or L for the open, high, or low price instead.
(Go Top)
Divergence Between the Close and an Indicator
The following formula will calculate the correlation of the Close and the
MACD. It is written using a "long form" MACD so that the time periods used
by the MACD may be changed. This indicator shows "divergence" between
the close and the indicator:
In the Windows versions of MetaStock the formula is:
Correl(((Sum(Cum(1)*(Mov(C,12,E)-Mov(C,26,E)),100))-(Sum(Cum(1),100)*
Sum((Mov(C,12,E)-Mov(C,26,E)),100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),((Sum(Cum(1)*C,100))-
(Sum(Cum(1),100)*
Sum(C,100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),12,0)
The interpretation of the indicator output is as follows:
- .08 (80%) and lower is divergence between the Close and the MACD.
- 1 is very strong divergence.
+ 1 is very strong correlation.
The formula was constructed this way so that most other indicators may
be used in place of the MACD.
For example here is the same indicator using the RSI(14)
Correl(((Sum(Cum(1)*(RSI(14)),100))-(Sum(Cum(1),100)*
Sum((RSI(14)),100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),
((Sum(Cum(1)*C,100))-(Sum(Cum(1),100)*Sum(C,100)/100))/
((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),12,0)
(Go Top)
Dynamic Momentum Oscillator
In July 1996 Futures magazine, E. Marshall Wall introduces the Dynamic
Momentum Oscillator (Dynamo). Please refer to this article for
interpretation.
He describes the Dynamo Oscillator to be:
Dynamo = Mc - ( MAo - O )
where
Mc = the midpoint of the oscillator
MAo = a moving average of the oscillator
O = the oscillator
This concept can be applied to most any oscillator to improve its results.
For example:
Applying the Dynamo Oscillator to a 5-period %K slowed 3 periods
Stochastic Oscillator would give:
50-(Mov(Stoch(5,3),21,S)-Stoch(5,3))
where:
Mc = Stochastic Oscillator's midpoint = 50
MAo = Moving average of the Stochastic = Mov(Stoch(5,3),21,S
O = Stochastic Oscillator = Stoch(5,3)
This example applies it to an RSI oscillator:
50-(Mov(RSI(14),21,S)-RSI(14))
where:
Mc = RSI's midpoint = 50
MAo = Moving average of the RSI = Mov(RSI(14),21,S
O= RSI Oscillator = RSI(14)
(Go Top)
Derivative Moving Average
The information for this test was published in the June 1996 issue of
"Technical Analysis of Stocks and Commodities". The test appears in the
article "The Derivative Moving Average" by Adam White, page 18. Mr.
White describes this test as using a variation of the "tried-and-true simple
moving average for entry signals and the "trend analysis index" for exit
signals. Note, first you need to create a new indicator called TAI, using the
TAI formula below - then create the new system test.
Signal Formulas
Enter Long:
When(Ref(Mov(C,28,S),-1),=,LLV(Mov(C,28,S),4))
Close Long:
When(Fml("TAI"),<,0.4) AND When(Ref(Fml("TAI"),-1),>=,0.4)
TAI Formula
((HHV(Mov(C,28,S),5)-LLV(Mov(C,28,S),5))/C)*100
Dr Elder also refers to a 2 period Force Index in which case, you would
change the ‘13’ above to ‘2’.
(The following explanatory notes are taken from ‘Trading for a Living’ by
Dr. Alexander Elder, Published by John Wiley & Sons, Inc, 1993)
“Force Index is an oscillator developed by this author. It measures the
force of bulls behind every rally and of bears behind every decline.
Force Index combines three essential pieces of market information – the
direction of price change, its extent, and trading volume. It provides a
new, practical way of using volume to make trading decisions.
Force Index can be used raw, but it works better if you smooth it with a
moving average. Force Index smoothed with a short MA helps pinpoint
entry and exit points. Force Index smoothed with a long MA reveals major
changes in the force of bulls and bears.
A 2-day EMA of Force Index provides a minimal degree of smoothing. It is
useful for finding entry points into the markets. It pays to buy when the 2-
day EMA is negative and sell when it is positive, as long as you trade in
the direction of the 13-day EMA of prices.
A 13-day EMA of Force Index tracks longer term changes in the force of
bulls and bears. When it crosses above its centerline, it shows the bulls are
in control. When it turns negative, it shows that bears are in control.
Divergences between 13-day EMA of Force Index and prices identify
important turning points.”
(Go Top...)
Date filter
{ Date filter }
{ Plots +1 signal within user-input date period }
{ josesilva22@yahoo.com }
StDay:=Input("start Day",1,31,1);
StMnth:=Input("start Month",1,12,1);
StYear:=Input("start Year",1800,2200,2003);
EnDay:=Input("end Day",1,31,31);
EnMnth:=Input("end Month",1,12,12);
EnYear:=Input("end Year",1800,2200,2003);
start:=Year()>StYear
OR (Year()=StYear AND (Month()>StMnth
OR Month()=StMnth AND DayOfMonth()>=StDay));
end:=Year()<EnYear
OR (Year()=EnYear AND (Month()<EnMnth
OR Month()=EnMnth AND DayOfMonth()<=EnDay));
start AND (end OR (start AND Alert(start=0,2)))
(Go Top...)
Divergences - Class A
{ Class A price/indicator divergence v3 }{ +1 signal = bullish trough
divergences }{ -1 signal = bearish peak divergences }{ ©Copyright 2003
Jose Silva }{ josesilva22@yahoo.com }
xu:=If(f=1,C,H);
xd:=If(f=1,C,L);
Pkx:=xu<Ref(xu,-1) AND Ref(xu,-1)>Ref(xu,-2)
AND Ref(xu,-1)>=(xu+Ref(xu,-2))/2*(1+Ch);
Pkx1:=ValueWhen(1,Pkx,Ref(xu,-1));
Pkx2:=ValueWhen(2,Pkx,Ref(xu,-1));
Trx:=xd>Ref(xd,-1) AND Ref(xd,-1)<Ref(xd,-2)
AND Ref(xd,-1)<=(xd+Ref(xd,-2))/2*(1-Ch);
Trx1:=ValueWhen(1,Trx,Ref(xd,-1));
Trx2:=ValueWhen(2,Trx,Ref(xd,-1));
0;
Ref(Trx AND Try AND Trx1<Trx2
AND Try1>Try2,shift)
-Ref((Pkx AND Pky AND Pkx1>Pkx2
AND Pky1<Pky2),shift)
ECO - R Krauz
The Robert Krauz article I read described the ECO as "a double smoothed
ratio of the difference between the close(C) and open(O) of each bar, and
the difference between the high(H) and low(L) prices for each bar"
originally created by William Blau.
{published in S&C - TASC article "Playing Trix" by Joe Luisi (June 1997) and
to be used on weekly data}
CLA:=TRIX(3);
CLB:=Ref(TRIX(3),-1);
CLC:=Mov(TRIX(3),8,TIMESERIES);
CLD:=Ref(Mov(TRIX(3),8,TIMESERIES),-1);
SHORT:=When(CLA,>,CLC) AND When(CLB,<,CLD) AND
When(CLA,<,0)AND When(CLA,>,-2);
LONG:=When(CLA,<,CLC) AND When(CLB,>,CLD) AND
When(CLA,>,0)AND When(CLA,<,+2);
If(LONG>0,+1,
If(SHORT>0,-1,PREVIOUS))
(Go Top)
Elliot Wave Identification
As far as using MetaStock for identifying waves, use a 5/34 histogram for
finding wave 4, the end of wave 3 and for help with identifying wave 1/2,
which apparently Advanced Get uses extensively. You can write MetaStock
explorations/templates/experts, etc., with this indicator; e.g.,
explorations to find the peaks and troughs of the 5/34 histogram.
Mov(OscP(5,34,E,$),5,S)
The peaks of the histogram help identify waves 1, 3 and 5 and troughs for
waves 2 and 4. Use MetaStock line studies (both trendlines, channels and
fib retracements) for additional wave identification/analysis. Of course,
you can label the waves with the text box.
(Go Top)
EMA Cross System
avoid using when the market has no clear direction --
enter long
mov(c,5,e)>mov(c,21,e) and
ref(mov(c,5,e),-1)<=ref(mov(c,21,e),-1)
exit long
mov(c,5,e)<mov(c,21,e) and
ref(mov(c,5,e),-1)>=ref(mov(c,21,e),-1)
(Go Top)
End Point Moving Average
{The End Point Moving Average was introduced in the October 95 issue of
Technical Analysis of Stocks & Commodities in the article "The End Point
Moving Average", by Patrick E. Lafferty. The exact formula for the End
Point
Moving average is as follows:}
{The above formula plots the last value of a linear regression line of the
previous 14 periods. The Time Series Forecast (TSF) takes this value and
the
slope of the regression line to forecast the next day and then plots this
forecasted price as today's value. from Equis.}
(Go Top)
Enter 20 Days after MOV Signal
I am trying to use the MetaStock Explorer to find all stocks with the
following:
1. c - mov(c,60,s)<0
2. Above condition should be in place for 20 days/
from wsb
where ... stands for all Ref( x,-i) with i between 2 and 18.
(Go Top)
Equivalent to Wilders TR
Wilders(TR,periods) = Mov(TR,2*periods-1,E)
(Go Top)
Excel Confidence %
This is the calculation:
Take todays 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 *
todays 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.
(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
(Go Top)
Expansion Pivots Buy
A:=Close
B:{Breakout}(H-L)>ATR(9)
C:{Signal}Ref(C,-2)<=Mov(C,50,S) and
Ref(C,-1)>Mov(C,50,S) OR Ref(C,-1)<=Mov(C,50,S) and
C>Mov(C,50,S)
D:{entry}HHV(H,2)+.125
E:{Stop}If(Ref(C,-2)<=Mov(C,50,S) and
Ref(C,-1)>Mov(C,50,S),Ref(C,-1)-1,If(Ref(C,-1)<=Mov(C,50,S)
and C>Mov(C,50,S),C-1,0))
Filter:ColB and ColC
(Go Top)
Expansion Pivots Sell
A:=Close
B:{Breakout}(H-L)>ATR(9)
C:{Signal}Ref(C,-2)>=Mov(C,50,S) and
Ref(C,-1)<Mov(C,50,S) OR Ref(C,-1)>=Mov(C,50,S) and
C<Mov(C,50,S)
D:{entry}LLV(L,2)-.125
E:{Stop}If(Ref(C,-2)>=Mov(C,50,S) and
Ref(C,-1)<Mov(C,50,S),Ref(C,-1)-1,If(Ref(C,-1)>=Mov(C,50,S)
and C<Mov(C,50,S),C-1,0))
Filter:ColB and ColC
(Go Top)
Experimental Williams Trading System
A trading system based on work of Bill Williams
Enter Long:
Cross(C,Fml("chaos green bl")) AND Fml("chaos green bl") > Fml("chaos
blue bl")
Close Long:
Cross(Fml("chaos green bl"),C) AND Fml("chaos blue bl") > Fml("chaos
green bl")
I tested this on several different stocks and it shows potential. I really
haven't spent too much time on it yet so I'm not yet sure of the
significance of the other indicators. The above was just what I could throw
together based upon what my eyes on the chart with the indicators
showed me.
(Go Top)
End Points of a Linear Regression with Standard Deviations
In MetaStock 5.x for Windows there is a way to plot the end points of a
linear regression line
with channels +/- 2 Standard Deviations.
Here are the three formulas:
*Linear Regression (14):
(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)) * Cum(1) + (Mov(C,14,S) - Mov(Cum(1),14,S) *
(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)))
*Linear Regression Lower Band:
Fml( "*Linear Regression (14)" ) - 2* Stdev( Fml( "*Linear Regression
(14)" ) ,14)
*Linear Regression Upper:
Fml( "*Linear Regression (14)" ) + 2* Stdev( Fml( "*Linear Regression (14)"
) ,14)
(Go Top)
EMA
{ Exponential Moving Average v2.2 }{ EMA periodicity shortens on low bar
count }
{ ©Copyright 2003-2004 Jose Silva }{ josesilva22@yahoo.com }
pds:=Input("EMA periods",1,2520,21);
x:=Input("use Open=1 High=2 Low=3 Close=4 WClose=5 P=6",1,6,4);
shift:=Input("EMA vertical shift %", -100,100,0)/100+1;
plot:=Input("[1]EMA, [2]Crossover signals", 1,2,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),If(x=6,P,C)))));
pds:=If(pds>Cum(IsDefined(x)), Cum(IsDefined(x)),pds);
Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
Ema:=Ema*shift;
signals:=Cross(x,Ema)-Cross(Ema,x);
If(plot=2,signals,Ema)
(Go Top)
EMA - ATR volatility adjusted
{ ATR volatility-adjusted, dyn-period EMA v2.1 }
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
ATRvlty:=(ATR(pdsATR)-LLV(ATR(pdsATR),pdsVlty)) /
(HHV(ATR(pdsATR),pdsVlty)-
LLV(ATR(pdsATR),pdsVlty)+.000001);
multi:=If(ATRvlty<=.5,10*Power(ATRvlty,3.4739)+.1,10*Power(ATRvlty,3.3
2)
+.000001);
multi:=If(sens>0,1/multi,multi);
multi:=If(multi<1,1-(1-multi)*Abs(sens),(multi-1)*Abs(sens)+1);
pds:=pds*multi;
pds:=If(pds>Cum(IsDefined(x))-(pdsVlty+pdsATR),Cum(IsDefined(x))-
(pdsVlty+pdsATR),pds);
pds:=If(pds<1,1,pds);
ATREma:=x*2/(pds+1)+PREV*(1-2/(pds+1));
signals:=Cross(x,ATREma)-Cross(ATREma,x);
If(plot=2,pds,If(plot=3,ATRvlty*100,
If(plot=4,signals,ATREma)))
(Go Top)
EMA - BB volatility adjusted
{ Bollinger Band volatility-adjusted, dynamic-period EMA v1.1 }
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
y:=(BBandTop(x,pdsBB,S,2)-BBandBot(x,pdsBB,S,2))/Mov(x,pdsBB,S);
BBvlty:=(y-LLV(y,pdsVlty))/(HHV(y,pdsVlty)-LLV(y,pdsVlty)+.000001);
multi:=If(BBvlty<=.5,10*Power(BBvlty,3.4739)+.1,10*Power(BBvlty,3.32)
+.000001);
multi:=If(sens>0,1/multi,multi);
multi:=If(multi<1,1-(1-multi)*Abs(sens),(multi-1)*Abs(sens)+1);
pds:=pds*multi;
pds:=If(pds>Cum(IsDefined(x))-(pdsVlty+pdsBB),Cum(IsDefined(x))-
(pdsVlty+pdsBB),pds);
pds:=If(pds<1,1,pds);
BBema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
signals:=Cross(x,BBema)-Cross(BBema,x);
If(plot=2,pds,If(plot=3,BBvlty*100,If(plot=4,signals,BBema)))
(Go Top)
EMA, cycle-adaptive
{ Cycle-adaptive Exponential Moving Avg v1.1 }{ EMA periodicity
determined by historical price cycle based on ZigZag cycles }
{ ©Copyright 2004 Jose Silva }{ josesilva22@yahoo.com }
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
zz:=Zig(x,pr,%);
zzpk:=Ref(zz,-1)>zz AND Ref(zz,-1)>Ref(zz,-2);
zztr:=Ref(zz,-1)<zz AND Ref(zz,-1)<Ref(zz,-2);
PkTr:=zzpk OR zztr;CycleLen:=PkTr*(Ref(BarsSince(PkTr),-1)+1);
CycleCount:=Cum(PkTr)-1;
CycleCount:=If(CycleCount=0,.000001,CycleCount);
CycleLenAvg:=Cum(CycleLen)/CycleCount;
pds:=If(choose=1,ValueWhen(1,CycleLen>0 AND
CycleCount>0,CycleLen),CycleLenAvg)*multi;
Init:=CycleCount=1 AND Alert(CycleCount<1,2);
pds:=
If(pds>BarsSince(Init),BarsSince(Init),pds);
pds:=If(pds<1,1,pds);
Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
Ema:=Ema*shift;
signals:=Cross(x,Ema)-Cross(Ema,x);
If(plot=1,Ema,If(plot=2,signals,
If(plot=3,CycleLen,
If(plot=4,CycleLenAvg,
If(plot=5,Stdev(CycleLen,21),pds)))))
(Go Top)
EMA - %PriceChange-filtered
{ Filtered Exponential Moving Average v1.1 }{ EMA ignores prices outside
min/max % zone }{ EMA periodicity shortens on low bar count }
{ ©Copyright 2004 Jose Silva }{ josesilva22@yahoo.com }
{ User inputs }
pds:=Input("EMA periods",1,2520,21);
minCh:=Input("Minimum % price change", 0,100,2)/100;
maxCh:=Input("Maximum % price change", 0,100,5)/100;
x:=Input("use Open=1 High=2 Low=3 Close=4 WClose=5 P=6",1,6,4);
shift:=Input("EMA vertical shift %", -100,100,0)/100+1;
plot:=Input("[1]EMA, [2]Crossover signals", 1,2,1);
{ Price filter }
change:=Abs(x/Ref(x,-1)-1);
filter:=change>=minCh AND change<=maxCh;
x:=ValueWhen(1,filter,x);
{ EMA formula }
Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
{ EMA shift }
Ema:=Ema*shift;
pds:=Input("EMA periods",1,2520,21)/2;
plot:=Input("EMA: [1]Composite, [2]Upper/Lower, [3]Long/Short",1,3,1);
spread:=Input("Upper/Lower EMA bands shift %", 0,100,2)/200;
x:=Input("use: [1]Close, [2]High/Low, [3]P", 1,3,1);
xpk:=If(x=1,C,If(x=2,H,P));
pk:=xpk<Ref(xpk,-1) AND Ref(xpk,-1)>Ref(xpk,-2);
pkVal:=ValueWhen(1,pk,Ref(xpk,-1));
xtr:=If(x=1,C,If(x=2,L,P));
tr:=xtr>Ref(xtr,-1) AND Ref(xtr,-1)<Ref(xtr,-2);
trVal:=ValueWhen(1,tr,Ref(xtr,-1));
pkpds:=If(pds>Cum(pk),Cum(pk),pds);
pkpds:=If(pkpds<1,1,pkpds);
pkEma:=pkVal*2/(pkpds+1)+PREV*(1-2/(pkpds+1));
pkEma:=pkEma*(1+spread);
trpds:=If(pds>Cum(tr),Cum(tr),pds);
trpds:=If(trpds<1,1,trpds);
trEma:=trVal*2/(trpds+1)+PREV*(1-2/(trpds+1));
trEma:=trEma*(1-spread);
Ema:=(pkEma+trEma)/2;
LngShtEma:=If(C>=Ema,trEma,pkEma);
If(plot=1,Ema,If(plot=2,trEma,LngShtEma));
If(plot=1,Ema,If(plot=2,pkEma,LngShtEma))
(Go Top)
EMA - RSI volatility adjusted
{RSI-volatility adjusted, dynamic-period EMA v2}{ Tightens EMA on RSI
over-bought/sold levels, increases EMA periods on low RSI volatility }
{ ©Copyright 2003-2004 Jose Silva }{ josesilva22@yahoo.com }
pds:=Input("EMA periods",1,2520,21);
pdsRs:=Input("RSI periods",2,252,21);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
shift:= 1+Input("vertical shift %",-100,100,0)/100;
plot:=Input("EMA=1, dyn EMA pds=2, RSI volatility=3, signals=4",1,4,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
RSvoltl:=Abs(RSI({x,}pdsRs)-50)+1;
multi:=(5+100/pdsRs) /(.06+.92*RSvoltl+.02*Power(RSvoltl,2));
pds:=pds*multi;
pds:=If(pds>Cum(IsDefined(x))-pdsRS, Cum(IsDefined(x))-pdsRS,pds);
pds:=If(pds<1,1,pds);
RsVEma:=x*2/(pds+1)+PREV*(1-2/(pds+1));
signals:=Cross(x,RsVEma)-Cross(RsVEma,x);
If(plot=2,pds,If(plot=3,(RSvoltl-1)*2, If(plot=4,signals,RsVEma*shift)))
(Go Top)
EMA - slope %
{ EMA slope % v2.0, +/- 0~100% }{ ©Copyright 2003 Jose Silva }
{ josesilva22@yahoo.com }
pds:=Input("EMA periods",2,2520,21);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
EMA:=Mov(x,pds,E);
EMAprev:=Ref(EMA,-1);
y:=Min(EMA,EMAprev)/Max(EMA,EMAprev);
EMAratio:=(If(EMA>EMAprev,2-y,y)-1)*100;
EMAper:=If(EMAratio<0,Atan(EMAratio,1)-360, Atan(EMAratio,1))*10/9;
signal:=Mov(EMAper,pds,E);
0;signal;EMAper
(Go Top)
EMA - Volatility adjusted
{ Volatility-adjusted, dynamic-period EMA v2.4 }{ EMA periodicity shortens
on high volatility, increases on low volatility }{ ©Copyright 2003-2004
Jose Silva }{ josesilva22@yahoo.com }
pds:=Input("EMA periods",1,2520,21);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
shift:=1+Input("EMA vertical shift %", -100,100,0)/100;
plot:=Input("EMA=1, Volatility=2, Dyn EMA pds=3, Crossovers=4",1,4,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
Vt:=Stdev(x,5)/Mov(Stdev(x,5),10,S);
pds:=pds*.75/(Vt+.1);
pds:=If(pds>Cum(IsDefined(x))-13, Cum(IsDefined(x))-13,pds);
pds:=If(pds<1,1,pds);
VtEma:=x*2/(pds+1)+PREV*(1-2/(pds+1));
VtEma:=VtEma*shift;
signals:=Cross(x,VtEma)-Cross(VtEma,x);
If(plot=2,Vt*10,If(plot=3,pds, If(plot=4,signals,VtEma)))
(Go Top)
EMA - Volume adjusted
{ Volume adjusted, dynamic-period EMA v2.3 }{ EMA periodicity shortens
on high volume, increases on low volume }{ ©Copyright 2003-2004 Jose
Silva }
{ josesilva22@yahoo.com }
pds:=Input("EMA periods",1,2520,21);
VAvgPds:=Input("Volume sample periods",2,252,21);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
shift:=1+Input("EMA vertical shift %", -100,100,0)/100;
plot:=Input("EMA=1, Dyn EMA pds=2, Vol avg=3, Crossovers=4",1,4,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
MovVol:=Mov(V,VAvgPds,E);
VolRatio:=Min(V,MovVol)/Max(V,MovVol);
VolAvg:=If(V>MovVol,2-VolRatio,VolRatio);
multi:=.75/(.1+.32*VolAvg+.58*Power(VolAvg,4));
pds:=pds*multi;
pds:=If(pds>Cum(IsDefined(x))-VAvgPds, Cum(IsDefined(x))-VAvgPds,pds);
pds:=If(pds<1,1,pds);
VlEma:=x*2/(pds+1)+PREV*(1-2/(pds+1));
VlEma:=VlEma*shift;
signals:=Cross(x,VlEma)-Cross(VlEma,x);
If(plot=2,pds,If(plot=3,VolAvg*50, If(plot=4,signals,VlEma)))
(Go Top)
EMA Close - weekly
{ True weekly Close Exponential Mov Avg v4.0 }{ Plot on Daily or Weekly
charts }{ References indicator "Calendar Week counter" }{ Plot is
independent of any missing chart data }{ ©Copyright 2003-2004 Jose
Silva }{ josesilva22@yahoo.com }
If(plot=2,signals,WkEma)
(Go Top)
EMA - triple crossover signals
{ Triggers Long (+1) & Short (-1) signals at crossover of triple EMAs within
x periods }{ josesilva22@yahoo.com }
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
goLong:=
Alert(Cross(Mov(x,short,E),
Mov(x,medium,E)),pdsLong)
AND
Alert(Cross(Mov(x,medium,E),
Mov(x,long,E)),pdsLong);
goShort:=
Alert(Cross(Mov(x,medium,E),
Mov(x,short,E)),pdsShort)
AND
Alert(Cross(Mov(x,long,E),
Mov(x,medium,E)),pdsShort);
goLong-goShort
(Go Top)
Elder's AutoEnvelope - provided by www.metastocktools.com
{Dr A. Elder's AutoEnvelope interpretation v1.0 coded by
metastocktools.com}
{ User inputs }
pds:=Input("EMA periods",1,252,21);
pdsBak:=Input("lookback periods",1,252,42);
x:=Input("use: Open=1, High=2, Low=3, Close=4, WClose=5",1,5,4);
plot:=Input("[1]AutoEnvelope, [2]Long signals, [3]All signals",1,3,1);
delay:=Input("Entry/Exit signals delay",0,5,0);
{ Price field }
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),C))));
{ Envelope bands }
Avg:=Mov(x,pds,E);
hiAvg:=HHV(H,pdsBak);
loAvg:=LLV(L,pdsBak);
shift:=
Mov(If(hiAvg>Avg,hiAvg-Avg,Avg-loAvg),pds,E);
UpperBand:=Avg+shift;
LowerBand:=Avg-shift;
{ Envelope signals }
In:=Cross(x,LowerBand);
Out:=Cross(x,UpperBand);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=BarsSince(Init OR In)
<BarsSince(Init OR Out)+InInit;
signals:=Ref((InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
{ Variables user-input }
pdsNoEntry:=Input("No entry x periods from last exit",0,21,5);
pdsW:=Input("Weekly EMA periods",1,520,13)*5;
pdsD:=Input("Daily EMA periods",1,252,13);
pdsShort:=Input("Shorter MACD periods",
1,252,12);
pdsLong:=Input("Longer MACD periods",2,2520,26);
pdsSignal:=Input("MACD trigger signal periods",
2,252,9);
tradeDelay:=0;
{ Indicators }
EmaW:=Mov(C,pdsW,E);
EmaD:=Mov(C,pdsD,E);
Mac:=Mov(C,pdsShort,E)-Mov(C,pdsLong,E);
MacTrig:=Mov(Mac,pdsSignal,E);
Hist:=Mac-MacTrig;
{ System logic }
Out:={EmaW<Ref(EmaW,-1)
AND }EmaD<Ref(EmaD,-1)
AND Hist<Ref(Hist,-1);
In1:=EmaW>Ref(EmaW,-1)
AND EmaD>Ref(EmaD,-1)
AND Hist>Ref(Hist,-1);
In:=In1 AND BarsSince(Out)>pdsNoEntry;
{ System signals }
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=Ref(BarsSince(Init OR In)
<BarsSince(Init OR Out)+InInit,-tradeDelay);
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));
{ Plot }
0;signals
(Go Top)
Exploration for highest percentage rise in share prices, stocks traded for
any length of time
{ ©Copyright 2001 Jose Silva }
Column A: +% incrs
TtlDays:=LastValue(Cum(1));
FirstDay:=If(TtlDays>252,TtlDays-252,1);
FirstCl:=ValueWhen(1,Cum(1)=FirstDay,C);
Int((C/FirstCl-1)*10000)/100
Column B: today
Close
TtlDays:=LastValue(Cum(1));
FirstDay:=If(TtlDays>252,TtlDays-252,1);
ValueWhen(1,Cum(1)=FirstDay,C)
Column D: $ t/over
Int(WC()*V)
Column E: months
Int(LastValue(Cum(1)/21))
Column F: weeks
Int((LastValue(Cum(1))
-Int(LastValue(Cum(1)/21))*21)/5)
Filter:
colA > 0
AND colD > 10000
FibboGatto
FG1:
((c+ref(c,-1)+ref(c,-2)+ref(c,-3)+ref(c,-5)+ref(c,-8)+ref(c,-13)+ref(c,-
21)+ref(c,-34)+
ref(c,-55)+ref(c,-89)+ref(c,-144))/c)*-1
FG2:
mov(((c+ref(c,-1)+ref(c,-2)+ref(c,-3)+ref(c,-5)+ref(c,-8)+ref(c,-13)+ref(c,-
21)+
ref(c,-34)+ref(c,-55)+ref(c,-89)+ref(c,-144))/c)*-1,34,e)
Mc1:=BarsSince(DayOfWeek()=1);
Fc1:=BarsSince(DayOfWeek()=5);
Fc2:=Ref(BarsSince(DayOfWeek()=5),-1)-1;
{Fixed Balance Point Calculation}
FBC:=If(Mc1=0 AND Fc1>2,
{then}(Ref(HHV(H,LastValue(mc1)),-1)+
Ref(LLV(L,LastValue(Mc1)),-1)+
Ref(C,-1))/3,
{else}If(Fc1=0 AND Mc1>5,
{then}(HHV(H,LastValue(Fc2))+
LLV(L,LastValue(Fc2))+C)/3,
{else}If(Fc1=0,
{then}(HHV(H,LastValue(Mc1))+
LLV(L,LastValue(Mc1))+C)/3,
{else}0)));
{Fixed Balance Point Plot}
FBP:=ValueWhen(1,FBC>0,FBC);
FBP;
(Go Top)
Fibonacci Trader- Fixed Balance Point Step
FPS:=(ValueWhen(1,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")) +
ValueWhen(2,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")) +
ValueWhen(3,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")) +
ValueWhen(4,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")) +
ValueWhen(5,FmlVar("FT-FBP","FBC")>0,
FmlVar("FT-FBP","FBC")))/5;
FPS
(Go Top)
Fibonacci Trader- Support and Resistance
{NOTE: under Color/Style options, change
plot to last "style" option}
where........
Fml ( "Downtrend" ) =
and......
Fml ( "Uptrend" ) =
Here are some initial thoughts. Perhaps you can help me to arrive at some
kind of "hierarchy" of trendiness, or call it a classification, or a taxonomy,
consisting of both direction and strength. For convenience, I'll describe
only long trades.
IV. Somewhere between II. and III. the ADX(13/14) usually starts rising.
From what I've seen, a rising ADX at any level generally means business:
ADX(13) > Ref(ADX(13),-1)
V. Very strong trend: (this is where Linda Bradford's "Holy Grail" and such
kick in)
ADX(13) > Ref(ADX(13) and
ADX(13) > 30
Almost forgot . . . very little direction (but don't fall asleep at the wheel):
ADX(13) < say, 12-15 and has been bumbling along down there for a while
(hard to quantify for me to date)
(Go Top)
Forecast Oscillator
Many moons ago, I posted a little linear regression system that featured
the Forecast Oscillator. The response was surprising (lots of it) and today, I
still communicate with many of the original respondents. I've continued to
use the same "framework" for my testing. In an earlier post today (a
private email that made it to the list...I'm a little dingy tonight...had to get
up a 5 am to trade cocoa), I alluded to using the CMO. I've used many
indicators in these tests (i.e., Forecast Oscillator, a modified Time Series
Forecast, MACD Histogram, Bollinger Band Histogram, CMO, & others).
Enter Long:
Cross(opt1,ForecastOsc(CLOSE,opt3))
Close Long:
Cross(ForecastOsc(CLOSE,opt3),opt2)
Enter Short:
Cross(ForecastOsc(CLOSE,opt3),opt2)
Close Short:
Cross(opt1,ForecastOsc(CLOSE,opt3))
You can substitute any standard formula for the ForecastOsc or you can
put in a custom formula (just remember that custom formulae need to
look like:
fml("Karnack's SuperSecret") It's in your manual.
2. opt3:
In this search "opt3" represents the number of days inserted into the
forecast oscillator. I usually use three (3) to ten (10) for the forecast
oscillator, but if I'm using a custom formula, sometimes I don't even need
opt3, because I using a fixed set of parameters within the custom formula.
3. opt1:
Opt1 is the numeric value below a zero basis line that will trigger a long
position and close out the short. Yes Virginia, in my secular little world, I
prefer stop and reverse trading. The parameters for this option depends
on the commodity (and yes, it does work on stocks) you're trading. One
must eyeball the forecast oscillator to see how far it swings above and
below zero. For the forecast oscillator, I usually use 0 to -3.
4. opt2:
Opt2 is the numeric value above a zero basis line that will trigger a short
sale. Zero to 3 seems to work for this formula.
5. Steps:
I step opt3 using whole numbers to represent days. With Opt1 and Opt2, I
use: .1 steps.
6. Other indicators:
When substituting the CMO (or any indicator) for the Forecast Oscillator,
one must be aware of the terrain the indicator travels over. It would be
ridiculous to us zero to 3 (as the optimizing numbers) if the mid point is 50
and the indicator traverses between +10 (on the downside) and +90 (on
the upside).
The overall theory behind this test is that many indicator oscillate from
positive to negative and back again (duh). The trick is not to trigger action
when the indicator turns in a new direction (if you're interested, I've been
down that road and I'm still wearing a neck brace from the whiplash). The
theory is that once an indicator extends to a certain level, the market is
either overbought or oversold.
In downtrending markets (can you spell deflation?), the short sale trigger
(opt2) is going to be closer to the zero basis line than opt1. Please see the
attachment. What will happen when the grains, cocoa, crude, and damn
near everything else starts to go up? Good question Steve! The system
will not perform as well if you continue to use the same parameters. In a
perfectly sideways market, one would assume that the trigger points
would be equal distance from zero. As in many markets, this system works
better when things trend indefinitely.
I hope this post will help others who have inquired about the linear
regression system. Attached is the original system, using the Forecast
Oscillator, for March Crude Oil. In this example, opt3 is set to 8 (number of
days in the forecast oscillator); opt2 is .1 (sell signal); opt1 is -2.3 (buy
signal).
To quote R.N. Elliot: "Even though we many not understand the cause
underlying a particular phenomenon, we can, by observation, predict the
phenomenon's recurrence."
To qoute Karnack (my alter ego): "I got knocked down seven times and got
up eight".
Exit long:
Cross(Mov(C,3,E),ForecastOsc(C,21)) AND
Cross(6,Mov(C,3,E))
(Go Top)
Forecast Oscillator System Alternative
Enter long:
Cross(ForecastOsc(C,21),Mov(ForecastOsc(C,21),3,E)) AND
Cross(ForecastOsc(C,21),0)
Exit long:
Cross(Mov(ForecastOsc(C,21),3,E),ForecastOsc(C,21)) AND
Cross(6,ForecastOsc(C,21))
{You can use alert() function on either if you don't require both conditions
to fire on the same day.}
(Go Top)
Front Weighted 36 Day Moving Average
This indicator requires 3 sub calculations and then the totalling of all 3 to
get the final indicator:
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.
Fml( "1FrontWeighted36BarMA1" ) +
Fml( "2FrontWeighted36BarMA2" ) +
Fml( "3FrontWeighted36BarMA3" )
100 - 100/
(1.+ If(Mov(If(P-Ref(P,-1)<0,-(P-Ref(P,-1)),0),23,E)=0,1000000,
To keep the GMI data updated, it is only available from Barrons magazine
and must be manually input. The Handy & Harman data must also be
manually updated. This may be obtained from the Wall Street Journal as
well.
(Go Top)
From Terms to Technical Tools
In Walter Downs’ article "From Terms To Technical Tools" he introduces the
Point of Balance Oscillator, two conditions to colour bars and two system
tests. All of these can be created quite easily in MetaStock 6.5. To create
the Point of Balance Oscillator, choose Indicator Builder from the Tools
menu, click on the New button, and enter the following formula:
Point of Balance Oscillator
n := Input("Time Periods",1,100,12)/2;
POBC1 := (HHV(CLOSE, n) + LLV(CLOSE,n))/2;
POBC2 := (HHV(POBC1, n) + LLV(POBC1,n))/2;
POBC3 := (HHV(POBC2, n) + LLV(POBC2,n))/2;
POBC4 := (HHV(POBC3, n) + LLV(POBC3,n))/2;
POBC5 := (HHV(POBC4, n) + LLV(POBC4,n))/2;
POBC6 := (HHV(POBC5, n) + LLV(POBC5,n))/2;
POBC7 := (HHV(POBC6, n) + LLV(POBC6,n))/2;
POBC8 := (HHV(POBC7, n) + LLV(POBC7,n))/2;
POBC9 := (HHV(POBC8, n) + LLV(POBC8,n))/2;
POBC10 := (HHV(POBC9, n) + LLV(POBC9,n))/2;
AV := (POBC1 + POBC2 + POBC3 + POBC4 + POBC5 + POBC6 + POBC7 +
POBC8 + POBC9 + POBC10) / 10;
POBCOsc := 100 * ((CLOSE - AV) / (HHV(CLOSE, 10)-LLV(CLOSE, 10)));
POBCOsc
To highlight bars based on the Bull Fear and Bear Fear conditions
discussed in the article, choose Expert Advisor from the Tools menu, click
on the New button and enter the following expert:
After entering the systems click on the Options button in the System
Tester dialog, go to the Testing tab and change the Trade Price to Open
and set the Trade delay to one.
Following is the formula for the moving averages discussed in the article,
but not contained in the Traders Tip published in TASC. Please note, this
formula will plot all three moving averages, but will not plot them in three
different colours.
Moving Averages Formula for MetaStock
TP:=Input("Time Periods",1,100,12);
BLF:=((HHV(H,TP)+LLV(H,TP))/2);
BRF:=((HHV(L,TP)+LLV(L,TP))/2);
POB:=((BLF-BRF)/2)+BRF;
BLF;
BRF;
POB
Gain By %
Col A: CLOSE
Col B: ROC(C,5,%)
HLd:=If(CLOSE>Ref(Mov(H,3,S),-1),
{then}1,
{else}If(CLOSE<Ref(Mov(L,3,S),-1),
{then}-1,
{else}0));
HLv:=ValueWhen(1,HLd<>0,HLd);
HiLo:=If(HLv=-1,
{then}Mov(H,3,S),
{else}Mov(L,3,S));
HiLo;
(Go Top)
Gann Hi-Lo
colA
BUY
BarsSince(C< Fml("GANN-HiLo"))
colB
SELL
BarsSince(C> Fml("GANN-HiLo"))
filter
colA=1 OR colB=1
(Go Top)
Gann-Swing
{Market swing is defined as:
Up = 2 higher highs,
Down = 2 lower highs.}
Us:=BarsSince((H > Ref(H,-1)) AND (Ref(H,-1) >
Ref(H,-2)));
Ds:=BarsSince((L < Ref(L,-1)) AND (Ref(L,-1) <
Ref(L,-2)));
Sd1:=If(Us=0,
{then}If(Ref(L,-1)<>LowestSince(1,Ds=0,L),
{then}1,
{else}0),
{else}If(Ds=0,
{then}If(Ref(H,-1)<>
HighestSince(1,Us=0,H),
{then}-1,
{else}0),
{else}0));
Sd2:=If(Sd1=1,
{then} If(Ref(BarsSince(Sd1=1),-1) >
Ref(BarsSince(Sd1=-1),-1),
{then}1,
{else}0),
{else} If(Sd1=-1,
{then}If(Ref(BarsSince(Sd1=1),-1) <
Ref(BarsSince(Sd1=-1),-1),
{then}-1,
{else}0),
{else}0));
TD1:=ValueWhen(1,Sd2<>0,Sd2);
Td1;
(Go Top)
Gann Swing Update
This is an update to Gann-Swing indicators I had posted several months
back. Most of the code has been improved and I have modified the swing
definition slightly.
{SELL}
H<Ref(L,-1) OR
Cum(1)=LastValue(Cum(1))
(Go Top)
Gap 2 System
{BUY}
N1:=5;
L>Ref(HHV(H,N1),-1) OR
Cum(1)=LastValue(Cum(1))
{SELL}
N1:=5;
H<Ref(LLV(L,N1),-1) OR
Cum(1)=LastValue(Cum(1))
(Go Top)
Gap 3 System
{Enter Long}
N1:=5;
L>Ref(HHV(H,N1),-1) OR
Cum(1)=LastValue(Cum(1))
{Exit Long}
N2:=3;
C<Ref(LLV(L,N2),-1) OR
Cum(1)=LastValue(Cum(1))
{Enter Short}
N1:=5;
H<Ref(LLV(L,N1),-1) OR
Cum(1)=LastValue(Cum(1))
{Exit Short}
N2:=3;
C>Ref(HHV(H,N2),-1) OR
Cum(1)=LastValue(Cum(1))
(Go Top)
Gap Days
Shows stocks which have gapped up or down on the open compared to
yesterdays price. The search returns 1 for Ok and 0 for not ok.
• GapUp()
(Go Top)
Gap Trading
Here is the gap-trading system code for use in Equis International's
MetaStock software. For practical reasons, the system has been defined as
an indicator rather than a system, showing the cumulated profit.
dn:= 1.0;
up:= 1.0;
gap:= 100*(OPEN - Ref(CLOSE, -1))/Ref(CLOSE, -1);
prf:= If(gap>=up, OPEN-CLOSE, If(gap<=-dn, CLOSE-OPEN,0));
Cum(prf);
(Go Top)
Gap Up Formulas
The MetaStock formulas to calculate these percentages are shown below.
The
first input is the minimum gap (e.g., 1%), and the second input is the gap
increment (e.g., 1%, which would give you a range of 1-2%). To calculate
gaps down, change the percentage to a negative.
{ Gap percentage }
Gap := (OPEN - Ref(CLOSE,-1))/Ref(CLOSE,-1)*100;
Formula to determine whether the daily range crosses the previous day’s
close on a gap day:
{ Gap percentage }
Gap := (OPEN - Ref(CLOSE,-1))/Ref(CLOSE,-1)*100;
Formula to determine whether the following day’s open continues the gap
trend:
Close long
Ref(GapUp(),-5)
Ref(C,-1)
Ref(C,-2)
Try MMA (Multiple Moving Averages). The shorter ones are closer to the
action and the longer ones tell you about the trend. I use two indicators
like this:
In the current market I like taking short momentum trades where the MMA
Short is bouncing up off a slowly rising MMA Long Term. The exit at the top
of the bubble is indicated by MMA Short turning down after a good
separation
from the underlying MMA Long.
When testing futures in MetaStock it’s best to use a "points only" test. To
do this, choose Options from the System Tester dialog and then Points
Only Test from the Testing page.
To use The Explorer to screen for futures generating a recent signal with
this system, choose The Explorer from the Tools dialog and enter in the
following rules:
Column Formulas
Column A: Buy Sign
Cross( Mov( Close,9,S), Mov( Close,50,S)) And Close > Mov( Close,80,S)
Column B: Shrt Sig
Cross( Mov( Close,50,S), Mov( Close,9,S)) And Close < Mov( Close,80,S)
Filter Source
Filter Enabled: Yes
Formula: colA = 1 OR colB = 1
Next choose Explore and The Explorer will search for and then display any
futures, which have generated new signals.
Higher Closes
Shows stocks which have closed higher on successive days.
• CLOSE
• CLOSE -1
• CLOSE -2
• **When(colA,>,colB) AND When(colB,>,colC)
(Go Top)
Higher Volume Exploration
Required: today's volume to be greater than the highest high over the past
21 days.
V>Ref(HHV(V,21),-1)
(Go Top)
Highest High Since Buy Signal
Anyone know how to keep track of, for example, the highest high since a
buy signal was triggered? I want to add this into a system test that I am
trying to run.
A few weeks ago when the Chandelier Exit was posted to on our board
board, I
asked if there was a faster version of it. On my (slowpoke) 200 Mhz PC at
home, it took about 1 to 2 minutes to calculate the formula on a single
stock.
Anyway, I did not hear of any feasible solutions. Last night, upon reading
about the 25X25 system on this site , it struck me that the original
Chandelier Exit (see below) had a whole bunch of PREV statements in it.
I'm
sure everyone knows where I'm going with this by now.
Anyway, here is how the code (at least this iteration) should be modified
to
speed up the calculation by a factor of 5. Basically, we move PREV into a
variable vPREV prior to using it (so that it is only calculate once) in the
long and short exits. Here is the code for the long exit. I tested it with
the sample Entry Rule and receive the same results in 1/5th the time. Just
modify the SHORT exit in the same way. Hope this helps everyone using it.
{DEFINE ENTRY PRICE, WITH EXIT BEING -- ENTRY PRICE AND NO TRADE
BEING 0}
{Move PREV into a variable to speed things up - DB 2/17/00}
vPREV:=PREV;
EntryPrice:= If(vPREV <= 0,
{Trade entered today?}
If(LongEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(LOW <= vPREV - MoneyMgmtStop, -vPREV,
If(LOW <= HighestSince(1,vPREV=0, HIGH) - 3 * ATR(10), -vPREV,
If(LOW <= HighestSince(1,vPREV=0, CLOSE) - 2.5 * ATR(10), -vPREV,
vPREV))));
(Go Top)
Instantaneous Trendline & Sinewave Indicator as described by John Ehlers
Here is the MetaStock 6.52 or higher formula code for the Instantaneous
Trendline and Sinewave Indicator as described by John Ehlers in his article
“At Last! A Trend-Friendly Oscillator”. To implement them the following
formulas must be created in MetaStock’s Indicator Builder. Each formula
must be created separately and must be named exactly as it appears
below. Only the last two formulas are plotted, so you may wish to prevent
the others from being displayed in the Indicator QuickList by unchecking
the “Display In QuickList” option when creating the formula.
Use the following instructions to Import the MS65FORM.DTA file from the
temp file it was downloaded to.
1. Run MetaStock.
pr:=(H+L)/2;
(Cos(0)*pr)+
(Cos(360*(1/pd))*Ref(pr,-1))+
(Cos(360*(2/pd))*Ref(pr,-2))+
(Cos(360*(3/pd))*Ref(pr,-3))+
(Cos(360*(4/pd))*Ref(pr,-4))+
(Cos(360*(5/pd))*Ref(pr,-5))+
If(pd>14, Cos(360*(14/pd))*Ref(pr,-14), 0)
Name: H ip sum 2
pr:=(H+L)/2;
If(pd>24, Cos(360*(24/pd))*Ref(pr,-24), 0)
Name: H ip sum 3
pr:=(H+L)/2;
If(pd>34, Cos(360*(34/pd))*Ref(pr,-34), 0)
Name: H rp sum 1
pr:=(H+L)/2;
(Sin(0)*pr)+
(Sin(360*(1/pd))*Ref(pr,-1))+
(Sin(360*(2/pd))*Ref(pr,-2))+
(Sin(360*(3/pd))*Ref(pr,-3))+
(Sin(360*(4/pd))*Ref(pr,-4))+
(Sin(360*(5/pd))*Ref(pr,-5))+
If(pd>14, Sin(360*(14/pd))*Ref(pr,-14), 0)
Name: H rp sum 2
pr:=(H+L)/2;
If(pd>24, Sin(360*(24/pd))*Ref(pr,-24), 0)
Name: H rp sum 3
pd:=Int(Fml("Hilbert cycle period - final-a"));
pr:=(H+L)/2;
If(pd>34, Sin(360*(34/pd))*Ref(pr,-34), 0)
Name: H TL sum 1
If(value=6, Mov((H+L)/2,8,S),0) +
If(value=7, Mov((H+L)/2,9,S),0) +
If(value=8, Mov((H+L)/2,10,S),0) +
If(value=9, Mov((H+L)/2,11,S),0) +
If(value=10, Mov((H+L)/2,12,S),0) +
If(value=11, Mov((H+L)/2,13,S),0) +
If(value=12, Mov((H+L)/2,14,S),0) +
If(value=13, Mov((H+L)/2,15,S),0) +
If(value=14, Mov((H+L)/2,16,S),0) +
If(value=15, Mov((H+L)/2,17,S),0)
Name: H TL sum 2
value:=Int(Fml("Hilbert cycle period - final-a"));
If(value=16, Mov((H+L)/2,18,S),0) +
If(value=17, Mov((H+L)/2,19,S),0) +
If(value=18, Mov((H+L)/2,20,S),0) +
If(value=19, Mov((H+L)/2,21,S),0) +
If(value=20, Mov((H+L)/2,22,S),0) +
If(value=21, Mov((H+L)/2,23,S),0) +
If(value=22, Mov((H+L)/2,24,S),0) +
If(value=23, Mov((H+L)/2,25,S),0) +
If(value=24, Mov((H+L)/2,26,S),0) +
If(value=25, Mov((H+L)/2,27,S),0)
Name: H TL sum 3
If(value=26, Mov((H+L)/2,28,S),0) +
If(value=27, Mov((H+L)/2,29,S),0) +
If(value=28, Mov((H+L)/2,30,S),0) +
If(value=29, Mov((H+L)/2,31,S),0) +
If(value=30, Mov((H+L)/2,32,S),0) +
If(value=31, Mov((H+L)/2,33,S),0) +
If(value=32, Mov((H+L)/2,34,S),0) +
If(value=33, Mov((H+L)/2,35,S),0) +
If(value=34, Mov((H+L)/2,36,S),0) +
If(value=35, Mov((H+L)/2,37,S),0)
value1:=((H+L)/2) - Ref(((H+L)/2),-6);
value2:= Ref(value1,-3);
value3:=0.75*(value1-Ref(value1,-6)) + 0.25*(Ref(value1,-2)-Ref(value1,-
4));
p1:=Atan(Abs(quad+Ref(quad,-1)),Abs(inphase+Ref(inphase,-1)));
dp2:=If(dp < 1, 1,
dp2
c1:= Fml( "H cycle count 1a") + Fml( "H cycle count 2a") + Fml( "H cycle
count 3a") ;
c2:=If(c1=0,PREV,c1);
(0.25*c2) + (0.75*PREV)
pr:=(H+L)/2;
Sin(dcp);
Sin(dcp+45)
(Go Top)
INSYNC Index
The interpretation for the following formulas came from the article "The
Insync Index", by Norm North, in Technical Analysis of Stocks &
Commodities Jan 1995.
All of these formulas are necessary for the last one, Insync Index to run
properly. They are listed in the order in which they should be copied and
pasted into the MetaStock Formula Builder
BOLInSLB
Mov( C ,20 ,S ) - 2 * ( Std( C ,20 ) )
BOLInSUB
Mov( C ,20 ,S ) + 2 * ( Std( C ,20 ) )
BOLInS2
( C - Fml( "BOLInSLB" ) ) / ( Fml( "BOLInSUB" ) - Fml( "BOLInSLB" ) )
BOLInSLL
If( Fml( "BOLInS2" ) ,< , .05 ,-5 ,If( Fml( "BOLInS2" ) ,> ,.95 ,5 ,0 ) )
CCIInS
If( CCI(14 ) ,> ,100 ,5 ,If ( CCI(14 ) ,< ,-100 ,-5 ,0 ) )
EMVInS2
EMV(10 ,S ) - Mov( EMV(10 ,S) ,10 ,S )
EMVInSB
If( Fml( "EMVInS2" ) ,< ,0 ,If( Mov( EMV(10 ,S ) ,10 ,S ) ,< ,0 ,-5 ,0 ) ,0 )
EMVInSS
If( Fml( "EMVInS2" ) ,> ,0 ,If( Mov( EMV(10 ,S ) ,10 ,S ) ,> ,0 ,5 ,0 ) ,0 )
MACDInS2
MACD( ) - Mov( MACD( ) ,10 ,S )
MACDinSB
If( Fml( "MACDInS2" ) ,< ,0 ,If( Mov( MACD( ) ,10 ,S ) ,< ,0 ,-5 ,0 ) ,0 )
MACDInSS
If( Fml( "MACDInS2" ) ,> ,0 ,If( Mov( MACD( ) ,10 ,S) ,> ,0 ,5 ,0 ) ,0 )
MFIInS
If( MFI( 20 ) ,> ,80 ,5 , If( MFI( 20 ) ,< ,20 ,-5 ,0 ) )
PDOInS2
DPO( 18 ) - Mov( DPO( 18 ) ,10 ,S )
PDOInSB
If( Fml( "PDOInS2" ) ,< ,0 ,If( Mov( DPO( 18 ) ,10 , S) ,< ,0 ,-5 ,0 ) ,0 )
PDOInSS
If( Fml( "PDOInS2" ) ,> ,0 ,If( Mov( DPO ( 18 ) ,10 ,S) ,> ,0 ,5 ,0 ) ,0 )
ROCInS2
ROC( C ,10 ,$ ) - Mov( ROC( C ,10 ,$ ) ,10 ,S )
ROCInSB
If( Fml( "ROCInS2" ) ,< ,0 ,If( Mov( ROC( C ,10 ,$ ) ,10 ,S ) ,< ,0 ,-5 ,0 ) ,0 )
ROCInSS Index
If( Fml( "ROCInS2" ) ,> ,0 ,If( Mov( ROC( C ,10 ,$ ) ,10 ,S ) ,> ,0 ,5 ,0 ) ,0 )
RSIInS
If( RSI(14 ) ,> ,70 ,5 ,If( RSI(14 ), < ,30 ,-5 ,0 ) )
STO%dInS
If( Stoch(14 ,3 ) ,> ,80 ,5 ,If( Stoch(14 ,3 ) ,< ,20 ,-5 ,0 ) )
STO%kInS
If( Stoch(14 ,1) ,> ,80 ,5 ,If( Stoch(14 ,1 ) ,< ,20 ,-5 ,0 ) )
InSync Index
50 + Fml( "CCIInS" ) + Fml( "BOLInSLL" ) + Fml( "RSIInS" ) + Fml( "STO
%kInS " ) +
Fml( "STO%dInS" ) + Fml( "MFIInS" ) + Fml( "EMVInSB" ) + Fml( "EMVInSS"
)+
Fml( "ROCInSS" ) + Fml( "ROCInSB" ) + Ref (Fml( "PDOInSS" ) ,-10 ) +
Ref (Fml( "PDOInSB" ) ,-10 ) + Fml( "MACDInS S" ) + Fml( "MACDInSB" )
Mr. Millman wrote these formulas using many Custom Formula slots for
clarity and ease of understanding. Please note that the final formula
`InSync Index' requires all of the previous formulas to be correct.
(Go Top)
Investor Preference Index
This indicator was discussed in the December 1997 Technical Analysis of
Stocks & Commodities magazine, page 19. The article was written by Cyril
V. Smith Jr.
"This indicator, a long - term stock market investment tool, compares the
performance of the S&P 500 to the New York Stock Exchange index to
measure sentiment. The theory is that investors have a preference for
certain types of investments, blue chips versus mid-cap, during phases of
a bull market."
To plot this in MetaStock for Windows, follow these instructions. When
complete, if you save this as a chart, you will simply need to load the chart
and it will recalculate using the newest data.
• Open a chart of the S&P 500.
• Open a chart of the New York Stock Exchange index.
• Drag the S&P 500 price plot into the NYSE chart.
• Drop the indicator listed below on the plot of the S&P 500. The
plot will turn a different color when you are pointing at it.
• The resultant plot is the Investor Preference Index.
Formula: Investor Preference Index:
(Sum(Mov(ROC(Log(C),24,%)-ROC(Log(P),24,%),15,S)-
Mov(ROC(Log(C),24,%)-
ROC(Log(P),24,%),38,S),54)+1)*100
System test:
Enter Long
C=HHV(C,26)
Close Long
Fml("Investor Preference Index")<97.6 AND ROC(Fml("Investor Preference
Index"),2,$)<=(-
.04)
Jack Landis' Weighted Stochastic
(shortened to Landis)
((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,8)*.16)+(S
toch(21,5)*.10))
Landis 3 week s m a
mov(((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,8)*.16
)+(Stoch(21,5)*.10)),15,s)
landis multiple time periods
formula #1
mov(((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,8)*.16
)+(Stoch(21,5)*.10)),15,s)
formula #2
mov(((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,8)*.16
)+(Stoch(21,5)*.10)),10,s)
formula #3
mov(((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,8)*.16
)+(Stoch(21,5)*.10)),5,s)
formula #4
mov(((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,8)*.16
)+(Stoch(21,5)*.10)),2,s)
multiple slopes of landis
formula #1
slope(mov(((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,
8)*.16)+(Stoch(21,5)*.10)),15,s),2)
formula #2
slope(mov(((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,
8)*.16)+(Stoch(21,5)*.10)),10,s),2)
formula #3
slope(mov(((Stoch(8,3)*.05)+(Stoch(89,21)*.43)+(Stoch(55,13)*.26)+
(Stoch(34,
8)*.16)+(Stoch(21,5)*.10)),5,s),2)
(Go Top)
Jeff Cooper 180's Buy
A:Close
B:{MA}Ref(C,-1)<Mov(C,10,S) AND Ref(C,-1)<Mov(C,50,S)
AND C>Mov(c,10,S) AND C>Mov(C,50,S)
C:{Breakout}Ref(C,-1)<=((Ref(H,-1)-Ref(L,-1))*.25)+Ref(L,-1)
AND C>=H-(H-L)*.25
D:{Entry}HHV(H,2)+.125
E:{Stop}HHV(H,2)+.125-1
(Go Top)
Jeff Cooper 180's Sell
A:Close
B:{MA}Ref(C,-1)>Mov(C,10,S) AND Ref(C,-1)>Mov(C,50,S)
AND C<Mov(c,10,S) AND C<Mov(C,50,S)
C:{Breakout}Ref(C,-1)>=((Ref(H,-1)-Ref(L,-1))*.25)+Ref(H,-1)
AND C<=L+((H-L)*.25)
D:{Entry}LLV(L,2)-.125
E:{Stop}LLV(L,2)-.125+1
(Go Top)
Jeff Cooper Lizards Buy
A:close
B:{Signal}O>H-(H-L)*.25 AND C>H-(H-L)*.25 AND
L<Ref(LLV(L,10),-1)
C:{entry}H+.125
D:{Stop}H+1.125
Filter:O>H-(H-L)*.25 AND C>H-(H-L)*.25 AND
L<Ref(LLV(L,10),-1)
(Go Top)
Jeff Cooper Lizards Sell
A:close
B:{Signal}O<L+(H-L)*.25 AND C<L+(H-L)*.25 AND
H>Ref(HHV(H,10),-1)
C:{entry}L-.125
D:{Stop}L-1.125
Filter:O<L+(H-L)*.25 AND C<L+(H-L)*.25 AND
H>Ref(HHV(H,10),-1)
(Go Top)
Jeff Cooper Slingshots Buy
A:Close
B:{Range breakout}Ref(H,-1)>=Ref(HHV(H,40),-1)
AND L<Ref(L,-1)-.125
C:{entry}If(O>Ref(H,-1)+.125,O,0)
D:{Stop}If(If(O>Ref(H,-1)+.125,O,0)=O,Ref(O,-1)-2,0)
Filter:Ref(H,-1)>=Ref(HHV(H,40),-1)
AND L<Ref(L,-1)-.125
(Go Top)
Jeff Cooper Slingshots Sell
A:Close
B:{Range breakout}Ref(L,-1)<=Ref(LLV(L,40),-1)
AND H>Ref(H,-1)+.125
C:{entry}If(O<Ref(L,-1)-.125,O,0)
D:{Stop}If(If(O<Ref(L,-1)-.125,O,0),Ref(O,-1)+2,0)
Filter:Ref(L,-1)<=Ref(LLV(L,40),-1)
AND H>Ref(H,-1)+.125
(Go Top)
Jeff Cooper Whoops Sell
A:close
B:C<Mov(C,10,S) AND C<Mov(C,50,S) AND
O>Ref(C,-1)+.25
C:{Entry}Ref(C,-1)-.125
D:{Stop}Ref(C,-1)-.125+1
Filter:C<Mov(C,10,S) AND C<Mov(C,50,S) AND
O>Ref(C,-1)+.25
A:Close
B:ADX(14){The higher the better}
C: PDI(14)>MDI(14)
D:If(L<Ref(L,-1) and Ref(L,-1)<Ref(L,-2) and
Ref(L,-2)<Ref(L,-3),1,0)
E:{Entry}HHV(H,3)+.125
F:{stop}LLV(L,3)
Filter:ColB>30 and ColC and ColD=1
(Go Top)
Jim's Uptrender
As the name implies this metastock exploration finds stocks with a recent
uptrend.
{Col A } CLOSE
{Col B} V
{Filter} x:=HHV(H,60);
y:=MACD();
C > Ref(x,-1)
AND Ref(C,-1) < Ref(x,-1)
AND H = x
AND y > 0
AND y > Ref(y,-1)
AND C > Mov(C,13,W)
AND C > Mov(C,34,W)
AND V*C > 250000
(Go Top)
John Hunt's Exploration for Metastock
When(C-Mov(C,25,S),>,0) AND
When(Ref(C-Mov(C,25,S),-1),<=,0) AND
When(HHV(Mov(Ref(C-Mov(C,25,S),-1),3,S),19),<=,0) AND
When(C,<,0.8*HHV(C,260))
Here's a "freebie".
BB Histogram:
((C+2*Std(C,20)-Mov(C,20,S))/(4*(Std(C,20)))*100)
Sell the opening days after the BB Histogram penetrates 100 and buy
when it penetrates zero. Add to positions when the BB Histo leaves "above
100" or "below zero" and then "repenetrates" the trigger levels.
I believe this approach has recorded 11 straight S&P winners, with 700+
points. "But Steve, this system must not be working any more because it
is losing the last trade you put on". Right!
Period := Input("Period",1,10000,20);
sc := Abs(RSI(Period)/100 - .5)*2;
Ref(Mov(L,3,S),-1) or Ref(Mov(H,3,S),-1)
(Go Top)
Kurtosis Indicator
The Kurtosis is a market sentiment indicator. The MetaStock formula for
the Kurtosis is as follows:
Mov(Mov(Mo(3)-Ref(Mo(3),-1),66,E),3,S)
The Kurtosis is constructed from three different parts. The Kurtosis, the
Fast Kurtosis(FK), and the Fast/Slow Kurtosis(FSK).
The Kurtosis(K) portion of this calculation is mo(3)-ref(mo(3),-1). Which is
today's Kurtosis - yesterday's Kurtosis.
The Fast Kurtosis(FK) is mov(K,66,E) mov(mo(3)-ref(mo(3),-1,66,E). Which
is the Kurtosis smoothed with a 66 period exponential moving average.
The Fast/Slow Kurtosis(FSK) is the complete formula mov(mov(mo(3)-
ref(mo(3),-1),66,E),3,S). Which is the FK smoothed with 3 period simple
moving average.
**You may want to experiment with different time periods to optimize the
results. For example, to calculate a 4 period Kurtosis, a 50 period FK and a
10 period FSK, use the following formula:
mov(mov(mo(4)-ref(mo(4),-1),50,E),10,S)
(Go Top)
Keltner Channels
Keltner Channels are explained in the book The New Commodity Trading
System and Methods by Perry Kaufman and were first introduced in the
book How To Make Money in Commodities, by Chester W. Keltner. The
syntax for the formulas in MetaStock are:
Formula #1
Name: The 10-Day Moving Average
Formula: MOV( (H+L+C)/3, 10, Simple )
Formula #2
Name: Upper Keltner Band
Formula: MOV((H+L+C)/3,10,S) + MOV((H-L),10,S)
Formula #3
Name: Lower Keltner Band
Formula: MOV((H+L+C)/3,10,S) - MOV((H-L),10,S)
In the System Tester, a BUY or a COVER SHORT Signal would occur when
C > Upper Keltner Band
and a SELL or a SELL SHORT Signal would occur when
C < Lower Keltner Band
** Thus, the system is always either long or short.
rll:=ROC(O,nio-1,%)/(nio-1);
rl:=ROC(O,nio,%)/nio;
rh:=ROC(O,nio+1,%)/(nio+1);
rhh:=ROC(O,nio+2,%)/(nio+2);
{Now, interpolation is done at a point XIO (0<=xio<=1), i.e., between the
points NIO and NIO+1, using a simple interpolation formula weighting with
the _distances_ of the four ROCs from the interpolation point XIO:}
rit:=(rll/(1+xio)+rl/(xio+.0001)+rh/(1-xio)+rhh/(2-xio))/(1/(1+xio)+1/(xio+.
0001)+1/(1-xio)+1/(2-xio));
ro:=LinRegSlope(LinRegSlope(rit,nio),nio);
B.
Note here too that you can then apply the special instructions (mailed in a
previous mail to the List) to have the Linked cells' contents SPLIT UP over
more cells in the spreadsheet(s), so as to enable you to make calculations
in Excel, eg using Excel's cell linking(referencing) and formula
language(the tiny editor) capabilities and/or apply any of the other Excel
program's features.
C.
Note here also that the above applies for MS6.x and Excel8.0(OfficePro97).
D.
To reverse this OLE linkage back into MetaStock , do not forget to create
an empty Inner Window first, prior to creating the Link. In MS click
Window|New Inner Window and then Right-click in this Inner Window and
choose Paste Special|Paste Link (with CSV as file type). See MS-Help or
MS-Manual
or Equis' Customer|Support Website for more detailed instructions.
(Go Top)
Lone Ranger
This is the calculation:
Simple Interpretation:
This is a short term indicator which will show short term divergences
against the market instrument. You can also use it to compare its rate of
change against that of the market.
Extreme lows or highs in the indicator may be a signal of similar instances
in the market, however you would want to define a time period to make
use of this function.
Name: BuyBreak
Formula: HHV(H, LastValue(Fml("LookBack")+Prev-Prev))
Name: BuyExit
Formula: LLV(L, LastValue(Fml("LookBack")/2+Prev-Prev))
Name: SellBreak
Formula: LLV(L, LastValue(Fml("LookBack")+Prev-Prev))
Name: SellExit
Formula: HHV(H, LastValue(Fml("LookBack")/2+Prev-Prev))
Name: BreakWhere
Formula: TopB := Ref(Fml("BuyBreak"), -1);
LowB := Ref(Fml("SellBreak"), -1);
((O+H+L+C)/4 - LowB)*100/(TopB-LowB);
Name: DBS-System
Enter Long: H > Ref(Fml("BuyBreak"), -1)
Close Long: L < Ref(Fml("BuyExit"), -1)
Enter Short: L < Ref(Fml("SellBreak"), -1)
Close Short: H > Ref(Fml("SellExit"), -1)
This is George Pruitt's ("Futures Truth") basic system. It is also the basic
system used as the basis for Thomas Stridsman's year-long series of
articles about system development and tweaking.
(Go Top)
Last Date Exploration
This set of column formulae allows you to either scan the results of a
previous MetaStock exploration or the whole market to view the last
trading date of each code.
To delete all securities that have been non-trading since a user specified
date, you will need to use a program such as StockDelete.
MetaStock Column Formula
{Day} Column A: Dayofmonth()
{Month} Column B: Month()
{Year} Column C: Year()
No filter is required for this formula. Text in {} indicates the column name
(not required)
Download the Last Date Formula for use in your MetaStock software by
clicking here.
(Go Top)
Linear Regression Trendline
{ Linear Regression Trendline Channel v2.0 }{ ©Copyright 2004 Jose
Silva }{ josesilva22@yahoo.com }
EnDay:=Input("end Day",1,31,31);
EnMnth:=Input("end Month",1,12,12);
EnYear:=Input("end Year",1800,2200,2006);
pds:=Input("Linear Regression Trendline periods",2,2520,63);
multi:=Input("Channel Standard Deviations",
0,100,2);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
end:=Year()>EnYear
OR (Year()=EnYear AND (Month()>EnMnth
OR Month()=EnMnth AND DayOfMonth()>=EnDay));
end:=end AND Alert(end=0,2);
end:=If(LastValue(Cum(Ref(end,pds)))=0,
LastValue(Cum(1))=Cum(1),end);
lastValLRI:=LastValue(Highest(
If(end,LinearReg(x,pds),0)));
lastValLRS:=LastValue(Highest(
If(end,LinRegSlope(x,pds),-10000)));
adjust:=LastValue(LastValue(Cum(1))
-Highest(If(end,Cum(1),0)));
countback:=LastValue(Cum(1))-Cum(1)-adjust;
{ rem next line to extend plot to end of chart }
countback:=Ref(Ref(countback,-adjust),adjust);
LR:=lastValLRI-lastValLRS*countback;
restrict:=adjust-(LastValue(Cum(1))-pds);
LRT:=Ref(Ref(LR,-restrict),restrict);
upLR:=LRT+Stdev(LR,pds)*multi;
lwLR:=LRT-Stdev(LR,pds)*multi;
upLR;lwLR;LRT
MACD Additions
{These MetaStock MACD indicator formulas allow user input for
parameters when run}
mp1:=Input("Short MA",1,377,13);
mp2:=Input("Long MA",1,377,34);
Mov(C ,mp1 ,E )- Mov(C ,mp2 ,E )
MACD signal line
mp1:=Input("Short MA",1,377,13);
mp2:=Input("Long MA",1,377,34);
mp3:=Input("Signal MA",1,377,89);
Mov( (Mov(C ,mp1 ,E )- Mov(C ,mp2 ,E )),mp3,E)
Close Long:
Cross(Mov(C,13,E),Mov(C,5,E))
Now you can play with these combinations on both the enter long and
close long side. For example,
keep the same Enter Long but change the Close Long to =
Cross(Mov(C,40,E) ,Mov(C,5,E) )
This will keep you in the trade longer. You may want to enter when the 5
crosses above the 13 and not wait for the 40 OR, you may just want to use
the 5 cross above the 40 and forget about the 13.
(Go Top)
MACD Custom
The Input() Function(MSK-man. p.271-273) cannot be used directly in the
Explorer (MSK-man. p.351). It is reserved to be used in a custom indicator.
However, the custom indicator's default value can be used in an
exploration.
Since you have created a {faulty} custom indicator, than just re-code it.
By referencing the Input() Function using the fml() CALL Function
(MSK-man.p.226-227 and 208-209 and 212), you can still use its {by you
at design time} assigned Default value.
Custom Indicator :
Name: MACDcustom
Formula:
MAprd:=Input( "Periods", 5 {Minimum}, 30 {Maximum}, 14 {Default} );
YourTrig:=Mov( MACD(), MAprd, E );
MACD();
YourTrig
When creating the exploration just click the function button and look
under the Custom Indicators heading for both of the above custom
indicator functions, and "Open" each of them one by one, to paste them
into your column TABs (MSK-man. p.347-348) .
Exploration:
Name: MACD crosses my Trigger
Columns:
Cola:
Name: Close
Formula:
C
Colb:
Name: MACD
Formula:
FML( "MACDcustom , MACD" )
Colc:
Name: MACDTrigger
Formula:
FML( "MACDcustom , YourTrig" )
Filter:
Formula:
Colb > Colc
{or
FML( "MACDcustom , MACD" ) > FML( "MACDcustom , YourTrig" )
}
(Go Top)
MACD Histogram Divergence
This explorer looks for stocks exhibiting extreme divergence from the
MACD Histogram. In his book "Trading for a Living", Alexander Elder
argues that divergence from the MACD Histogram gives the strongest
signals in the whole of technical analysis.
ColA:
md := MACD();
mdhist := md - Mov(md,9,E);
Correl(((Sum(Cum(1)*( mdhist ),100))-(Sum(Cum(1),100)*
Sum(( mdhist ),100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)),((Sum(Cum(1)*C,100))-
(Sum(Cum(1),100)*
Sum(C,100)/100))/((Sum(Power(Cum(1),2),100))-
(Power(Sum(Cum(1),100),2)/100)
),12,0)
Filter Column:
colA and colA <-0.8
The above formula can also be combined with a volatility buy signal and a
volume signal. The following addition is then made.
ColB: The volatility buy signal
H > Ref(C,-1) + 1.8 * Ref( ATR(10),-1)
ColC: Volume 10% above the average of the previous 10 days
V > 1.1 * Ref( Mov(V,10,E),-1)
Filter Column:
colA AND colB AND colC AND colA <-0.80
Initial tests with this system have been encouraging.
(Go Top)
MACD Offset
(MACD()*10 +50) {offset the MACD to 50}
(Go Top)
MACD Tops and Bottoms
QUESTION: As you know, MACD is always bottoming or topping before
crossing its trigger line. However, the MACD signal comes always a bit late
compared to price movement. Is there any way to calculate the MACD first
derivative function to identify MACD tops/bottoms, that could be use by
the Explorer or the System Tester?
ANSWER: One way to do what you want would be using the 'Rate of
Change' function.
For example:
RocPeriods:=1; ROC(MACD(),RocPeriods,$)
or for the MACD histogram you would have
RocPeriods:=1; ROC(MACD() - Mov(MACD(),9,E),RocPeriods,$)
If that is to noisy, you could smooth it a bit with: RocPeriods := 1;
MovAvePeriod :=1; ; Mov(3 * ROC(MACD(),RocPeriods,$) , MovAvePeriod,E)
{the 3 just 'magnifies' the line on the plot but doesn't affect the
calculation} or for the MACD histogram:
RocPeriods := 1; MovAvePeriod :=1; ; Mov(3 * ROC(MACD() -
Mov(MACD(),9,E),RocPeriods,$) , MovAvePeriod,E)
Another way to do what you want would be to look for peaks and troughs
using the 'Peak' and 'Trough' functions. I'm working on code to identify
divergences using this method.
QUESTION: As you know, MACD is always bottoming or topping before
crossing its trigger line. However, the MACD signal comes always a bit late
compared to price movement. Is there any way to calculate the MACD first
derivative function to identify MACD tops/bottoms, that could be use by
the Explorer or the System Tester?
ANSWER: One way to do what you want would be using the 'Rate of
Change' function.
For example:
RocPeriods:=1; ROC(MACD(),RocPeriods,$)
or for the MACD histogram you would have
RocPeriods:=1; ROC(MACD() - Mov(MACD(),9,E),RocPeriods,$)
If that is to noisy, you could smooth it a bit with:
RocPeriods := 1; MovAvePeriod :=1; ; Mov(3 * ROC(MACD(),RocPeriods,$) ,
MovAvePeriod,E) {the 3 just 'magnifies' the line on the plot but doesn't
affect the calculation} or for the MACD histogram: RocPeriods := 1;
MovAvePeriod :=1; ; Mov(3 * ROC(MACD() - Mov(MACD(),9,E),RocPeriods,$)
, MovAvePeriod,E)
Another way to do what you want would be to look for peaks and troughs
using the 'Peak' and 'Trough' functions. I'm working on code to identify
divergences using this method.
(Go Top)
Mark Brown Band2 Study
{Name: %Bands}
Pds:= Input("EMA Periods?",1,1000,21);
Pct:= Input("Percentage Bands?",0.1,10,5);
MA:= Mov(C,Pds,E);
TBnd:= MA*(1+Pct/100);
LBnd:= MA*(1-Pct/100);
MA;TBnd;LBnd;
{Name: %BandsCount}
Pds:= Input("EMA Periods?",1,1000,21);
Pct:= Input("Percentage Bands?",0.1,10,5);
MA:= Mov(C,Pds,E);
TBnd:= MA*(1+Pct/100);
LBnd:= MA*(1-Pct/100);
EXPERT
{Name: %Bands}
Symbols tab.
{Name: %BandUp}
FmlVar("% BandsCount","CNTUP") >= 1
{Graphic: Dot, Small, Green, Above price plot}
Symbols tab.
{Name: %BandDn}
FmlVar("% BandsCount","CNTDN") >= 1
{Graphic: Dot, Small, Magenta, Below price plot}
(Go Top)
Market Pressure - Ultimate
This is the basic calculation:
If toadies close is greater than yesterdays close and toadies volume is
greater than yesterdays volume, write down toadies volume * close,
otherwise, If toadies close is less than yesterdays close and toadies
volume is less than yesterdays volume, write down todays 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.
Mov(CLOSE,19,EXPONENTIAL) - Mov(CLOSE,39,EXPONENTIAL)
(Go Top)
McClellan Summation Index
The McClellan Summation Index is a market breadth indicator developed
by Sherman and Marian McClellan. It is a long-term version of the
McClellan Oscillator and its interpretation is similar to that of the McClellan
Oscillator except that it is more suited to major trend reversals.
For more extensive coverage of the index refer to the book Patterns for
Profit, by Sherman and Marian McClellan.
McClellan suggests the following rules for use with the summation Index:
Look for major bottoms when the Summation Index falls below -1300.
Look for major tops to occur when a divergence with the market occurs
above a Summation Index level of +1600.
{NAME: %Bands}
MA:= Mov(C,Pds,E);
TBnd:= MA*(1+Pct/100);
LBnd:= MA*(1-Pct/100);
MA; TBnd; LBnd;
{NAME: %BandsCount}
TBnd:= FmlVar("%Bands","TBND");
IUp:= (H > TBnd) * Ref((H <= TBnd),-1);
CntUp:= IUp + BarsSince(IUp=1) * (H > TBnd);
LBnd:= FmlVar("%Bands","LBND");
IDn:= (L < LBnd) * Ref((L >= LBnd),-1);
CntDn:= IDn + BarsSince(IDn=1) * (L < LBnd);
CntUp; -CntDn;
EXPERT
{Name: %Bands}
Symbols tab.
{NAME: %BandUp}
FmlVar("%BandsCount","CNTUP") >= 1
Graphic tab: Dot, Small, Green, Above price plot
Symbols tab.
{NAME: %BandDn}
FmlVar("%BandsCount","CNTDN") >= 1
Graphic tab: Dot, Small, Magenta, Below price plot
(Go Top)
Metastock Adjustable Trading Bands
Using the default values used in the formulas, I have found that these
upper and lower bands provide effective risk control while trading. The
upper band can be used as the extreme point to get rid of shorts and vice
versa. In fact, prices tend to remain above both the bands while the
market is in a strong uptrend, and prices remain below the bands in a
downtrend. During short-term range-bound markets, they tend move
between the bands. I have found this idea in Tushar Chande's "New
Technical Trader". Since you have studied ATR so thoroughly, it would be
be very nice if you could comment on them. Can be made into a template
for easier usage.
Upper Band
Prd1:=Input("ATR Period",5,20,5);
Prd2:=Input("Period for Highest High Value",5,20,10);
(HHV(LLV(L,Prd1)+ATR(Prd1),Prd2))
Lower Band
Prd1:=Input("ATR Period",5,20,5);
Prd2:=Input("Period for Lowest Low Value",5,20,10);
(LLV(HHV(H,Prd1)-ATR(Prd1),Prd2))
(Go Top)
Metastock Automatic Trendline Formula
Trough(1,L,10)+
((((Trough(1,L,10)-Trough(2,L,10))
/
(TroughBars(2,L,10)-TroughBars(1,L,10)))
*TroughBars(1,L,10)))
This formula will draw a trendline from the most recent bottom. The L
(low) can be changed to C (close) and the 10 can be changed to a different
percent value. You will also need to change the line style to the last one in
the drop down list.
Mike Helmacy www.techanalysis.com
Those who know me have found out I vacillate between the VERY
complicated and the very simple. I have been following a few stocks
(medium volatility, but good %% moves both up and down over a 2-5
week time frame) and tracking them with about 15 templates on which
most of the formulas that I have acquired reside. I wanted to track those
that did best and those that were not as effective. I also tracked those
formulas that were late in showing turns in momentum vs those that
caught the turn close on. In this regard, I was looking for finding stocks at
intermediate term lows and highs, NOT for indicators that identified stocks
that had begun their run in any direction and were destined to continue.
As a result, I came up with a very simple indicator that showed a HIGH
degree of accuracy in "turn-calling", but it did NOT give me indication of
the strength or duration of the new move, only that it probably would
occur. I believe that I have finally discovered that any signal of a change in
momentum will NEVER give you a sense of strength or duration BY ITS
VERY NATURE, and that only signals that identify stocks WITHIN a
momentum trend (ie..already established) are able to do that. My
momentum trend change indicator is derived from an intermediate trend
indicator I've used for some time in MSWIN 6.0...
PDI(34) - MDI(34)
My new formula is...........
((PDI(8) - MDI(8)) - (PDI(21) - MDI(21))) + (PDI(13) - MDI(13))
Try it......I think you'll like it......and it's the same coding in WOW, I
believe..........BW Chan I have posted an update to the RMTA and TOSC
formula's, the first formulas had an "Absolute Value" that wasn't called for
in the article ( I had mistaken the "[" "]" to mean "|" "|"). The new formulas
seem to plot exactly as the old......but I wanted the code to match the
math in the article. Thanks go out to William Golson for the help.
(Go Top)
Metastock Custom Indicator Moving Averages
periods1:=Input("Periods of ROC",2,50,12);
periods2:=Input("Smoothing Period",1,50,1);
Input("horizontal line 1",-50,50,5);
Input("horizontal line 2",-50,50,-5);
Mov(ROC(C,periods1,%),periods2,S);
(Go Top)
Metastock Expert Commentary by Michael Arnoldi
Review of : <symbol>
as of <date>
TODAY'S CLOSE WriteVal(CLOSE,2.3)
TOMORROW's
PROJECTED HIGH
WriteIf(C<O, "WRITEVAL(-L+ (H+2*L+C)/2,25.2)")
WriteIf(C>O, "WRITEVAL(-L+ (2*H+L+C)/2,25.2)")
WriteIf(C=O, "WRITEVAL(-L+ (H+L+2*C)/2,25.2)")
PROJECTED LOW
WriteIf(C<O, "WRITEVAL(-H+ (H+2*L+C)/2,25.2)")
WriteIf(C>O, "WRITEVAL(-H+ (2*H+L+C)/2,25.2)")
WriteIf(C=O, "WRITEVAL(-H+ (H+L+2*C)/2,25.2)")
BOLLINGER BANDS
CLOSING PRICE:WRITEVAL(C,2.3)
BOLLINGERBAND TOP:
WRITEVAL( BBandTop(C,21,E,2),13.3)
21 DAY MOVING AVERAGE:
WRITEVAL(MOV(C,21,E),13.3)
BOLLINGERBAND BOTTOM:
WRITEVAL( BBandBOT(C,21,E,2),13.3)
(Go Top)
Metastock SAR Exploration
{cola:BUY: this means: label column A as "BUY" and then enter the
following formula:}
Cross(L,(SAR(.02,.2)))
{colb:SELL: this means: label colum B as "SELL" and then enter the
following formula:}
Cross(SAR(.02,.2),H)
{enter the following in the filter section:}
cola=1 or colb=1
{where the AF=0.02 which you can change. try doing a sys test by
replacing the numbers with opt1 & opt2}
(Go Top)
Metastock-Stocks Closing Above 60 Day High
To find the securities that have closed above their high today (the last
trading day in the database) for the first time, I have written this
MetaStock Explorer.
ColA: {Close) C
ColB: {Previous 60-day High} Ref(HHV(H,60), -1)
ColC: {Current 60-day High} HHV(H,60)
ColD: {Volume} V
Filter: (colA>colB) AND (Ref(C,-1)<Ref(HHV(H,60), -1)) AND
(H=HHV(H,60))
1) It lists only those securities which have met the required conditions only
on the last trading day.
2) The new 60-day high must have taken place only on the last trading
day.
close>ref(hhv(close,60),-1)
if you want those that are {closing above the 60-day intraday high}
close>ref(hhv(high,60),-1)
(Go Top)
Mick's Breakout Exploration
This is a MetaStock formula that I have had good success with. Copy and
paste this into the Explorer filter.
C>Ref(C,-1) AND C>Ref(C,-2) AND C>Ref(C,-3) AND C>Ref(C,-4) AND
Ref(C,-1)<=Ref(C,-2) AND
Ref(C,-1)<=Ref(C,-3) AND
Ref(C,-1)<=Ref(C,-4) AND
Ref(C,-2)<=Ref(C,-3) AND
Ref(C,-2)<=Ref(C,-4) AND
Ref(C,-3)<=Ref(C,-4)
This formula will pick up all stocks that have closed up either the same as
the previous day or below the previous day for 3 days, then on the 4th day
closes up higher than the previous 3 days close. The reason that I
specified that the first 3 days close was the same as or less than the
previous days close was that it would pick up all stock in an up trend if it
was just the 4th day closing higher than the 3 previous you would get
hundreds of returns on the search. It will pick up stock that was in a
trading range or consolidating, then breaking out of the range. The reason
that I had the 4th day higher than the 3 previous was because it would
otherwise pick stock in a downtrend with no significant increase in the
close on day 4. Once I have a short list, I check it with Daryl's 3 day
countback line and sometimes run a 10/30 moving average. If the stock
breaches the previous day's close on the open, I will enter the trade and
put a trailing stop loss into play.
(Go Top)
Miesal Indicator
"It's a short term timing tool. It's not worth using for long term investors.
Some have also suggested using periods of 25 or 50 days, though I use
only 10 days. Others have suggested it's very useful when used in
conjunction with Welles Wilder's RSI."
Entry/Exit signal
buy:
Fml("CCIF-P")>Ref(Fml("CCIF-P"),-1) AND
Cross(Fml("CCIF-P"),-100) OR
Cross(Fml("CCIF-P"),100)
sell:
Fml("CCIF-P")<Ref(Fml("CCIF-P"),-1) AND
Cross(100,Fml("CCIF-P")) OR
Cross(-100,Fml("CCIF-P"))
{horizontal lines @ -100 & +100}
where:
{"CCIF-P" is}
(CCI(8)+CCI(13)+CCI(21))/3
(Go Top)
Mixed Balance Point Krause Update
I have updated some of the code since my last post concerning the TASC
articles written by Robert Krausz. The code now plots on the proper days
(instead of 1 day ahead) and they should also be more efficient to
calculate. These are named different so you should delete the old code
after you have installed the new. I will
also post a follow up with a graphic to show how these plot. Note: the
formulas on the Equis web page WILL NOT calculate for missing days
(Holidays).
(Go Top)
Modified 50 Day Moving Average
N:=50;
TN:=Mov(C,N,S);
sOneA:=((n-1)/2)*C+
((n-3)/2)*Ref(C,-1)+
((n-5)/2)*Ref(C,-2)+
((n-7)/2)*Ref(C,-3)+
((n-9)/2)*Ref(C,-4)+
((n-11)/2)*Ref(C,-5)+
((n-13)/2)*Ref(C,-6)+
((n-15)/2)*Ref(C,-7)+
((n-17)/2)*Ref(C,-8)+
((n-19)/2)*Ref(C,-9);
sOneB:=((n-21)/2)*Ref(C,-10)+
((n-23)/2)*Ref(C,-11)+
((n-25)/2)*Ref(C,-12)+
((n-27)/2)*Ref(C,-13)+
((n-29)/2)*Ref(C,-14)+
((n-31)/2)*Ref(C,-15)+
((n-33)/2)*Ref(C,-16)+
((n-35)/2)*Ref(C,-17)+
((n-37)/2)*Ref(C,-18)+
((n-39)/2)*Ref(C,-19);
sOneC:=((n-41)/2)*Ref(C,-20)+
((n-43)/2)*Ref(C,-21)+
((n-45)/2)*Ref(C,-22)+
((n-47)/2)*Ref(C,-23)+
((n-49)/2)*Ref(C,-24)+
((n-51)/2)*Ref(C,-25)+
((n-53)/2)*Ref(C,-26)+
((n-55)/2)*Ref(C,-27)+
((n-57)/2)*Ref(C,-28)+
((n-59)/2)*Ref(C,-29);
sOneD:=((n-61)/2)*Ref(C,-30)+
((n-63)/2)*Ref(C,-31)+
((n-65)/2)*Ref(C,-32)+
((n-67)/2)*Ref(C,-33)+
((n-69)/2)*Ref(C,-34)+
((n-71)/2)*Ref(C,-35)+
((n-73)/2)*Ref(C,-36)+
((n-75)/2)*Ref(C,-37)+
((n-77)/2)*Ref(C,-38)+
((n-79)/2)*Ref(C,-39);
sOneE:=((n-81)/2)*Ref(C,-40)+
((n-83)/2)*Ref(C,-41)+
((n-85)/2)*Ref(C,-42)+
((n-87)/2)*Ref(C,-43)+
((n-89)/2)*Ref(C,-44)+
((n-91)/2)*Ref(C,-45)+
((n-93)/2)*Ref(C,-46)+
((n-95)/2)*Ref(C,-47)+
((n-97)/2)*Ref(C,-48)+
((n-99)/2)*Ref(C,-49);
sOne:=sOneA+sOneB+sOneC+sOneD+sOneE;
yTwo:=TN+(6*sOne)/((N+1)*N);
yTwo
(Go Top)
Modified Williams %R Metastock Indicator
by Rajat Bose
{All I have done here is to substitute High and Low of any bar with that of
Bollinger Band Top and Bollinger Band Bottom. I have tested it on various
time periods (for Bollinger Bands) using 2 standard deviations. It
sometimes gives an early indication of reversals than the Williams %R of
the same period. Divergences have also been somewhat better. However,
the structure shows that most of its properties are similar to those of the
Williams %R or, for that matter, of any other overbought-oversold
indicator.}
(Go Top)
Money Flow Index
The MFI (Money Flow Index) can be used in place of the OBV (On Balance
Volume) and Chaikin Oscillator to confirm Bollinger Bands.
Here are the MetaStock formulas for the Money Flow Index:
NB:The time periods are controlled by PERIODS in the Positive & Negative
Money Flow formulas.
(Go Top)
MovAvg Asymmetric Volatility Price Bands
SIGNAL FORMULAS
Enter Long:
Periods := 11;
UpperBand := BBandTop(CLOSE,Periods,S,1.7);
BuySignal1 := Sum(CLOSE > UpperBand,3) = 3;
BuySignal2 := CLOSE > UpperBand AND Ref(LOW,-1) > Ref(upperband,-1);
BuySignal3 := LOW > UpperBand AND Ref(CLOSE,-1) > Ref(upperband,-1);
BuySignal4 := CLOSE > UpperBand AND CLOSE > 1.4 * LLV(LOW,Periods +
1) AND Mov(VOLUME,3,S) > 2000 {assuming volume in 100's otherwise
use 200000} AND Mov(HIGH,3,S) > UpperBand AND Mov(HIGH -
LOW,3,S)> Mov(HIGH - LOW,Periods,S);
BuySignal1 OR BuySignal2 OR BuySignal3 OR BuySignal4
Close Long:
Periods := 11;
LowerBand := BBandBot(CLOSE,Periods,S,2);
SellSignal1 := Sum(CLOSE < LowerBand,3) = 3;
SellSignal2 := CLOSE < (1-.18) * HHV(HIGH,Periods + 1) AND Sum(CLOSE
< LowerBand,2) = 2;
SellSignal3 := CLOSE < (1-.18) * HHV(HIGH,Periods + 1) AND HIGH <
LowerBand;
SellSignal1 OR SellSignal2 OR SellSignal3
STOPS
Maximum Loss: LONG ONLY
10.00 Percent
(Go Top)
Moving Average Channel
"The MetaStock moving average function has an option for displacing the
mov both vertically and horizontally. most of the time, I prefer to use a
mov channel in place of Bollinger Bands."
from L. and G. Issen
"I use moving average, instead of Bollinger Bands, creating three
indicators in the following way, and saving them in a template:
Mov(C, 28,S) displaced +10%
Mov(C, 28,S) displaced - 10%
Mov(C, 28,S)
28 days is the basic span of time. Like the 10% +/-, this should be
adjusted for each security and for the particular condition you are waiting
for (buy/sell). When I see a buying opportunity ahead, I just draw another
trio of faster MAs (keeping the slow on the chart) and use them, with other
indicators/oscillators, to time the entry. Same process to exit the market."
(Go Top)
Moving Average Crossover---Bullish
This is a10 and 30 day moving average crossover search. Results close to
0 pinpoint the crossover.
• CLOSE
• Mov(CLOSE,30,EXPONENTIAL)
• ((CLOSE-Mov(CLOSE,30,EXPONENTIAL))
/Mov(CLOSE,30,EXPONENTIAL)) * 100
• ((CLOSE-Mov(CLOSE,10,EXPONENTIAL))
/Mov(CLOSE,10,EXPONENTIAL)) * 100
• **When(colA> colB)
(Go Top)
Moving Average Crossovers
What follows is a simple example using a moving average crossover
system for MetaStock, employing 10 and 30 day exponential averages.
These are just examples and profitability is dubious.
Custom indicator for cumulative open Equity curve without trading costs--
You can make several such equity lines and then just add them by using a
yet another custom indicator, e.g.,
21 d reversal w di
enter long
c>prev(hhv(c,21),1) and adx(1)>adx(14) and
(pdi(9)>mdi(14))
exit long
c<prev(llv(c,21),1) and (pdi(14)<mdi(9))
enter short
c<prev(llv(c,21),1) and adx(1)>adx(14) and
(pdi(9)<mdi(14))
exit short
c>prev(hhv(c,21),1) and (pdi(9)>mdi(14))
(Go Top)
MTF-Fixed Balance Point
name: MTF-Fixed Balance Point
Dw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
Wt:=If(Dw=1,
{then}(Ref(HighestSince(1,Dw=1,H),-1)+
Ref(LowestSince(1,Dw=1,L),-1) +
Ref(C,-1))/3,
{else}0);
DwP:=ValueWhen(1,Wt>0,Wt);
Dwp
Dw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
Wt:=If(Dw=1,
{then}(Ref(HighestSince(1,Dw=1,H),-1)+
Ref(LowestSince(1,Dw=1,L),-1) +
Ref(C,-1))/3,
{else}0);
DwPs:=(ValueWhen(1,Wt>0,Wt)+
ValueWhen(2,Wt>0,Wt)+
ValueWhen(3,Wt>0,Wt)+
ValueWhen(4,Wt>0,Wt)+
ValueWhen(5,Wt>0,Wt))/5;
Dwps
------------------------------------------------
name: MTF-Dynamic Balance Point
Dw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
Wt:=If(Dw=1,
{then}(Ref(HighestSince(1,Dw=1,H),-1)+
Ref(LowestSince(1,Dw=1,L),-1) +
Ref(C,-1))/3,
{else}0);
Wh:=If(Dw=1,
{then}Ref(HighestSince(1,Dw=1,H),-1),
{else}0);
Wl:=If(Dw=1,
{then}Ref(LowestSince(1,Dw=1,L),-1),
{else}0);
Wr:=ValueWhen(1,Wh>0,Wh)-ValueWhen(1,Wl>0,Wl);
DwP:=ValueWhen(1,Wt>0,Wt);
RR1:=DwP+(Wr*.5);
RR2:=DwP+(Wr*.618);
SR1:=DwP-(Wr*.5);
SR2:=DwP-(Wr*.618);
SR2;
SR1;
RR1;
RR2;
---------------------------------------
name: MTF-Tendency
Mt:=If(DayOfWeek()=1,
Ref(C,-1)- FmlVar("MTF-Fixed Balance Point","DWP"),
0);
If(Mt>0,1,If(Mt<0,-1,0))
(Go Top)
MTF Tendency Update
{Multiple Time Frame - Tendency 5/23/99}
{This will plot 1 for Bullish
-1 for Bearish}
dw:=DayOfWeek();
Fw:=If(dw<Ref(dw,-1),1,0);
Mt:=If(Fw=1 AND Ref(dw,-1)<>5,
{then}Ref(C,-1)- FmlVar("MTF-Fixed Balance Point","DWP"),
{else}If(dw=5,
{then}C-((HighestSince(1,Fw=1,H)+
LowestSince(1,Fw=1,L)+C)/3),
{else}0));
If(Mt>0,1,If(Mt<0,-1,0));
(Go Top)
Multipart Formulas
QUESTION:
I've got a specific question. I use WOW and MetaStock. Suppose I've got
some indicator that ranges from 0 to 100 and I have a system that says
"buy when the indicator goes above 90 and hold until it goes below 10 and
then sell" or something. Notice that if the indicator is between 10 and 90
that you don't know whether that's a hold or a don't hold unless you know
whether it last crossed 90 or 10. So far so good. Now suppose I want to
combine the signal from this system with another indicator/system so that
I can say something like "buy when system #2 says buy only if system #1
is in "hold the stock" mode." This may take the form of another indicator
that is "1" when the system is in hold mode and "0" when it is in don't hold
mode. This seems like a general problem that must come up often but it is
not obvious to me how to code it. I'll bet other people could benefit from
the answer as well.
Bob Anderton
ANSWER:
Thanks to all of you for the great help and input to the question of how to
deal with combining the indicators in a system when one of them gives a
signal by crossing. There were two responses, one can be seen in #3310
from Larry on the Yahoo! MetaStock board (thanks Mike) which is
answering a slightly different question. That solution seems like what one
would use if one wanted to look for system 2 signalling a buy the same
day as system 1 signalling a buy by crossing a value. What I actually
wanted to do was have a way of looking for system 2 signalling a buy
during anytime that system 1 was saying hold because its last signal had
been a buy.
This was addressed very nicely by Paul in message #3311. I took his idea
to make the following indicator:
If(BarsSince(Cross(Fml("Indicator1"),90))<BarsSince(Cross(10,Fml("Indicat
or1"))),1,0)
This makes a new indicator that is 1 when the last signal is a buy and 0
when the last signal was a sell. Imagine that this is a really long term
indicator. Now you can look for your short term indicator #2 to signal a sell
and just AND it with this new indicator being = 1, meaning that the first
indicator was in hold mode.
This is a big step forward for me. I'd never used this BARSSINCE function
before(which is PERIODSSINCE for WOW) and this was key to being able to
do this I think.
(Go Top)
Mutated Variables, Volatility and a New Market Paradigm
Mutated Variables, Volatility and a New Market Paradigm by Walter T.
Downs, Ph.D.
In MetaStock for Windows 6.0 or higher, use the Expert Advisor to create
highlights, which will show when contraction and expansion phases are
present. First, choose Expert Advisor from the tools menu in MetaStock.
Create a new Expert with the following highlights:
Expert name: New Market Paradigm
HIGHLIGHTS
Name: Contraction
Condition: BBandTop(CLOSE,28,SIMPLE,2)<
Ref(BBandTop(CLOSE,28,SIMPLE,2),-1) AND
BBandBot(CLOSE,28,SIMPLE,2)>Ref(BBandBot(CLOSE,28,SIMPLE,2),-1)
Color: Blue
Name: Expansion
Condition: BBandTop(CLOSE,28,SIMPLE,2)>
Ref(BBandTop(CLOSE,28,SIMPLE,2),-1) AND
BBandBot(CLOSE,28,SIMPLE,2)<Ref(BBandBot(CLOSE,28,SIMPLE,2),-1)
Color: Red
Click OK to save the changes to the Expert. Open a chart and then click
your right-mouse button while pointing at the chart heading. Choose
Expert Advisor and then choose Attach from the chart shortcut menu.
Choose the New Market Paradigm Expert and then click the OK button. The
price bars in the chart will be highlighted blue during a contraction phase
and red in an expansion phase.
(Go Top)
My version of Tushar Chande's Vidya using the P variable
Vidya{P}
Periods:=Input("length of MA",5,100,20);
K:=Stdev(P,5)/Mov(Stdev(P,5),20,S);
A:=(2/(Periods+1));
Vidya:=A*K*(P)+(1-A*K)*Ref(P,-1);
Vidya;
Tar(SZ)an Long
C-(((462*Mov(C,34,E))-(420*Mov(C,13,E))+(490*(Mov(Mov(C,13,E)-
Mov(C,34,E),89,E))))/42)
Tar(SZ)an Short
(C-(((325*Mov(C,26,E))-(297*Mov(C,12,E))+(351*Mov(Mov(C,13,E)-
Mov(C,26,E),9,E))))/28)*2
(Go Top)
Market Facilitation Index
The following formulas were constructed using interpretation from
Technical Analysis of Stocks & Commodities Magazine June 1994, article
"The Market Facilitation Index", by Gary Hoover.
Taken from Stocks & Commodities, V. 12:6 (253-254): The Market
Facilitation Index by Gary Hoover
"Applying technical analysis to developing trading signals begins with the
investigation of price movement and often incorporates volume studies to
improve trading accuracy. The Market Facilitation Index (MFI) is one
indicator that synthesizes both price and volume analysis. The MFI is the
ratio of the current bar's range (high-low) to the bar's volume.
The MFI is designed to gauge the efficiency of price movement. The
efficiency is measured by comparing the current bar's MFI value to the
previous bar's MFI value. If the MFI increased, then the market is
facilitating trade and is more efficient, implying that the market is
trending. If the MFI decreased, then the market is becoming less efficient,
which may indicate a trading range is developing that may be a trend
reversal…."
Range:
High-Low
MFI:
Fml("Range") / Volume
Efficiency:
If(Fml("MFI"),>,Ref(Fml("MFI"),-1),1, If(Fml("MFI"),<,Ref(Fml("MFI"),-1),-1,
If(Fml("MFI"),=,Ref(Fml("MFI"),-1),0,0)))
Where:
+1 = increase
-1 = decrease
0 = unchanged
Market Facilitation Comparison:
If(V,>,Ref(V,-1),If(Fml("MFI"),>,Ref(Fml("MFI"),-1) ,
1,If(Fml("MFI"),<,Ref(Fml("MFI"),-1),2,0)),If(V,< ,Ref(V,-
1),If(Fml("MFI"),>,Ref(Fml("MFI"),-1),3,If( Fml("MFI"),<,Ref(Fml("MFI"),-
1),4,0)),0))
Where:
1 = +,+
2 = +,-
3 = -,+
4 = -,-
(Go Top)
Market Facilitation Index Expert Advisor
In the August 1996 Stocks & Commodities, an article by Thom Hartle titled
"The Market Facilitation Index" showed how to color bars to identify chart
patterns based on changes in the market facilitation index and volume.
Here is how to do this in MetaStock 6.0's new Expert Advisor.
The first step is to create a new expert by choosing Expert Advisor from
MetaStock's Tool menu, and then choose New from the Expert Advisor.
Name the expert "Market Facilitation Index", enter any notes you like and
then click on the Highlights tab. Enter the following Highlights by choosing
New, the color and then entering the following formulas:
Green Bar (Green Bar)
ROC((H-L)/V,1,$) > 0 AND ROC(V,1,$) > 0
Fade Bar (Blue Bar)
ROC((H-L)/V,1,$) < 0 AND ROC(V,1,$) < 0
Fake Bar (Dk Gray Bar)
ROC((H-L)/V,1,$) > 0 AND ROC(V,1,$) < 0
Squat Bar (Red Bar)
ROC((H-L)/V,1,$) < 0 AND ROC(V,1,$) > 0
After you have entered the four highlights click OK to finish editing the
expert's properties. You can now right-click on the heading or background
of any chart. Next select Expert Advisor and then Attach from the Chart
shortcut menu. Attach the market facilitation index expert, and it will
highlight the four market facilitation patterns that were discussed in
Hartle's article. Note: You can save a chart as a template with this expert
attached, and then any time you apply the template to a chart the market
facilitation index expert will automatically attach to the chart.
-- Allan J. McNichol, Equis International
(Go Top)
Market Thrust Oscillator
The following formulas were taken from the article, "The Cumulative
Market Thrust Line", by Tushar Chande, in the December 1993 issue of
Technical Analysis of Stocks & Commodities.
Taken from Stocks & Commodities, V. 11:12 (506-511): The Cumulative
Market Thrust Line by Tushar S. Chande, PhD.
"STOCKS & COMMODITIES contributor Tushar Chande originally introduced
the concept of market thrust in August 1992 as a method by which to
overcome the limitations of the Arms index. Since then, variations have
been suggested on the theme and here, Chande offers the variation of a
cumulative market thrust line, in which market thrust is cumulated to
calculate a volumetric advance-decline line by including the effect of up
and down volume."
Composite securities are created from 4 separate files. Advances,
Declines, Upvolume, Downvolume. The article side bar presupposes the
user has these four files.
Reuters Trend Data (RTD) supplies this data in two files. The tickers are
X.NYSE-A (Advances, number and volume) and X.NYSE-D (Declines,
number and volume). To use these two files, you must utilize two different
custom formulas and the indicator buffer in MetaStock™ for DOS.
CompuServe supplies this data in 4 files. The tickers are NYSEI (Advances);
NYSEJ (declines); NYUP (Advance volume) and NYDN (decline volume).
Dial/Data supplies this data in two files. Advances, number and volume
and Declines, number and volume. The tickers are @*NAZ_K and
@*NDZ_K.
For the Windows versions of MetaStock:
For RTD and Dial Data:
#1: C * V
#2: 100 * ( ( P - ( C * V ) ) / ( ( P + ( C * V ) ) ) )To plot it:
• Load advances, plot formula #1.
• Load declines.
• Drag the plotted formula #1 from the advances in to the declines
chart.
• Plot the thrust indicator formula (#2) directly on top of the
plotted formula #1 in the declines chart.
For CompuServe data:
#1: C
#2: 100 * ( ( P - C ) / ( ( P + C ) ) )
To plot it:
• Create a composite of the Advances * Up Volume
• Create a composite if the Declines * Down Volume
• Load advances composite , plot formula #1.
• Load declines composite.
• Drag the plotted formula #1 from the advances in to the declines
chart.
• Plot the thrust indicator formula (#2) directly on top of the
plotted formula #1 in the declines chart.
** To create the cumulative thrust oscillator line perform the same steps
as above except change formula #2 to:
Cum(100*(P-C)/(P+C)) for CompuServe data
Cum(100*(P-(C*V))/(P+(C*V))) for RTD and Dial Data
** To create the cumulative market thrust line, the formula is:
Cum(P-C) for CompuServe data
Cum(P-(C*V)) for RTD and Dial Data
You now have the thrust indicator plotted exactly as the article discusses.
(Go Top)
Martin Pring's KST Formulas
The KST indicator was developed by Martin J. Pring. The name KST comes
from "Know Sure Thing". The KST is constructed by summing four
smoothed rates of change. For more interpretation refer to Martin Pring's
article "Summed Rate of Change (KST)" in the September 92 issue of
TASC.
Now you can play with these combinations on both the enter long and
close long side. For example, keep the same Enter Long but change the
Close Long to:
Cross(Mov(C,40,E) ,Mov(C,5,E) )
This will keep you in the trade longer. You may want to enter when the 5
crosses above the 13 and not wait for the 40 OR, you may just want to use
the 5 cross above the 40 and forget about the 13.
WkDayCount-ValueWhen(2,1,WkDayCount)-1
+VolMissing
(Go Top...)
Momentum - normalized
{ Normalized Momentum v3.1 }{ ©Copyright 2003-2004 Jose Silva }
{ josesilva22@yahoo.com }
pds:=Input("Momentum periods",1,2520,10);
pdsN:=Input("normalizing periods (1=none)",
1,2520,63);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
plot:=Input("Momentum=1, midpoint crossover Signals=2",1,2,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
y:=Ref(x,-pds);
ratio:=Min(x,y)/Max(x,y);
Mom:=If(x>y,2-ratio,ratio)*100-100;
MomNorm:=(Mom-LLV(Mom,pdsN))
/(HHV(Mom,pdsN)-LLV(Mom,pdsN)+.000001)*100;
MomNorm:=If(pdsN=1,Mom,MomNorm);
midpt:=If(pdsN=1,0,
Cum(MomNorm)/Cum(IsDefined(MomNorm)));
signals:=
Cross(MomNorm,midpt)-Cross(midpt,MomNorm);
midpt;If(plot=2,signals,MomNorm)
(Go Top...)
Momentum, LRS-smoothed
{ LRS-smoothed normalized Momentum v2 }{ ©Copyright 2003 Jose
Silva }{ josesilva22@yahoo.com }
pds:=Input("Momentum periods",2,2520,10);
smooth:=Input("LRS smoothing periods",
1,252,10);
plot:=Input("Momentum=1, Smoothed=2, Double smoothed=3",1,3,2);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
y:=Ref(x,-pds);
ratio:=Min(x,y)/Max(x,y);
Mom:=If(x>y,2-ratio,ratio)*100-100;
MoSm:=LinRegSlope(Mom,smooth)*10;
MoSm:=If(smooth<2,Mom,MoSm);
MoSm2:=LinRegSlope(MoSm,smooth)*4;
MoSm2:=If(smooth<2,Mom,MoSm2);
If(plot=1,Cum(Mom)/(Cum(Mom>-100)+.000001),
If(plot=2,Cum(MoSm)/(Cum(MoSm>-100)+.000001),
Cum(MoSm2)/(Cum(MoSm2>-100)+.000001)));
If(plot=1,Mom,If(plot=2,MoSm,MoSm2))
Natenberg's Volatility
rev. 01/21/97
The above assumes Weekly Data. To utilise this with Daily Data, the
MetaStock formula would be:
For further interpretation refer to the book "Option Volatility & Pricing," by
Sheldon Natenberg.
Nat's Volt
Std(log(c/ref(c,-1)),10)*sqr(365/7)
(Go Top)
NR4 Formula from Trading Tactics page 100
Column A
Std(Log(C/Ref(C,-1)),5)/Std(Log(C/Ref(C,-1)),99)
Column B
HIGH-LOW<Ref(LLV(H-L,3),-1)
Column C
HIGH<(Ref(HIGH,-1)AND LOW>Ref(LOW,-1))
Column D
HIGH
Column E
LOW
Filter
colA<.5 AND (colB= 1 OR colC= 1)
One Day Money Flow
The One Day Money Flow Indicator (some also call this indicator the One
Day Accumulation/Distribution Indicator) MetaStock formula is the
following:
RSI(25)+Stoch(25,3)+Mo(25)+CCI(25)
(Go Top)
OBV Volatility
{ On Balance Volume Volatility v1.0 }{ Plot on own window below price
chart }{ ©Copyright 2004 Jose Silva }{ josesilva22@yahoo.com }
x:=Stdev(If(choose=1,OBV(C),C),pds);
y:=Ref(x,-1);
ratio:=Min(x,y)/Max(x,y);
Vt:=Abs(If(x>y,2-ratio,ratio)-1)*100;
VtAvg:=Cum(Vt)/Cum(Vt>-1);
VtUp:=If(x>Ref(x,-1),Vt,0);
VtDw:=-If(x<Ref(x,-1),Vt,0);
If(plot=2,VtUp,If(plot=3,OBV(C),VtAvg));
If(plot=2,VtDw,If(plot=3,OBV(C),Vt))
x:=Stdev(OBV(C),pds);
y:=Ref(x,-1);
ratio:=Min(x,y)/Max(x,y);
Vt:=Abs(If(x>y,2-ratio,ratio)-1)*100;
VtUp:=If(x>Ref(x,-1),Vt,0);
VtDw:=-If(x<Ref(x,-1),Vt,0);
In:=Cross(-level,VtDw);
Out:=Cross(VtUp,level);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=Ref(BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit,-delay);
In1:=Cum(Cum(In))=1;
Out1:=Cum(Cum(Out))=1;
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));
odd:=Cum(1)/2=Int(Cum(1)/2);
Ref(If(plot=1,In1,0),-delay);
-(plot=1 AND Ref(Out1 AND BarsSince(In1)
>=BarsSince(Out1),-delay));
If(plot=1,0,If(odd,flag,0));
If(plot=1,signals,flag)
Panic Selling
sqrt(((buyp()/sellp())/rsi(2))) > ref(((buyp()/sellp())/rsi(2)),-1)
(Go Top)
Performance Daily
Stocks sorted on % gains over 1, 2, 3, 4, and 5 days. Rank results for the
selected day. Good for finding breakout stocks.
• CLOSE
• ROC(CLOSE,1,percent)
• ROC(CLOSE,2,percent)
• ROC(CLOSE,3,percent)
• ROC(CLOSE,4,percent)
• ROC(CLOSE,5,percent)
(Go Top)
Performance Intra Day and Daily
ColA:C {label CLOSE}
ColB:O {label OPEN}
ColC:Sub(C,O) / O {label Intr.dy%}
ColD:Sub(C,Ref(C,-1)) / Ref(C,-1) {label 1 dy %}
ColE:Sub(C,Ref(C,-2)) / Ref(C,-2) {label 2 dy %}
ColF:Sub(C,Ref(C,-3)) / Ref(C,-3) {label 3 dy %}
Filter: O>.2 AND
C<.3 AND
C>.2
Filter: enabled
Periodicity: Daily
Records required: 5
(Go Top)
Persistance of Money Flow
Chaikin's Money Flow is a built-in MetaStock indicator, as follows:
cmf(periods)
{from HHP}
The formula below may be close to what you want, but it will not plot on
the forward day. It will just plot the point where tomorrow's EMA would be.
The equation is based on the MetaStock manual, page 459, concerning
exponential moving averages.
TC:=Input("Tomorrow's close",0.001,1000,1);
MAP:=Input("Moving Average Period",2,144,55);
MA1:=Mov(C,MAP,E);
EPX:=2/(MAP+1);
MA2:=(TC*EPX)+(MA1*(1-EPX));
ValueWhen(1,Cum(1)=LastValue(Cum(1)),MA2)
(Go Top)
Presto's Magic Box
(a tweaked version of the Darvis Box)
Periods:=Input("periods",1,260,100);
Topbox:=If(Ref(H,-3)>=Ref(HHV(H,Periods),-4) AND Ref(H,-2)<Ref(H,-3)
AND Ref(H,-1)<Ref(H,-3) AND H< Ref(H,-3),Ref(H,-3),PREVIOUS);
Botbox:=If(Ref(H,-3)>=Ref(HHV(H,Periods),-4) AND Ref(H,-2)<Ref(H,-3)
AND Ref(H,-1)<Ref(H,-3) AND H< Ref(H,-3),LLV(L,4),PREVIOUS);
Botbox;
Topbox;
(Go Top)
Price Action Indicator (PAIN)
If you were only given today's open, high, low and close, how could you
make heads or tails of it? The Price Action Indicator (PAIN) can help. The
formula returns a single value that weighs intra-day momentum (C-O),
Late Selling Pressure (LSP) (C-L), and Late Buying Pressure (LBP) (C-H).
The formula is proven by constructing ideal limit-up and limit down
scenarios in bond futures. The output is shown to be consistent with the
interpretation of Japanese candlestick patterns. See Michael B. Geraty
(1997). "Getting Better Directions" Futures Vol. 26: Aug.
PAIN
((C-O)+(C-H)+(C-L))/2
(Go Top)
Price and Volume Breakout
Shows stocks where the price increased 5% and the volume is 50% above
a 50-day moving average. Rank results by % change in price, then check
the volume.
• CLOSE
• Ref(CLOSE,-1)
• ROC(CLOSE,1,percent)
• VOLUME
• Mov(VOLUME,50,EXPONENTIAL)
• ((VOLUME - Mov(VOLUME,50,EXPONENTIAL))
/Mov(VOLUME,50,EXPONENTIAL)) * 100
• **When(colC> = 5) AND When(colD >= colE*1.5)
(Go Top)
Pring's Daily KST Buy
Notes: KST BUY SIGNAL FROM BELOW ZERO
ColA:
Name: Close
CLOSE
ColB:
Name: KST
(Mov(ROC(C,10,%),10,S)*1)+(Mov(ROC(C,15,%),10,S)*2)+
(Mov(ROC(C,20,%),10,S)*3)+(Mov(ROC(C,30,%),15,S)*4)
ColC:
Name: KST MA
Mov((Mov(ROC(C,10,%),10,S)*1)+(Mov(ROC(C,15,%),10,S)*2)+
(Mov(ROC(C,20,%),10,S)*3)+(Mov(ROC(C,30,%),15,S)*4),10,S)
ColD:
Name: KST-1
Ref( (Mov(ROC(C,10,%),10,S)*1)+(Mov(ROC(C,15,%),10,S)*2)+
(Mov(ROC(C,20,%),10,S)*3)+(Mov(ROC(C,30,%),15,S)*4),-1)
ColE:
Name: MA KST-1
Ref(Mov((Mov(ROC(C,10,%),10,S)*1)+(Mov(ROC(C,15,%),10,S)*2)+
(Mov(ROC(C,20,%),10,S)*3)+(Mov(ROC(C,30,%),15,S)*4),10,S),-1)
Filter:
When(colB,>,colC)AND When(colB,<,0)AND When( colD,<,colE)
(Go Top)
Projected Range
From "Lyn Maine"
This is
Tom DeMark's Projected Range:
TPH1:=(H+C+2*L)/2-L;
TPH2:=(2*H+L+C)/2-L;
TPH3:=(H+L+2*C)/2-L;
TPL1:=(H+C+2*L)/2-H;
TPL2:=(2*H+L+C)/2-H;
TPL3:=(H+L+2*C)/2-H;
PH:=If((C<O),TPH1,If((C>O),TPH2,If((C=O),TPH3,0)));
PL:=If((C<O),TPL1,If((C>O),TPL2,If((C=O),TPL3,0)));
PH;
PL;
This is %f Osc:
100*((C-Ref(TSF(C,5),-1))/C)
This is Volatility%:
{Slow Line}
Mov(Mov((PVT()-LLV(PVT(),19))/
(HHV(PVT(),19)-LLV(PVT(),19)), 5, S),3,S)
(Go Top)
Pathfinder Trading System
To recreate the Pathfinder currency trading system (described in the
October 1996 interview with Nelson Freeburg) in MetaStock for Windows,
open two charts, one of the desired currency and the other of Treasury
bonds. For this example, I used the Swiss Franc. Choose Tile from the
Window menu so both charts are visible. Drag the T-bonds price bar and
drop it on the heading of the currency chart. Your currency chart should
now have T-bonds plotted in the top inner window of the chart. Click on
the T-bonds plot in the currency chart so it's selected (that is, little squares
appear on the price bars). You will need to select the T-bonds plot each
time before running a system test. The selected plot tells the MetaStock
System Tester what to use for "P". Next, choose System Tester from the
Tools menu, and then New to create a new system. Enter the following
system rules, stops, and options and then run the test.
Signal Formulas
Enter Long:
Mov(C,6,S) > Ref(Mov(C,6,S),-1) AND
Mov(P,3,S) > Mov(P,25,S) AND
Alert(Cross(Mov(C,9,S),Mov(C,18,S)),10)
Close Long
Cross(Mov(C,18,S),Mov(C,9,S))
Enter Short
Mov(C,6,S) < Ref(Mov(C,6,S),-1) AND
Mov(P,3,S) < Mov(P,25,S) AND
Alert(Cross(Mov(C,18,S),Mov(C,9,S)),10)
Close Short
Cross(Mov(C,9,S),Mov(C,18,S))
Stops
Maximum Loss Stop:
Long and short positions
Maximum loss of 0.016 points.
chart:=If(LastValue(Cum(Wk=ValueWhen(2,1,Wk)))=0,2,1);
chart:=If(LastValue(Cum(Mth=ValueWhen(2,1,Mth)))=0,3,chart);
chart:=If(LastValue(Cum(Qtr=ValueWhen(2,1,Qtr)))=0,4,chart);
chart:=If(LastValue(Cum(Yr=ValueWhen(2,1,Yr)))=0,5,chart);
chart
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
pds:=If(chart=1,pds,If(chart=2,pds/5,
If(chart=3,pds/21,If(chart=4,pds/63,pds/252))));
pds:=If(pds<1,1,pds);
pds:=If(pds>Cum(IsDefined(x)),
Cum(IsDefined(x)),pds);
Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
Ema:=Ema*shift;
signals:=Cross(x,Ema)-Cross(Ema,x);
If(plot=2,signals,Ema)
WkCount
Rally Gap and Inside Day
Finds stocks which have rallied, gapped upwards, and then had an inside
day.
Usually leads to a resumption of the rally. The search returns 1 for Ok and
0 for not ok.
• RallyWithVol()
• Inside()
• GapUp()
(Go Top)
Range High
Looks for out of range move where the close equals the high. Suggests
more buying pressure.
The search returns 1 for Ok and 0 for not ok.
• BigWhite()
• CLOSE
•
(Go Top)
{Recursive Moving Trend Average}
Lb:=Input("Look-Back Period?",3,100,21);
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+
(Alpha*(C+Bot-Ref(Bot,-1)));
RMTA;
{TOSC}
Lb:=Input("Look-Back Period?",3,100,21);
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+
(Alpha*(C+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(C,lb,E);
TOSC;
Is the name of an article in the December issue of TASC, written by Dennis
Meyers. In it he describes what he calls " The Recursive Moving Trend
Average" . I wont go into all the article right now, but here is my
translation of his math (for Metastock 6.5) :
{Recursive Moving Trend Average}
Lb:=Input("Look-Back Period?",3,100,21);
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+
(Alpha*Abs(C+Bot-Ref(Bot,-1)));
RMTA;
He then explains how to make an oscillator by subtracting an Exponential
MA form the Recursive MA...... again here is the code:
{TOSC}
Lb:=Input("Look-Back Period?",3,100,21);
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+
(Alpha*Abs(C+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(C,lb,E);
TOSC;
Here is the code for System Testing;
Buy Long:
Lb:=opt1;
ent:=3;
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+
(Alpha*Abs(C+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(C,lb,E);
Cross(tosc,(0-Abs(ent)))
Sell short:
Lb:=opt1;
ent:=3;
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+
(Alpha*Abs(C+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(C,lb,E);
Cross((0+Abs(ent)),tosc1)
Opt1 is the look- back periods, of 3 to 30, and Opt2 is the entry value of
the oscillator, 0 to 5.
Now, after all the hours spent on figuring out the code, I have discovered
that the RMTA plots very similar to the DEMA, oh well............
(Go Top)
Regression Asymmetric Volatile Price Band
SIGNAL FORMULAS
Enter Long:
Periods := 21;
UpperBand := STEBandTop(CLOSE,Periods,1) ;
Sum(CLOSE > UpperBand,3) = 3 AND LinRegSlope(CLOSE,21)> 0 AND
ROC(Correl(CLOSE,Cum(1) ,21,0),2,$) >= .2
Close Long:
Periods := 21;
LowerBand := STEBandBot(CLOSE,Periods,1.5) ;
SellSignal1 := Sum(CLOSE < LowerBand,3) = 3;
SellSignal2 := CLOSE < (1-.18) * HHV(HIGH,Periods + 1) AND HIGH <
LowerBand;
SellSignal1 OR SellSignal2
STOPS
Maximum Loss: LONG ONLY
10.00 Percent
(Go Top)
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;
(Go Top)
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);
(Go Top)
ROC Moving Average System Test
ENTER LONG:
ROC(Mov(C,12,E),1,%)>0 AND ROC(Mov(C,60,E),1,%)>0
EXIT LONG:
(ROC(Mov(C,12,E),1,%)<0 AND ROC(Mov(C,60,E),1,%)>0)
OR
(ROC(Mov(C,12,E),1,%)>0 AND ROC(Mov(C,60,E),1,%)<0)
SHORT:
ROC(Mov(C,12,E),1,%)<0 AND ROC(Mov(C,60,E),1,%)<0
EXIT SHORT:
(ROC(Mov(C,12,E),1,%)<0 AND ROC(Mov(C,60,E),1,%)>0)
OR
(ROC(Mov(C,12,E),1,%)>0 AND ROC(Mov(C,60,E),1,%)<0)
{Ref(c,-1) gives yesterday's close today. So all values are shifted to the
right!}
(Go Top)
RSI and Moving Averages
{place in filter section}
Ref(RSI(14),-1)>Trough(1,RSI(14),.8)
AND
Ref(CLOSE,-1)<Trough(1,CLOSE,.2)
(Go Top)
RSI Offset
RSI(13) - 50 {offset the RSI to +-50}
(Go Top)
Ruggerio's Trend
Ruggiero's rules for trend mode quoting his table 4.9:
periods:=Input("Periods?",1,63,14);
If((ADX(periods)>25 AND (BarsSince(Cross(45,ADX(periods))) >
BarsSince(Cross(ADX(periods),25)))) OR (ADX(periods) > 10 AND
Ref(ADX(periods),-4)<10 AND (ADX(periods)-Ref(ADX(periods),-5)>0)), 1,
If(ADX(periods)<20 OR ((BarsSince(Cross(45,ADX(periods)))<
BarsSince(Cross(ADX(periods),25))) AND ADX(periods) < 45),-1,0))
(Go Top)
Random Walk Index
The following formulas, for the Random Walk Index, were constructed
using information from the article "Are There Persistent Cycles", by E.
Michael Poulos, in the September 1992 TASC.
All formulas are needed.
MetaStock Windows versions:
Random Walk Index:
Max( ( Ref(HIGH,-1) - LOW ) / ( ( Ref(Sum (Atr ( 1 ) ,2 ),-1) / 2) * Sqrt( 2 ) )
,Max( (Ref(HIGH,-2) -LOW) / ( ( Ref(Sum (Atr ( 1 ),3),-1) / 3) * Sqrt( 3 ) ),
Max( (Ref(HIGH,-3) - LOW)
/ ( (Ref(Sum (Atr( 1 ) ,4) ,-1) / 4) * Sqrt( 4 ) ) , Max( ( Ref( HIGH,-4) - LOW) /
( (Ref(Sum(Atr( 1 ),5),-1) / 5) * Sqrt( 5 ) ), Max( (Ref(HIGH,-5) - LOW) /
( (Ref( Sum( Atr ( 1 ),6),-1) / 6 )
* Sqrt( 6 ) ), Max( ( Ref(HIGH,-6) -LOW) / ( (Ref( Sum( Atr( 1 ),7),-1) / 7) *
Sqrt( 7 ) ),
Max((Ref(HIGH,-7)-LOW) / ( (Ref(Sum (Atr( 1 ),8),-1) / 8) * Sqrt(8) ),
(Ref(HIGH,-8)-LOW) /
( (Ref(Sum (Atr (1),9),-1) / 9) * Sqrt( 9 ) ) ) ) ) ) ) ) )
(Go Top)
Rate of Change Since a Specific Date
The following formula plots a percent rate of change between a specific
date and today. The user is prompted for the specific date.This will only
work in MetaStock™ for Windows 95/NT version 6.5 (or higher) or in
MetaStock Professional.
Construct the formula in the Indicator Builder, giving it the name shown
below in bold. All the text after "FORMULA:" and before "*END OF
FORMULA*" below should be placed in the Formula field in the Indicator
Builder. Once the indicator has been created, you can drag it out of the
Indicator Quicklist for placement in an inner-window of your chart.
FORMULA:
Day1 := Input("Day",1,31,4);
Month1 := Input("Month",1,12,1);
Year1 := Input("Year",1900,2400,1999);
Rule of 7 Up Objective
If((ROC(C,12,%)>1.5),If((ROC(C,12,%)>3),
If((ROC(C,12,%)>4.5),(((H-L)*1.75)+L),(((H-L)*2.33)+L)),(((H-L)*3.5)+L)),
((H-L)+L))
Rule of 7 Oscillator
Fml("Rule of 7 UP Objective") -
Fml("Rule of 7 DOWN Objective")
(Go Top)
Rainbow Charts
To create Rainbow Charts in MetaStock for Windows, open any chart, drop
the moving average indicator from the Indicator QuickList, and drop it in
the same inner windows as the price bars. Enter two for the Periods and
simple for the Method. Next plot a second moving average on the first
moving average by dragging a moving average from the QuickList and
dropping it on the first moving average (Note: The first moving average
should turn light purple before you release the mouse button). If you
dropped it correctly the Parameters dialog should say ‘Indicator’ for the
Price Field. Click OK to accept two periods and simple as the parameters.
Change the colour of this moving average as desired. Now plot a third
moving average of the second moving average by repeating these steps.
Continue this until you have ten moving averages. Choose Yes if
MetaStock prompts you about plotting a duplicate indicator.
To save you time, Equis have created a template that allows you to bypass
these steps. You can download this template directly off of the Equis web
site. Download this file to the Charts folder (e.g. C:\Program
Files\Equis\MetaStock\Charts) in your MetaStock folder. Open any chart
and then click on your right mouse button while the pointer is located on
the chart. Choose Apply Template from the Chart Shortcut menu and
choose the Rainbow Chart template. You should now have a chart with ten
different coloured moving averages.
Next choose Indicator Builder from the Tools menu and enter the following
formulas.
Rainbow Max
Max(Mov(C,2,S),
Max(Mov(Mov(C,2,S),2,S),
Max(Mov(Mov(Mov(C,2,S),2,S),2,S),
Max(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),
Max(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),
Max(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),
Max(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),
Max(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2
,S),2,S),
Max(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2
,S),2,S),2,S),2,S),
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2
,S),2,S),2,S),2,S)
,2,S))))))))))
Rainbow Min
Min(Mov(C,2,S),
Min(Mov(Mov(C,2,S),2,S),
Min(Mov(Mov(Mov(C,2,S),2,S),2,S),
Min(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),
Min(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),
Min(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),
Min(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),
Min(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,
S),2,S),
Min(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,
S),2,S),2,S),2,S),
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2
,S),2,S),2,S),2,S),
2,S))))))))))
Rainbow Oscillator
100 * (CLOSE - ((Mov(C,2,S)+
Mov(Mov(C,2,S),2,S)+
Mov(Mov(Mov(C,2,S),2,S),2,S) + Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S) +
Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S) +
Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S) +
Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S)+
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,
S)+
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2
,S),2,S),2,S)+
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2
,S),2,S),2,S),2,S)
,2,S)) /10))/(HHV(C,10)-LLV(C,10))
Plot the Rainbow Oscillator in a new inner window of your chart with the
ten moving averages, by dropping the custom indicator from the QuickList
onto the chart’s heading. Right click on the Rainbow Oscillator and choose
properties, then change the Style to a histogram. Now plot the Lower
Rainbow Band and the Upper Rainbow Band in the same inner window as
the Rainbow Oscillator. If the scaling dialog appears when plotting these
indicators, choose ‘Merge with Scale on Right.’ Change the colors of the
Upper and Lower Rainbow Bands as desired. Now save this as a new
template by choosing Save As from the File Menu and changing the File
Type to template, so you can easily apply it to any chart.
(Go Top)
Regress Slope/Money Flow Index/Time Series Forecast
A series of four trading systems, using the Regress Slope as basis and
combining with other indicators.
1. Regress Slope: 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(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
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
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
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)
RSI, sine-weighted smoothed
{ Smoothed RSI indicator v1.1 }{ Internal sine-weighted smoothing }
{ Automatic historically-valid RSI peak/trough boundaries}{ Boundary
crossover signals: +1=Long, -1=Short}{ ©Copyright 2004 Jose Silva }
{ josesilva22@yahoo.com }
{ user input }
pds:=1/Input("RSI periods",1,2520,10);
plot:=Input("plot: [1]-RSI, [2]-Long/Short signals",1,2,1);
{ RSI indicator }
dw:=If(dw=0,.000001,dw);
RS:=100-100/(1+up/dw);
pds1:=Input("RSI periods",2,252,21);
pds2:=Input("Stochastic periods",2,252,63);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);
plot:=Input("plot Stoch-RSI=1, RSI=2, both=3",1,3,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
Rs:=RSI(x,pds1);
{MetaStock versions earlier than v7.2, use:}
{Rs:=RSI(pds1);}
StochRsi:=(Rs-LLV(Rs,pds2))/
(HHV(Rs,pds2)-LLV(Rs,pds2)+.000001)*100;
If(plot=3,Rs,50);
If(plot=2,Rs,StochRsi)
(Go Top)
Random trade generator
{ Random trade generator v2.5 }{ ©Copyright 2001-2004 Jose Silva }
{ josesilva22@yahoo.com }
{Plot indicator in its own window below price chart & refresh screen to
generate new trades}
{Buy signal: +1, Sell signal: -1}{Smaller signals: secondary buy/sell
events}
{user input}
x:=Input("Frequency of random trades (0-100%)",
0,100,10);
seed:=Input("Randomizer seed = 1~1000000, none = 0",0,1000000,0)-
1;
{trade organizer}
Init:=Cum(Buy+Sell>-1)=1;
BuyInit:=Cum(Buy)=1;
flag:=BarsSince(Init OR Buy)
<BarsSince(Init OR Sell)+BuyInit;
signals:=(BuyInit AND Alert(BuyInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));
BuySm:=Buy AND signals<1;
SellSm:=Sell AND signals>-1;
{signals display}
0;(BuySm-SellSm)*.3;signals
Market Trade $ Profit test for four random strategies, as at Close Fri
23/01/2004.
Tested on 475 ASX All Ords stocks; Avg test period: 8.25 years of data
(2075 days); $10K starting capital for each stock; 1% Entry/Exit Slippage,
$34 brokerage each way.
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.
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)
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);
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);
From: Brooke
Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);
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.
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.
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. *}
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.
{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.*}
TSMA:= Mov(CLOSE,5,TIMESERIES);
ShiftedTSMA:= Ref(TSMA, -1) + 2;
ShiftedTSMA
(Go Top)
Signal Formulas
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
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
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
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
{place the formulas above in the filter section; nothing else is required}
(Go Top)
Sideways Channels Exploration
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)
Sine Weighted Moving Average
{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)
SIROC Indicator From Elder
ROC(Mov(C,13,E),21,%)
(Go Top)
Slope of a Linear Regression Line
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)
SPECIAL TRIX
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)
Stix Indicator
Mov((H+L)/2,5,S)-Mov((H+L)/2,35,S)
(Go Top)
Stochastic and RSI System
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)
Stochastic MA System
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)
Stochastic Momentum
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)
Stochastic Momentum Indicator
{Appeared in the January 1993 issue of Stocks & Commodities magazine}
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.
{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)
Stoch RSI
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)
Stop Loss Indicator
periodsshort:=Input("periods if short",1,50,10);
periodslong:=input("periods
if long",1,50,10);
{name: StTO}
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
STARC BAND Formula = (Mov(Typical(),5,S))
{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)
System Test Examples
from Glen Wallace
"Buy at the open plus half the average true range of the last ten days?"
"If these two moving averages cross today, buy on tomorrow's open."
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);
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)
Smoothing Techniques for More Accurate Signals
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.
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;
Stops
Inactivity Positions - Long and Short Method - Points Minimum Change -
15000 Periods - 10
After entering the formulas click OK, then click on Options. On the Testing
page set the Trade Delay to 0, set Positions to Both, then set any other
desired options Click OK to save the changes, then open a chart and run
the system.
(Go Top...)
Schaff Trend Cycle Oscillator
{ Schaff Trend Cycle Oscillator v1.0 }{ Automatic trigger levels }{ Also
see: "MACD oscillator - Schaff Trend Cycle" }{ josesilva22@yahoo.com }
{ With thanks to Tim Straiton, www.stoploss.ch }
{ variables input }
pdsCy:=Input("Schaff cycle periods",2,252,10);
pdsSh:=Input("Short periods",1,252,10);
pdsLg:=Input("Long periods",2,2520,21);
{ variables input }
buffer:=Input("Long/Short buffer zone %",
0,100,0)/100;
pdsCy:=Input("Schaff cycle periods",2,252,10);
pdsSh:=Input("Short periods",1,252,10);
pdsLg:=Input("Long periods",2,2520,21);
StDay:=Input("Start Day",1,31,1);
StMnth:=Input("start Month",1,12,10);
StYear:=Input("start Year",1960,2060,2003);
EnDay:=Input("End Day",1,31,31);
EnMnth:=Input("end Month",1,12,10);
EnYear:=Input("end Year",1960,2060,2003);
start:=Year()>StYear
OR (Year()=StYear AND (Month()>StMnth
OR Month()=StMnth AND DayOfMonth()>=StDay));
end:=Year()<EnYear
OR (Year()=EnYear AND (Month()<EnMnth
OR Month()=EnMnth AND DayOfMonth()<=EnDay));
period:=start AND end;
If(period,Cum(If(period,x,0)),0)
(Go Top...)
Siroc
{ Siroc v2.0 }{ System1: trigger crossovers }{ System2: auto over-
bought/sold crossovers }{ ©Copyright 2002-2004 Jose Silva }
{ josesilva22@yahoo.com }
prd1:=Input("first period",2,252,21);
prd2:=Input("second period",2,252,10);
prdCrs:=Input("crossover periods",2,252,5);
x:=Input("use Open=1 High=2 Low=3 Close=4 MP=5 P=6",1,6,5);
plot:=Input("[1]Siroc, [2]System1, [3]System3",1,3,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
Src:=Mov((x-Mov(x,prd1,E))
/Ref(Mov(x,prd1,E),-prd1),prd1,E);
prd2:=prd2*2-1;
y:=Src-Ref(Src,-1);
Siroc:=100-100/(1+If(Mov(
If(Src<Ref(Src,-1),-y,0),prd2,E)=0,1000000,
Mov(If(Src>Ref(Src,-1),y,0),prd2,E)
/(Mov(If(Src<Ref(Src,-1),-y,0),prd2,E)
+.000001)));
SirocAvg:=Cum(Siroc)/Cum(Siroc>-1);
{ System signals }
dTrigger:=Mov(Siroc,prdCrs,E);
System1:=
Cross(Siroc,dTrigger)-Cross(dTrigger,Siroc);
System2:=
Cross(Siroc,oSold)-Cross(Siroc,oBought);
signals:=If(plot=2,System1,System2);
If(plot=1,oBought,0);
If(plot=1,oSold,0);
If(plot=1,dTrigger,0);
If(plot=1,Siroc,signals)
Siroc II
prd1:=Input("first period",2,252,21);
prd2:=Input("second period",2,252,10);
prd3:=Input("crossover periods",2,252,5);
x:=Input("use Open=1 High=2 Low=3 Close=4 MP=5 P=6",1,6,5);
plot:=Input("[1]Siroc, [2]System1, [3]System3",1,3,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,MP(),If(x=6,P,C)))));
y:=Mov(x,prd1,E);
z:=Mov((x-y)/Ref(y,-prd1),prd2,E);
Siroc:=100
*Mov(If(z>Ref(z,-1),z-Ref(z,-1),0),prd3,E)
/(Mov(If(z>Ref(z,-1),z-Ref(z,-1),0),prd3,E)
+Mov(If(z<Ref(z,-1),Ref(z,-1)-z,0),prd3,E)
+.000001);
SirocAvg:=Cum(Siroc)/Cum(Siroc>-1);
{ System signals }
dTrigger:=Mov(Siroc,prd3,E);
System1:=
Cross(Siroc,dTrigger)-Cross(dTrigger,Siroc);
System2:=
Cross(Siroc,oSold)-Cross(Siroc,oBought);
signals:=If(plot=2,System1,System2);
If(plot=1,oBought,0);
If(plot=1,oSold,0);
If(plot=1,dTrigger,0);
If(plot=1,Siroc,signals)
(Go Top...)
Smart System design - Long
{ Simple combined Entry & Exit system }{ Plots +1 spike on entry, -1 on
exit signals }{ Warning: this trading system is a design example only - do
not trade! }{ ©Copyright 2003 Jose Silva }{ josesilva22@yahoo.com }
EntryCond1:=Cross(C,Mov(C,pds,E)*1.05);
EntryCond2:=Cross(C,Ref(HHV(C,pds),-1));
ExitCond1:=C<Mov(C,pds,E);
ExitCond2:=C<Ref(LLV(C,pds),-1);
ExitCond3:=C<HHV(C,pds)-ATR(pds)*2.5;
In:=En1 OR En2;
Out:=Ex1 OR Ex2 OR Ex3;
Init:=Cum(In+Out>-1)=1;
Flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+(Cum(In)=1);
Entry1:=Cross(C,Mov(C,pds,E)*1.05);
Entry2:=Cross(C,Ref(HHV(C,pds),-1));
Entry3:=Cross(C,HHV(C-2.5*ATR(pds),pds));
Entry4:=Cross(WillR(pds),-50);
Entry5:=Cross(CMF(pds),0);
En1:=If(En1,Entry1,0);
En2:=If(En2,Entry2,0);
En3:=If(En3,Entry3,0);
En4:=If(En4,Entry4,0);
En5:=If(En5,Entry5,0);
entry:=En1 OR En2 OR En3 OR En4 OR En5;
{*** system entry output section ***}
entry
Exit1:=C<Mov(C,pds,E);
Exit2:=C<Ref(LLV(C,pds),-1);
Exit3:=C<LLV(C+2.5*ATR(pds),pds);
Exit4:=WillR(pds)<-50;
Exit5:=CMF(pds)<0;
Ex1:=If(Ex1,Exit1,0);
Ex2:=If(Ex2,Exit2,0);
Ex3:=If(Ex3,Exit3,0);
Ex4:=If(Ex4,Exit4,0);
Ex5:=If(Ex5,Exit5,0);
exit:=-(Ex1 OR Ex2 OR Ex3 OR Ex4 OR Ex5);
exit
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=Ref(BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit,-delay);
In1:=Cum(Cum(In))=1;
Out1:=Cum(Cum(Out))=1;
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));
odd:=Cum(1)/2=Int(Cum(1)/2);
0;
Ref(If(plot=1,In1,0),-delay);
If(plot=1,-Ref(Out1 AND BarsSince(In1)
>=BarsSince(Out1),-delay),0);
If(plot=1,0,If(odd,flag,0));
If(plot=1,signals,flag)
TASC Trader's Tip: Volatility % Indicator (Dec '97)
You can easily create the Volatility% Indicator from William Brower’s article
in MetaStock for Windows. First choose Indicator Builder from the Tools
menu in MetaStock. Next choose New and enter one of the following
formulas:
Volatility%
There are really two different ways to use these formulas. Since the Binary
Wave is a smoothed addition of several technical indicators that each give
+1 when bullish, 0 when neutral and -1 when negative, it makes sense
that a positive number is bullish
and rising numbers are bullish. Similarly negative numbers and falling
numbers are bearish.
The QStick is really a candlestick type indicator, but can be read as bullish
or bearish in same way as the Binary Wave.
The two traditional ways to play them are to buy on a rise from a negative
peak and sell on a fall from a positive peak, or to buy on a zero cross over
to the upside and sell on a zero crossover to the downside. Of course you
can optimize and find various buy and sell levels as long as you
understand what is bearish and what is bullish.
colA CLOSE
colB ref(C,-1)
colC ref(C,-2)
filter colA > colB AND colB > colC
.or.
VOLAInd :=Mov(ATR(21),1,W)*3;
If(C>Ref(C,-21) AND C>VOLAInd, HHV(H,21)-Ref(VOLAInd,-1),
Ref(VOLAInd,-1)+LLV(L,21))
{CHANGE BAR COLORS: double click on the price plot in the chart, from
the Color/Style page click the UP drop-list and choose darkblue for
upwards, and red for downward price changes}
(Go Top)
Trading the Trend 2
Trading the Trend (TTT) -- by Andrew Abraham, TASC Magazine 9/1998,
was about one form of stoploss exit: subtract some manipulation of the
true range from the highest high (or add it to the lowest low) and exit
when the close crosses that. (Members of Chuck LeBeau's Traders Club will
recognise the "Chandelier Exit".)
THE CHANDELIER EXIT: The exit stop is placed at a multiple of average
true ranges from the highest high or highest close since the entry of the
trade. As the highs get higher the stop moves up but it never moves
downward.
THE YO YO EXIT: This exit is very similar to the Chandelier Exit except that
the ATR stop is always pegged to the most recent close instead of the
highest high. Since the closes move higher and lower, the stop also moves
up and down (hence the Yo Yo name).
Pds:=21;
Mult:=3;
TruRan:=Mov(ATR(1),Pds,W)*Mult;
HiLimit:=HHV(H,Pds)-TruRan;
LoLimit:=LLV(L,Pds)+TruRan;
If(C>HiLimit,HiLimit,LoLimit)
1. After closing the Indicator Builder click on the Expert Advisor (the
guy in the bowler/derby hat).
2. Click on New, then the Name tab, type in Trading the Trend.
3. Click on the Highlights tab, select the first line so that it is
highlighted, click Edit, type in the name Uptrend, select Colour Blue, select
Condition, type in C>FmlVar("Trading the Trend","HiLimit"), and click OK,
4. Still on the Highlights tab, select the second line, click Edit, type
in the name Downtrend, select Color Red, select Condition, type in
C<=FmlVar("Trading the Trend","HiLimit"), click OK, and then click OK
again.
5. If you have a chart open that you want to use this on, click
Attach, otherwise click Close. In the latter case, when you open a chart
and plot the trendline, click on the Expert Advisor, select Trading the
Trend, and click on Attach.
I've given the Expert steps in detail for any who may not be familiar with
its use. To experiment with variations in the lookback periods and the
multiplier you can do so in either the Indicator Builder, or right-click the
indicator on the chart, select Properties, then the Formula tab, and make
the changes (e.g. try a lookback period of 10, and a multiplier of 2.5). As
implemented above, the Expert should change accordingly. This shows the
trade-offs that have to be made
between near and distant stops. This is too rudimentary to be traded as a
system - the whipsaws would chop you to pieces - but the exits should
help to limit drawdowns.
A very similar stoploss is given in Chande & Kroll "The New Technical
Trader", pp.167 - 169, "Volatility-Based Trailing Stops". My preference is to
plot both the high and the low exit lines in contrasting colours, dispensing
with the switch between them, and dispensing with the Expert. If anyone
wants help with the code, just say so.
Assuming you entered everything exactly in both the Indicator Builder and
the Expert Advisor, one question comes to mind. Did you decide to adapt
the formula to MS v.6.5 and use an Input function for Pds and Mult? It
seems like a logical thing to do, and in fact I coded it that way at first. The
problem is that the Expert Advisor always reverts to the default value (the
System Tester does the same thing).
Pds:=Input("Lookback Periods?",1,1000,20)
and then when you applied it you changed the periods to 15, the Expert
Advisor will still read 20. I hard-coded the Pds and Mult parameters for that
reason.
(Go Top)
Trailing Stop Loss Indicator
If(cum(1)=1,
{then} Close,
{else} If((C*1.1) <= PREV,
{then}(C*1.1),
{else} PREV));
{TOSC}
Lb:=Input("Look-Back Period?",3,100,21);
Ty:=Input("1=C 2=H 3=L 4= Median Price",1,4,1);
Tv:=If(Ty=1,C,If(Ty=2,H,If(Ty=3,L,MP())));
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,Tv,PREV))+Tv;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,Tv,PREV))+
(Alpha*(Tv+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(Tv,lb,E);
TOSC;
{NOTE: this code will work slowly because of all of the "PREV" functions.
from Adam Hefner.}
ACol:= C;
BCol:= Ref(HHV(H,59), -1);
CCol:= HHV(H,60);
SSDPBOS:= (ACol>BCol) AND (Ref(C,-1)<BCol) AND
(H=CCol);
SSDPBOS
(Go Top)
Trending Bandini
Mov(C,2,S)>
Mov(Mov(C,2,S),2,S) AND
Mov(Mov(C,2,S),2,S)>
Mov(Mov(Mov(C,2,S),2,S),2,S) AND
Mov(Mov(Mov(C,2,S),2,S),2,S)>
Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S) AND
Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S)>
Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S) AND
Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S)>
Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S) AND
Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S)>
Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S) AND
Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S)>
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,
S) AND
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2,S),2,
S)>
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2
,S),2,S),2,S) AND
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2,S),2
,S),2,S),2,S)>
Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(Mov(C,2,S),2,S),2,S),2,S),2,S),2
,S),2,S),2,S),2,S),2,S)
(Go Top)
True Range Formula
TR = (H - L + Abs(H - Ref(C,-1)) + Abs(L - Ref(C,-1)) )/2
(Go Top)
True Strength Index
{Appeared in the January 1993 issue of Stocks & Commodities magazine}
Close long:
Cross(((CLOSE-Ref(TSF(C,opt3),-1))/CLOSE*100),opt2)
Enter short:
Cross(((CLOSE-Ref(TSF(C,opt3),-1))/CLOSE*100),opt2)
Close short:
Cross(opt1,((CLOSE-Ref(TSF(C,opt3),-1))/CLOSE*100))
{I use this for futures and the above parameters (optimized settings) keep
it in the ballpark. If you are applying it to equities (or commodities), it
always makes sense to look at the indicator and understand the outside
parameters for each of its "steps". It makes no sense to limit your outside
limits to -2 and +2 if the TSF oscillates between -8 and +8. So do a little
homework on the "outside" limits of the indicator and then optimize
accordingly. from Steve Karnish.}
(Go Top)
TSI and TSI Moving Average
100*(Mov(Mov(Roc(C,1,$),25,E),13,E)/Mov(Mov(Abs(Roc(c,1,$)),25,E),13,E)
)
Mov(Fml("TSI"),20,E)
(Go Top)
The New Advance Decline Line
The formulas and steps necessary to do the New Advance -Decline Line
from the September 1994 Technical Analysis of Stocks & Commodities,
page 14 by Daniel Downing are:
Taken from Stocks & Commodities, V. 12:9 (363-365): A New Advance-
Decline Line by Daniel E. Downing
"Here's a trading tool that uses a unique version of the daily advance-
decline line of the New York Stock Exchange (NYSE). This version helps in
our short- and long-term trading of index options and stock index futures.
It gives many good short-term trading signals and excellent but infrequent
longer-term signals…
The philosophy behind this tool is that the short-term trader's capital is
finite and that traders have to reliquify their holdings after a period.
Traders can buy and try to push the equities higher only so many times
before they need to reliquify, just as only a finite amount of selling waves
can take place before the sellers are out of supplies. A tool that points to
when short-term traders need to reliquify their positions will also spot
when the markets will soon reverse their trends."
For the Windows versions of MetaStock:
• Load the advances
• Load the declines
• Drag the plot of the advances into the chart of the declines
• Plot the following custom formula directly on the plot of
advances.
Cum( If( P ,>= ,1000 ,If(C ,< ,1000 , + 1 ,0 ) ,If( C ,>= ,1000 ,-1 ,0 ) ) )
(Go Top)
Tick Line Momentum Oscillator
In his article "Using The Tick In A Short-Term Indicator", in the January 94
issue of TASC, Daniel E. Downing presents the Tick Line Momentum
Oscillator.
Taken from Stocks & Commodities, V. 12:1 (42-44): Using The Tick In A
Short-Term Indicator by Daniel E. Downing
"The tick index, the net difference of the numbers of stocks last traded on
an uptick from those last traded on a downtick , is a well-known indicator,
but it's got a problem. The raw number result is volatile, perhaps too
volatile for some. What to do? here, then, is a way to smooth out the noise
to identify short-term trading opportunities.
The tick is a basic unit for the markets, watched with fascination during
periods of turmoil and periods of enthusiasm. It is quoted throughout the
day on most quote services. In addition, the closing tick value can be
found on the market statistics pages of financial newspapers such as
Barron's and The Wall Street Journal. Let me present, then, the tick line
momentum oscillator, which is based on the closing value for the New York
Stock Exchange (NYSE) tick indicator. The oscillator has been shown to
have a good track record of determining when the NYSE is overbought or
oversold on a short-term basis. The formula for the tick line momentum
oscillator is simple and can be easily calculated without a computer,
although a spreadsheet version can be found in the sidebar, "Tick line
momentum." Finally, the oscillator is straightforward and simple to apply."
The MetaStock formula for the Tick Line Momentum Oscillator is:
Mov( ROC( Cum( If( C ,> ,Ref( Mov(C ,10 ,E ) ,-1 ) ,+1 ,If( C ,<
,Ref( Mov( C ,10 ,E ) ,-1 ) ,- 1 ,0 ) ) ) ,5 ,$ ) ,5 ,E )
(Go Top)
Trading Channel Index
The Trading Channel Index comes from an early version of AIQ's Stock
Expert program. "The Trading Channel Index measures the location of
average daily price relative to a smoothed average of average daily price.
It is derived from the average difference between these two values."
To create the Trading Channel Index in MetaStock create the following
custom formula's:
AP+: Average price
(H+L+C)/3
ESA+: Smoothed price average
Mov( Fml( "AP+" ) ,10 ,E ) + ( Mov( Ref( Fml( "AP+" ) ,-1 ) ,10 ,E ) )
D+: Price range estimate
Mov( ( Fml( "AP+" ) - Fml( "ESA+" ) ) ,10 ,E ) + ( Mov( Ref( Fml( "AP+" ) -
Fml( "ESA+" ) ,-1 ) ,10 ,E ) )
CI+: Channel index
( ( Fml( "AP+" ) - Fml( "ESA+" ) ) / ( 0.015 * Fml( "D+" ) ) )
TRADING CHANEL INDEX:
Mov( Fml( "CI+" ) ,21 ,E ) + ( Mov( Ref( Fml( "CI+" ) ,-1 ) ,21 ,E ) )
(Go Top)
Trendline Formula
Trough(1,L,10)+((((Trough(1,L,10)-Trough(2,L,10))/(TroughBars(2,L,10)-
TroughBars(1,L,10)))
*TroughBars(1,L,10)))
This formula will draw a trendline from the most recent bottom.
The L (low) can be changed to C (close) and the 10 can be changed to a
different percent value.
You will also need to change the line style to the last one in thedrop down
list.
(Go Top)
Tushar Chande's Target Price
A:=Mov(Abs(C-Ref(C,-1)),10,S);
TPH1:=C+A;
TPH2:=C+(2*A);
TPL1:=C-A;
TPL2:=C-(2*A);
TPH1;
TPH2;
TPL1;
TPL2;
(Go Top)
Tushar Chande's Vidya with Volatility Bands
K:=Stdev(C,5)/Mov(Stdev(C,5),20,S);
SC:=0.9;
Vidya:=SC*K*C+(1-SC*K)*Ref(C,-1);
UpperBand:=Vidya+2*.5*K;
LowerBand:=Vidya-2*.5*K;
UpperBand;
LowerBand;
Vidya;
(Go Top)
Trailing Stop - Elder's SafeZone
{ Dr Alexander Elder's SafeZone trailing stop v2 }{ Triggers: Long (+1) &
Short (-1) signals at crossover of user-defined trailing stops }{ ©Copyright
2003 Jose Silva }{ josesilva22@yahoo.com }
coefficient:=Input("SafeZone coefficient",
0,10,2.5);
bkpds:=Input("Lookback periods",1,252,10);
pds:=Input("Trend EMA periods",2,252,21);
adv:=Input("plot: today's SafeZone=0, tomorrow's stop=1",0,1,0);
plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1);
delay:=Input("Entry and Exit signal delay",
0,5,0);
DwSidePen:=Mov(C,pds,E)>Ref(Mov(C,pds,E),-1)
AND L<Ref(L,-1);
DwSideDiff:=If(DwSidePen,Ref(L,-1)-L,0);
DwPenAvg:=Sum(DwSideDiff,bkpds)
/(Sum(DwSidePen,bkpds)+.000001);
StLong:=Ref(L-DwPenAvg*coefficient,-1);
StopLong:=If(C<PREV,StLong,Max(StLong,PREV));
UpSidePen:=Mov(C,pds,E)<Ref(Mov(C,pds,E),-1)
AND H>Ref(H,-1);
UpSideDiff:=If(UpSidePen,H-Ref(H,-1),0);
UpPenAvg:=Sum(UpSideDiff,bkpds)
/(Sum(UpSidePen,bkpds)+.000001);
StShort:=Ref(H+UpPenAvg*coefficient,-1);
StopShort:=If(C>PREV,StShort,Min(StShort,PREV));
In:=Cross(C,Ref(StopShort,-1));
Out:=Cross(Ref(StopLong,-1),C);
flag:=BarsSince(Cum(In+Out>-1)=1 OR In)
< BarsSince(Cum(In+Out>-1)=1 OR Out)
+(Cum(In)=1);
signals:=Ref((Cum(In)=1
AND Alert((Cum(In)=1)=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
If(plot=1,Ref(If(flag=1,stopLong,stopShort),
-1+adv),If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,Ref(If(flag=1,stopLong,stopShort),
-1+adv),If(plot=2,Ref(stopShort,-1+adv),
signals))
(Go Top)
Trailing Stop - MetaStock
{ Triggers: Long (+1) & Short (-1) signals at crossover of user-defined
trailing stops }{ x23 slower than TradeSim's version }{ ©Copyright 2003-
2004 Jose Silva }{ josesilva22@yahoo.com }
buffer:=Input("buffer % trailing stop",0,100,8);
plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1);
adv:=Input("plot: today's trailing stop=0, tomorrow's stop=1",0,1,0);
delay:=Input("Entry and Exit signal delay",
0,5,0);
StLong:=C-C*buffer/100;
StShort:=C+C*buffer/100;
stopLong:=If(C<PREV,StLong,Max(StLong,PREV));
stopShort:=If(C>PREV,StShort,Min(StShort,PREV));
In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit;
signals:=Ref((InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
stop:=Ref(If(flag=1,stopLong,stopShort),-1+adv);
If(plot=1,stop,
If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,stop,
If(plot=2,Ref(stopShort,-1+adv),signals))
Volatility:=C*buffer/100;
stopLong:=ExtFml("TradeSim.TrailingStop",
BAND, {mode: band or trigger}
LONG, {long or short}
Volatility, {user defined see variable above}
CLOSE, {RefPoint for stop calc}
CLOSE); {threshold - stop breached}
stopShort:=ExtFml("TradeSim.TrailingStop",
BAND,SHORT,Volatility,C,C);
In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit;
signals:=Ref((InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
stop:=Ref(If(flag=1,stopLong,stopShort),-1+adv);
If(plot=1,stop,
If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,stop,
If(plot=2,Ref(stopShort,-1+adv),signals))
{ Plot on price chart }{ Triggers: Long (+1) & Short (-1) signals at
crossover of user-defined trailing stops }{ Much faster than MetaStock's 4-
PREV version }{ ©Copyright 2004 Jose Silva }{ josesilva22@yahoo.com }
buffer1:=
Input("initial stop % buffer",0,100,5)/100;
buffer2:=
Input("trailing stop % buffer",0,100,8)/100;
plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1);
adv:=Input("plot: today's trailing stop=0, tomorrow's stop=1",0,1,0);
delay:=Input("Entry and Exit signal delay",
0,5,0);
entrySignal:=C=C;
initialStopLong:=C*(1-buffer1);
trailStopLong:=C*(1-buffer2);
stopLong:=ExtFml("AdvancedStop.StopLong",
entrySignal,initialStopLong,0,trailStopLong,
0,0,0,0);
exitSignal:=Cross(stopLong,C);
initialStopShort:=C*(1+buffer1);
trailStopShort:=C*(1+buffer2);
stopShort:=ExtFml("AdvancedStop.StopShort",
exitSignal,initialStopShort,0,trailStopShort,
0,0,0,0);
entrySignal:=Cross(C,stopShort);
stopLong:=ExtFml("AdvancedStop.StopLong",
entrySignal,initialStopLong,0,trailStopLong,
0,0,0,0);
In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
Init:=Cum(In+Out>-1)=1;
flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+(Cum(In)=1);
signals:=Ref(((Cum(In)=1)
AND Alert((Cum(In)=1)=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
stop:=Ref(If(flag=1,stopLong,stopShort),-1+adv);
If(plot=1,stop,
If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,stop,
If(plot=2,Ref(stopShort,-1+adv),signals))
(Go Top)
Trendline - adjustable
{ ©Copyright 2003 Jose Silva }{ josesilva22@yahoo.com }
pds:=
Input("average trend length periods",2,252,21);
pr:=Input("Open=1 High=2 Low=3 Close=4 Vol=5 MP=6, P=7",1,7,4);
display:=Input("plot Trend line = 1, Trend points = 2",1,2,1);
{define events}
pr:=If(pr=1,O,If(pr=2,H,If(pr=3,L,If(pr=5,V,
If(pr=6,MP(),If(pr=7,P,C))))));
price1:=pr;
price2:=pr;
time1:=price1>Ref(HHV(price1,pds),-1);
time2:=price2<Ref(LLV(price2,pds),-1);
{sort events}
t1pds:=LastValue(BarsSince(time1));
t2pds:=LastValue(BarsSince(time2));
x1:=If(t1pds>=t2pds,time1,time2);
x2:=If(t1pds>=t2pds,time2,time1);
y1:=If(t1pds>=t2pds,price1,price2);
y2:=If(t1pds>=t2pds,price2,price1);
{fix coordinates}
y1:=ValueWhen(1,x1,y1);
y2:=LastValue(ValueWhen(1,x2,y2));
b1:=LastValue(BarsSince(x1));
b2:=LastValue(BarsSince(x2));
plot:=y1+BarsSince(x1)*(y2-y1)/(b1-b2);
If(display=1,plot,time1+time2)
Up 20% on Double Average Volume
Col A: CLOSE
Col B:ROC(C,5,%)
Periodicity Daily
Equis put this function in for me. It uses VHF rather than CMO. Unlike the
present version, this is better.
(Go Top)
Vidya 21, 5
This is the MetaStock code for VIDYA 21,5 which applies to the article
"Breaking Out Of Price Channels" by Gerald Marisch in the TASC January
1998 edition.
Length:=Input("Length",1,200,21);
Smooth:=Input("Smoothing",1,200,5);
AbsCMO:=(Abs(CMO(C,Length)))/100;
SC:=2/(Smooth+1);
VIDYA:=If(Cum(1)<=(Length+1),C,(SC*AbsCMO*CLOSE)+(1-
(SC*AbsCMO))*PREV);
VIDYA
(Go Top)
Vidya with P variable, version II
My version of Tushar Chande's Vidya, using the P variable
Vidya{P}
Periods:=Input("length of MA",5,100,20);
K:=Stdev(P,5)/Mov(Stdev(P,5),20,S);
A:=(2/(Periods+1));
Vidya:=A*K*(P)+(1-A*K)*Ref(P,-1);
Vidya;
Tar(SZ)an Long
C-(((462*Mov(C,34,E))-(420*Mov(C,13,E))+(490*(Mov(Mov(C,13,E)-
Mov(C,34,E),89,E))))/42)
Tar(SZ)an Short
(C-(((325*Mov(C,26,E))-(297*Mov(C,12,E))+(351*Mov(Mov(C,13,E)-
Mov(C,26,E),9,E))))/28)*2
(Go Top)
Vidya Explanation
Vidya is a subject that comes up with some regularity. It's actually
available in MetaStock as the Variable Moving Average (Mov(C,n,V) but
Equis, for their own inscrutable reasons, choose not to identify it by name.
If you refer to the MetaStock manual, be aware that there is a typo in the
formula (0.078 should read 0.78). Two or three years ago I coded the
version given in TAS&C and it overlaid the MetaStock version precisely,
except that at the time the MetaStock version was not correctly initialised
-- this has since been corrected. Equis acknowledged the typo at the time,
but have done nothing about it.
As far as the 'circular reference' is concerned, you are right that eventually
you run out of data. However adding a portion of yesterday's value to a
portion of today's value is common to several indicators, such as the
Exponential Moving Average. If no provision is made, then usually the
indicator will start with a value of zero, rise rapidly at first, then take some
time to stabilise.
One answer is to initialise it. For a Vidya of the close, period N, you can
initialise with something like "If(Cum(1) < N, C,{else} ...)" with the Vidya
formula as the 'else'. Then at day N the indicator uses the (N-1) close for
yesterday's data and takes much less time to stabilise.
(Go Top)
Vidya using P variable, version I
Here is a version of Vidya using a P variable that matches MetaStock's
built-in Variable Moving Average. You can overlay them in different colours
on the same chart to satisfy yourself that they are indeed the same (but
remember to use the same number of periods). There is a small difference
at the start due to different initialisation, after which they are identical.
The coding is spelled out for the benefit of anyone studying the book. It
can be adapted by adding a variable input for the CMO length (9), or made
universal by replacing each C with a P, or the Abs(CMOsc) can be replaced
with a different volatility index that ranges between 0 and 1.
{Vidya (Chande)}
k:= Abs(CMOsc);
In this article the author gives formulas for three indicators MetaStock. The
formulas as given will work in all versions of MetaStock. However, there is
an error in the formula the author names Volatility 12 EMA. The formula
should be: Mov((Fml("CONHV4") + Fml("CONHV6") +
Fml("CONHV10"))/3,12,e)
Here are formulas for version 6.5 and higher of MetaStock for Windows.
These formulas use Inputs which allow you to select the time periods when
you plot the formulas.
David Landry Historical Volatility
Num:=Input("Number Of Periods For Numerator",1,100,4);
Den:=Input("Number Of Periods For Denominator",2,1000,100);
(Log(C/Ref(C,-1)),Num)/Std(Log(C/Ref(C,-1)),Den)
Note: Standard deviation information was not included here because the
way these formulas are being used, any standard deviation being used
would return an identical value as 1 standard deviation.
(Go Top)
Volatility Bands as a Long Term Strategy
This article "Volatility Bands As A Long Term Strategy", by Ahmet Tezel,
Ph.D., and Suzan Koknar-Tezel, M.S., which appears in this issue introduces
two different volatility band trading systems. One system uses bands
based on moving averages and the other is based on bands which use
regression. To plot the Moving Average Asymmetric Volatility Price Bands
in MetaStock for Windows, simply plot Bollinger Bands using 11 periods
and 1.7 standard deviations. Then click your right-mouse button while the
cursor is over the lower band and choose properties. Change the standard
deviations to 2. This plot will now appear exactly as the bands discussed in
the article.
To plot the Regression Asymmetric Volatility Price Bands in Metastock for
Windows, simply plot Standard Error Bands using 21 periods, 1 for
standard errors, and 1 for the smoothing periods. Then click your right-
mouse button while the cursor is over the lower band and choose
properties. Change the standard errors to 1.5.
To recreate the systems in MetaStock for Windows, choose System Tester
from the Tools menu. Next choose New and enter the following trading
rules and stop conditions. After entering this information, choose Options
and change the trade delay to 1, then change the Trade Price to Open. If
you have MetaStock 6.5 enter the first set of formulas. MetaStock 6.5
allows variables which will allow you to change the periods when testing
much more easily.
(Go Top)
Volatility Over 16 Weeks
Col A: CLOSE
Col B: Vol(10,80)
Filter: Vol(10,80)>200
2. Stocks where the above situation hasn't occurred during the previous 60
days.
ColB = ref(barssince(V>10*ref(V,-1)),-1)
SimpleX LONG:
SimpleX SHORT:
Rig this up with an OB/OS oscillator and you've got an entry that is, well,
at least worth considering.
(Go Top)
Weekly Indicators
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
e-mail, 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.
{start week}
sw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
yestClo:=If(sw>0,Ref(C,-1),0);
((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;
{start week}
sw:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
yestClo:=If(sw>0,Ref(C,-1),0);
(ValueWhen(1,sw>0,LLow)+
ValueWhen(2,sw>0,LLow)+
ValueWhen(3,sw>0,LLow)))*100;
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
{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:=(PP-S1)+R1;
{Support 2}
S2:=PP-(R1-S1);
R2;
R1;
S1;
S2;
(Go Top)
Weekly Trix Moving Average Test
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
Mov(PDI(14)-MDI(14),20,S)
OPEN LONG:
close>hhv(low,21)
CLOSE LONG:
close<llv(high,21)
(Go Top)
Writing Metastock Explorations
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 drop-down menu.
2. You will be presented with the Explorer screen showing a list of ready-
made 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 ready-made 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)
WRO and WSO Indicators
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 E-mail 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))
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
self-contained. 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 end-of-day data and
real-time data using MetaStock Professional Version 6.51.
(Go Top)
Weekly High Low Wave
if(H,>,ref(hhv(H,40),-1),1, if(L,<,ref(llv(L,40),-1), -1,0))
(Go Top)
Weekly Oscillator Segment
mov(oscp(43,86,S,%),43,S)
(Go Top)
Weekly Price Oscillator
mov(oscp(10,20,S,%),10,S)
(Go Top)
Wilder's Volatility
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:
1. The distance from today's high to today's low
2. The distance from yesterday's close to today's high, or
3. 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)
Zero Lag EMA
Here's my Metastock 6.2 coded version of the Zero Lag Moving Average,
as described in the April, 2000, issue of Technical Analysis of Stocks and
Commodities. I've also used it to construct a Zero Lag MACD and a Zero
Lag MACD trigger signal.
EMA1:= Mov(CLOSE,13,E);
EMA2:= Mov(EMA1,13,E);
Difference:= EMA1 - EMA2;
ZeroLagEMA13:= EMA1 + Difference;
EMA1:= Mov(CLOSE,21,E);
EMA2:= Mov(EMA1,21,E);
Difference:= EMA1 - EMA2;
ZeroLagEMA21:= EMA1 + Difference;
ZeroLagMACD:=ZeroLagEMA13 - ZeroLagEMA21;
EMA1:= Mov(ZeroLagMACD,8,E);
EMA2:= Mov(EMA1,8,E);
Difference:= EMA1 - EMA2;
ZeroLagTRIG:= EMA1 + Difference;
ZeroLagTRIG
(Go Top)
Zig Zag Validity
perc:=Input("Percent",2,100,10);
Z:=Zig(C,perc,%);
last:=ValueWhen(1,
( Z > Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2) )
OR
( Z < Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2) ),
Ref(Z,-1));
pc:=(C-last) * 100 / last;
pc:= Abs(pc);
SD:=(z>Ref(z,-1) AND Ref(z,-1)>Ref(z,-2)) OR (z<Ref(z,-1) AND
Ref(z,-1)<Ref(z,-2));
res:=If(pc>=perc ,1,0);
If(Alert(res,2) AND SD,1,res);
(Go Top)
Zigzag Validity Indicator
Spyros Raftopoulos
1=valid last leg of zig,
-1=invalid last leg of zig.
DO NOT use this indicator in systems}
perc:=Input("Percent",0.2,100,10);
Z:=Zig(C,perc,%);
last:=ValueWhen(1,
( Z > Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2) )
OR
( Z < Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2) ),
Ref(Z,-1));
pc:=(C-last) * 100 / last;
pc:= Abs(pc);
SD:=(z>Ref(z,-1) AND Ref(z,-1)>Ref(z,-2)) OR (z<Ref(z,-1) AND
Ref(z,-1)<Ref(z,-2));
res:=If(pc>=perc ,1,0);
res:= If(Alert(res,2) AND SD,1,res);
res
(Go Top)
ZigZag - Hi/Lo
{ High/Low ZigZag v1.0 }{ Plot on price chart }{ ©Copyright 2004 Jose
Silva }{ josesilva22@yahoo.com }
pk:=PeakBars(1,H,pr)=0;
tr:=TroughBars(1,L,pr)=0;
pktr:=pk-tr;
zz:=Zig(C,pr,%);
zzHi:=Zig(H,pr,%);
zzLo:=Zig(L,pr,%);
avg:=(zzHi+zzLo)/2;
x:=
If(pk,zzHi,If(tr,zzLo,If(avg>Ref(avg,-1),H,L)));
zzHiLo:=Zig(x,pr,%);
If(choose=1,zzHiLo,If(choose=2,zz,pktr))
Google Rank
Popular Posts
CNX Bank Nifty - NSE Futures chart and performance : June 2013 to August
2013 using Metastock "SURE" indicator.
As we approach September start... I can say that Bank Nifty has delivered
"single trade" best performance over last four years. ...
Five uses of the RSI in analyzing Equity/commodity charts
In Mr. Wilder’s book-" New Concepts in Technical Trading Systems" , he
discusses five uses of the RSI in analyzing commodity c...
How to interpret futures price and open interest
By Sahaj Agrawal, AVP- Derivatives, Kotak Securities Every investment
that we make- as players or as investors, is made on solid reason...