sqrt(((buyp()/sellp())/rsi(2))) > ref(((buyp()/sellp())/rsi(2)),-1)
(Go
Top) |
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) |
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) |
Chaikin's Money Flow is a built-in MetaStock indicator, as
follows: cmf(periods)
Persistence of Money Flow (PMF%)
Pds1:= Input("CMF Periods?",1,100,21);
Pds2:= Input("PMF Periods?",10,1000,120);
Sum((cmf(Pds1)>0),Pds2)/(Pds2/100)
{from HHP}
Persistence or (PMF%) is the percentage of days over 6 months
that the Chaikin Money Flow Oscillator is above 0. The Chaikin
Money Flow Oscillator formula default uses a 21 day money flow
sum divided by the 21 day sum of daily volume. HHP sent the
correct indicator formula for persistence, tho you can modify it
by selecting 1 for "Pds1" if you prefer to create a 120 day
cumulative money flow indicator to do what you are suggesting.
The cumulative money flow indicator often uses a 90SMA trigger.
(Go
Top) |
Mov(If(C > Ref(C,-9), Sqr( Pwr( ROC(C,9,$),2) + Pwr(10,2))
/ Sum( Sqr( Pwr( ROC(C,1,$),2) +1), 9),-Sqr( Pwr(ROC(C,9,$),2) +
Pwr( 10,2))
/ Sum(Sqr(Pwr(ROC(C,1,$),2)+1),9)) * 100,5,E)
I use a 80, -80 trendline. I have stuck it in different things
at different times. Right now I have it crossing -80 with MACD
4, 35,5, crossing, RSI(9) up one day, and selling pressure down
one day.
(Go
Top) |
I want an indicator that will project an exponential moving
average into the next period (i.e., draw tomorrow's line). It
would be really spiffy if I could pl ug in tomorrow
estimated/projected close and be able to adjust the indicator
based on various projected closes.
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) |
(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) |
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) |
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) |
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) |
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 my updated version of Tushar Chande's Vidya
Vidya:
K:=Stdev(P,5)/Mov(Stdev(P,5),20,S);
SC:=Input("SC",.1,.9,.1);
Vidya:=SC*K*P+(1-SC*K)*Ref(P,-1);
Vidya;
{the sc input is more responsive if you use a higher number}
This is 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;
This is 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;
This is ATR Ratio to Close:
ATRR:= ATR(5)/C;
MATRR:=Mov(ATRR,3,E);
ATRR;
MATRR;
This is a CMO Composite Average:
(((CMO(C,5))+(CMO(C,10))+(CMO(C,20)))/3)
This is CMO 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;
This is Rule of 7 down objective:
If((ROC(C,12,%)>-1.5),If((ROC(C,12,%)>-3),
If((ROC(C,12,%)>-4.5),((H-(H-L)*1.75)),((H-(H-L)*2.33))),((H-(H-L)*3.5))),(H-(H-L)))
This is 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))
This is rule of 7 Osc:
Fml("Rule of 7 UP Objective") -
Fml("Rule of 7 DOWN Objective")
This is %f Osc:
100*((C-Ref(TSF(C,5),-1))/C)
This is 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)
This is McGinley Dynamic:
Ref(Mov(C,12,E),-1)+((C-(Ref(Mov(C,12,E),-1))) /
(C/(Ref(Mov(C,12,E),-1))*125))
This is Morris Double Momentum Osc:
Mov(((ROC(C,12.8,%))+(ROC(C,19.2,%))),10,W)
This is Volatility%:
Lookback := Input("Time Periods",1,1000,50);
HighVolatility := Input("High Volatility %",.01,100,3);
100 * Sum(100 * ATR(1)/CLOSE > HighVolatility,
Lookback)/Lookback
This is Positive Volume Indicator:
Cum(If(V>Ref(V,-1),ROC(C,1,%),0))
This is negative volume indicator:
Cum(If(V<Ref(V,-1),ROC(C,1,%),0))
(Go
Top) |
(oscp(1,30,E,%))
(Go
Top) |
To plot Alpha and Beta in MetaStock follow
the steps below. **The custom indicator named Beta is required
to plot Alpha.
In the Windows versions of
MetaStock:
To plot Alpha:
-
Create the custom formulas Alpha and Beta
(see below for formula syntax).
-
Open a chart of the desired security.
-
Drag the price plot of the index you are
comparing, into the chart of the security and close the
chart of the index. **Maximize the security chart if needed.
-
Drag the custom indicator Alpha from the
Quick List and drop it onto the price plot of the index.
**The index plot will turn a purplish color when you are
plotting on top of it.
**Note, this formula is set to calculate
Alpha over 21 periods. To change the time periods replace each
instance of 21 in the formula with the desired number of periods
and also change the time periods in the Beta custom indicator.
( Sum( ROC( CLOSE ,1 ,% ) ,21 ) - ( Fml(
"Beta" ) * Sum( ROC( INDICATOR,1,%) ,21 ) ) ) / 21
To plot Beta:
-
Open a chart of the desired security.
-
Drag the price plot of the index your
comparing, into the chart of the security.
-
Drag this custom indicator from the Quick
List and drop it onto the price plot of the index.
Note, this formula is set to calculate beta
over 21 periods. To change the time periods replace each
instance of 21 in the formula with the desired number of
periods.
( ( 21 * Sum( ROC( CLOSE ,1 ,% ) * ROC(
INDICATOR ,1 ,% ) ,21 ) ) -
( Sum( ROC( CLOSE ,1 ,% ) ,21) * Sum( ROC(
INDICATOR ,1 ,% ) ,21 ) ) ) /
( (21 * Sum( Pwr( ROC( INDICATOR ,1 ,% ) ,2 )
,21 )) - Pwr( Sum( ROC( INDICATOR ,1 ,% ) ,21 ) ,2 ))
**Beta is a measure of volatility of one
security against another. This is typically used to measure the
volatility of a stock against an index like the S&P 500. A value
greater than one indicates the stock is more volatile than the
index.
(Go
Top) |
The January 1994 issue of Stocks &
Commodities featured an article by Hans Hannula on Polarized
Fractual Efficiency. Here is the custom formula for creating the
five-period smoothed 10-day PFE using MetaStock:
Mov(If(C,>,Ref(C,-9),Sqr(Pwr(Roc(C,9,$),2) + Pwr(10,2)) /
Sum(Sqr(Pwr(Roc(C,1,$),2)+1),9),-
Sqr(Pwr(Roc(C,9,$),2) + Pwr(10,2)) /
Sum(Sqr(Pwr(Roc(C,1,$),2)+1),9))*100,5,E)
(Go
Top) |
if(ref(oscp(3,15,S,%),-1),<,0,1,0)
(Go
Top) |
Taken from Stocks & Commodities, V. 12:6
(235-239): Price-Volume Rank by Anthony J. Macek
"Imagine receiving a warning when the market
was likely to collapse or being alerted when one of your
favorite stocks was about to rally. What if these signals came
from analysis that was simple enough to do without a computer
and took only a few minutes a day to update, using just two
pieces of information found in virtually any newspaper? Is this
a dream? Maybe not. Anthony Macek explains.
The old adage about keeping things simple
applies even to the investment world. Methods of analysis such
as polarized fractal efficiency and price oscillator divergences
do a great job, but for those with neither the time nor the
inclination to master the techniques necessary to monitor every
blip and sputter that the market produces may be served just as
well by noting only two very important market variables: price
and volume."
For interpretation refer to the June 94 issue
of Technical Analysis of Stocks & Commodities.
You need to create all of the following
custom formulas in order for the PV Rank to calculate properly.
P-V Rank:
Fml( "PV1" ) + Fml( "PV2" )
PV1:
If( C ,> ,Ref( C ,-1 ) ,If( V ,> ,Ref( V ,-1 ) ,1 ,If( V ,<
,Ref(V ,-1 ) ,2 ,0 ) ) ,0 )
PV2:
If( C ,< ,Ref( C ,-1 ) ,If( V ,< ,Ref( V ,-1 ) ,3 ,If( V ,>
,Ref( V ,-1 ) ,4 ,0 ) ) ,0 )
PV Biggie: (This combines all formulas into
one formula)
If( C ,> ,Ref( C ,-1 ) ,If( V ,> ,Ref( V ,-1 ) ,1 ,If( V ,<
,Ref( V ,-1 ) ,2 ,0 ) ) ,If( C ,< ,Ref( C ,-1 ),If( V ,< ,Ref( V
,-1 ) ,3 ,If( V ,> ,Ref( V ,-1 ) ,4 ,0 ) ) ,0 ) )
(Go
Top) |
{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) |
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. |
|
- Initial equity Points Only
- Positions: Long and short
- Trade price: Open
- Trade delay: 1
Note that the maximum stop loss amount should be changed to
0.032 for the British Pound and 0.02 for the Australian and
Canadian dollars when testing these contracts.
(Go
Top) |
by Glenn Wallace
- Futures Magazine, Vol.29 No.6, June 2000, P.48
There was an overbought/oversold indicator described in the June
2000 Futures Magazine called the Psychological Index. It looked
sort of interesting, so I wrote the MetaStock code for it:
LookBack:= Input("Number of lookback periods", 2, 100, 12);
UThreshold:= Input("Upper threshold (%)", 0, 100, 75);
LThreshold:= Input("Lower threshold (%)", 0, 100, 25);
UpDay:= If(CLOSE > Ref(CLOSE,-1), 1, 0);
PsychIndex:= Sum(UpDay,LookBack) / LookBack * 100;
PsychIndex; UThreshold; LThreshold
(Go
Top) |
{ Chart periodicity detector }{ References indicator
"Calendar Week counter" }{ ©Copyright 2003-2004 Jose Silva }{
josesilva22@yahoo.com }
dummy:=Input("Chart detected: (1) Daily, (2) Weekly, ",0,0,0);
dummy:=Input(" (3) Monthly, (4) Quarterly, (5) Yearly",0,0,0);
Wk:=Fml("Calendar Week counter");
{FortnightCount:=Int((Wk+1)/2);}
m:=Month();
Mth:=Cum(m<>ValueWhen(2,1,m));
q:=If(m=1 OR m=2 OR m=3,1,
If(m=4 OR m=5 OR m=6,2,
If(m=7 OR m=8 OR m=9,3,4)));
Qtr:=Cum(q<>ValueWhen(2,1,q));
Yr:=Cum(Year()<>ValueWhen(2,1,Year()));
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
Periodicity detector app example
{Chart periodicity detector application example}{Automatically
adjusts EMA to chart periodicity}{ References indicator
"Calendar Week counter" }{ ©Copyright 2003-2004 Jose Silva }{
josesilva22@yahoo.com }
Wk:=Fml("Calendar Week counter");
{Frt:=Int((Wk+1)/2);}
m:=Month();
Mth:=Cum(m<>ValueWhen(2,1,m));
q:=If(m=1 OR m=2 OR m=3,1,
If(m=4 OR m=5 OR m=6,2,
If(m=7 OR m=8 OR m=9,3,4)));
Qtr:=Cum(q<>ValueWhen(2,1,q));
Yr:=Cum(Year()<>ValueWhen(2,1,Year()));
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);
pds:=Input("daily EMA periods",1,25200,126);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,6);
shift:=1+Input("EMA vertical shift %",
-100,100,0)/100;
plot:=Input("EMA=1, 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)))));
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)
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 }
limit:=2000; {do not change limit year}
LimLeap:=Frac(limit/4)=0 AND Frac(limit/100)<>0
OR Frac(limit/400)=0;
NoCount:=limit*365+Int(limit/4)
-Int(limit/100)+Int(limit/400)-LimLeap;
leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0
OR Frac(Year()/400)=0;
y:=Year()*365+Int(Year()/4)
-Int(Year()/100)+Int(Year()/400)-NoCount;
m:=
If(Month()=2,31-leap,
If(Month()=3,59,
If(Month()=4,90,
If(Month()=5,120,
If(Month()=6,151,
If(Month()=7,181,
If(Month()=8,212,
If(Month()=9,243,
If(Month()=10,273,
If(Month()=11,304,
If(Month()=12,334,
-leap)))))))))));
DayNr:=y+m+DayOfMonth();
WkCount:=Int((DayNr-1)/7)+(Year()>=limit);
WkCount
(Go
Top) |
|