Metastock Formulas S 1

background image

Strona 1

Metastock Formulas - S 1

2014-10-14 14:05:34

http://www.meta-formula.com/Metastock-Formulas-S1.html

Metastock Formulas - S 1

Click here to go back to

Metastock Formula Index

IMPORTANT:

These formulas aren't my complete

collection. For my complete collection of instantly usable,
profitable and powerful MetaStock formulas

Click Here

Would You Like To Use MetaStock To Its Full Potential? Discover the
Amazingly Simple Secret to Master Metastock Step-By-Step -

click here

A

|

A 1

|

B

|

B 1

|

C

|

C 1

|

D

|

D 1

|

E

|

F

|

G

|

H

|

I

|

J

|

K

|

L

|

M

|

M 1

|

N

|

O

|

P

|

R

|

S

|

S 1

|

T

|

U

|

V

|

W

|

Z

|

Stock Rhythm System

Schaff Trend Cycle Oscillator
Signal accumulator
Siroc
Smart System design - Long

Stock Rhythm System

In Jeffrey Owen Katz's article "Trading stocks with a cyclical system" he introduces the
Stock Rhythm System. In MetaStock 6.5, or higher, you can easily create this system. With
MetaStock running choose "System Tester" from the Tools menu, click on the New button
and enter the following formulas:

Signal Formulas

Enter Long
thresh:= 4;
k:= 3;
m:= 63;
Value1:= Stdev(Ref(ROC(C,k,$),-m),20);
Value2:= Ref(ROC(C,k,$),-m);
When(Value2 > thresh*Value1)

Close Long
thresh:= 4;
k:= 3;
m:= 63;
Value1:= Stdev(Ref(ROC(C,k,$),-m),20);
Value2:= Ref(ROC(C,k,$),-m);
When(Value2 <-thresh*Value1)

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);

Home

MetaStock Secrets

Free MS Newsletter

Free MS Formula

Buy MetaStock

Buy MS Formulas

FREE Videos

MS Back Testing

Trading Systems

Nicolas Darvas

MetaStock Links

Rave Reviews

About Us

Contact Us

SiteMap

background image

Strona 2

Metastock Formulas - S 1

2014-10-14 14:05:34

http://www.meta-formula.com/Metastock-Formulas-S1.html

pdsSh:=Input("Short periods",1,252,10);
pdsLg:=Input("Long periods",2,2520,21);

{ Schaff Trend Cycle }
MCD:=Wilders(MP(),pdsSh)-Wilders(MP(),pdsLg);
ST:=(MCD-LLV(MCD,pdsCy))
/(HHV(MCD,pdsCy)-LLV(MCD,pdsCy))*100;
STC:=Wilders(ST,pdsCy/2);

{ automatic trigger levels }
pk:=Ref(STC,-1)>STC AND Ref(STC,-1)>Ref(STC,-2);
pkVal:=If(pk,Ref(STC,-1),0);
pkAvg:=Cum(pkVal)/(Cum(pk)+.000001);
pkAvg:=If(pkAvg=0,100,pkAvg);
tr:=Ref(STC,-1)<STC AND Ref(STC,-1)<Ref(STC,-2);
trVal:=If(tr,Ref(STC,-1),0);
trAvg:=Cum(trVal)/(Cum(tr)+.000001);

{ plot on own window }
pkAvg;trAvg;STC

Schaff Trend Cycle Indicator

{ Schaff Trend Cycle Indicator 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 }
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);

{ Schaff Trend Cycle }
MCD:=Wilders(MP(),pdsSh)-Wilders(MP(),pdsLg);
ST:=(MCD-LLV(MCD,pdsCy))
/(HHV(MCD,pdsCy)-LLV(MCD,pdsCy))*100;
STC:=Wilders(ST,pdsCy/2);

{ Schaff Trend Cycle }
MCD:=Wilders(MP(),pdsSh)-Wilders(MP(),pdsLg);
ST:=(MCD-LLV(MCD,pdsCy))
/(HHV(MCD,pdsCy)-LLV(MCD,pdsCy))*100;
STC:=Wilders(ST,pdsCy/2);

{ automatic trigger levels }
pk:=Ref(STC,-1)>STC AND Ref(STC,-1)>Ref(STC,-2);
pkVal:=If(pk,Ref(STC,-1),0);
pkAvg:=Cum(pkVal)/(Cum(pk)+.000001);
pkAvg:=If(pkAvg=0,100,pkAvg);
tr:=Ref(STC,-1)<STC AND Ref(STC,-1)<Ref(STC,-2);
trVal:=If(tr,Ref(STC,-1),0);
trAvg:=Cum(trVal)/(Cum(tr)+.000001);

{ STC crossover signals }
In:=Cross(pkAvg,STC);
Out:=Cross(STC,trAvg);
InInit:=Cum(In)=1;
Init:=Cum(In+Out>-1)=1;
flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit;
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2));

{ trend support/resistance levels }
STCI:=If(flag,ValueWhen(1,signals,L*(1-buffer)),
ValueWhen(1,signals=-1 OR Init,H*(1+buffer)));

{ alternative STC crossover signals method}
{bb:=BarsSince(Cross(STC,trAvg));
bs:=BarsSince(Cross(pkAvg,STC));
tb:=ValueWhen(1,Cross(STC,trAvg),H*(1+buffer));
ts:=ValueWhen(1,Cross(pkAvg,STC),L*(1-buffer));
STCI:=If(bb<bs,tb,ts);}

{ plot on price chart }
STCI

(

Go Top...

)

Signal accumulator

background image

Strona 3

Metastock Formulas - S 1

2014-10-14 14:05:34

http://www.meta-formula.com/Metastock-Formulas-S1.html

{ Accumulates OBV/Volume (or any other signals) between & including two user-input
dates }

{signal to accumulate - OBV}
x:=If(C>Ref(C,-1),V,If(C<Ref(C,-1),-V,0));

{signal to accumulate - Volume}
{x:=V;}

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);

{ Automatic peak/trough historical boundaries }
pk:=Ref(Siroc,-1)>Ref(Siroc,-2)
AND Ref(Siroc,-1)>Siroc
AND Ref(Siroc,-1)>SirocAvg;
pkVal:=ValueWhen(1,pk,Ref(Siroc,-1));
oBought:=Cum(pkVal)/Cum(pkVal>-1);
tr:=Ref(Siroc,-1)<Ref(Siroc,-2)
AND Ref(Siroc,-1)<Siroc
AND Ref(Siroc,-1)<SirocAvg;
trVal:=ValueWhen(1,tr,Ref(Siroc,-1));
oSold:=Cum(trVal)/Cum(trVal>-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

{ Siroc II 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);
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);

background image

Strona 4

Metastock Formulas - S 1

2014-10-14 14:05:34

http://www.meta-formula.com/Metastock-Formulas-S1.html

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);

{ Automatic peak/trough historical boundaries }
pk:=Ref(Siroc,-1)>Ref(Siroc,-2)
AND Ref(Siroc,-1)>Siroc
AND Ref(Siroc,-1)>SirocAvg;
pkVal:=ValueWhen(1,pk,Ref(Siroc,-1));
oBought:=Cum(pkVal)/Cum(pkVal>-1);
tr:=Ref(Siroc,-1)<Ref(Siroc,-2)
AND Ref(Siroc,-1)<Siroc
AND Ref(Siroc,-1)<SirocAvg;
trVal:=ValueWhen(1,tr,Ref(Siroc,-1));
oSold:=Cum(trVal)/Cum(trVal>-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 }

{*** user input section ***}

delay:=1; {delay entry/exit x periods}
pds:=Input("global entry/exit periods",
1,252,21);
En1:=Input("enable EMA entry",0,1,1);
En2:=Input("enable HHV entry",0,1,1);
Ex1:=Input("enable EMA exit",0,1,1);
Ex2:=Input("enable LLV exit",0,1,1);
Ex3:=Input("enable ATR exit",0,1,1);

{*** place your entry/exit conditions here ***}

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;

{*** system logic section ***}

En1:=If(En1,EntryCond1,0);
En2:=If(En2,EntryCond2,0);
Ex1:=If(Ex1,ExitCond1,0);
Ex2:=If(Ex2,ExitCond2,0);
Ex3:=If(Ex3,ExitCond3,0);

{*** system signals logic section ***}

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);

{*** system signals display section ***}

Ref(Flag AND Alert(Flag=0,2),-delay)-
Ref((Flag=0 AND Alert(Flag,2)),-delay)

background image

Strona 5

Metastock Formulas - S 1

2014-10-14 14:05:34

http://www.meta-formula.com/Metastock-Formulas-S1.html

More advanced system developers:

Smart System Long Entry developer

{ Plots +1 spike on Long entry signal }
{ Warning: this trading system is a design example only - do not trade! }
{ ©Copyright 2003 Jose Silva }
{ josesilva22@yahoo.com }

{*** user input section ***}

pds:=Input("global entry periods",1,252,21);
En1:=Input("enable EMA entry",0,1,1);
En2:=Input("enable HHV entry",0,1,1);
En3:=Input("enable ATR entry",0,1,1);
En4:=Input("enable WR% entry",0,1,1);
En5:=Input("enable CMF entry",0,1,1);

{*** place your entry Long conditions here ***}

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);

{*** system logic section ***}

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

Smart System Long Exit developer

{Plots -1 spike on Long exit signal}
{Warning: this trading system is a design example only - do not trade!}
{©Copyright 2003 Jose Silva}
{josesilva22@yahoo.com}

{*** user input section ***}

pds:=Input("global exit periods",1,252,10);
Ex1:=Input("enable EMA exit",0,1,1);
Ex2:=Input("enable LLV exit",0,1,1);
Ex3:=Input("enable ATR exit",0,1,1);
Ex4:=Input("enable WR% exit",0,1,1);
Ex5:=Input("enable CMF exit",0,1,1);

{*** place your exit Long conditions here ***}

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;

{*** system logic section ***}

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);

{*** system exit output section ***}

exit

Smart System Long trade signals

{ Plots +1 on entry, -1 spike on exit signals }{ Change user-input default settings within
code in referenced indicators: "Smart System Long Entry developer" & "Smart System Long
Exit developer" }

{ Warning: this trading system is a design example only - do not trade! }{ ©Copyright 2003
Jose Silva }{ josesilva22@yahoo.com }

delay:=Input("Entry and Exit delay",0,5,0);
plot:=Input("plot: entry/exit signals=1, trade binary=2",1,2,1);

background image

Strona 6

Metastock Formulas - S 1

2014-10-14 14:05:34

http://www.meta-formula.com/Metastock-Formulas-S1.html

In:=Fml("Smart System Long Entry developer");
Out:=Fml("Smart System Long Exit developer")=-1;

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)

(

Go Top...

)

If you have Metastock formulas you would like to share,
Please email to
We look forward to hearing from you!

To learn more about how to use Metastock and its formula

click here.

copyright 2003

MetaStock Website Home

Metastock® is a registered trademark of Equis International.


Wyszukiwarka

Podobne podstrony:

więcej podobnych podstron