View Full Version : Help with formula
gapellegrini
21st September 2004, 04:52 PM
I have a formula for a system tath buy is the close is 2% above moving average 80 days and sells is the close is 2% below the moving average.If the price is inside the channel the system should stay of the market.
I have the fallowing formula , but isn´t working.
EL:
C > 1.02*Mov(C,80,S)
CL:
C < 1.02*Mov(C,80,S)
ES:
C < 0.98*Mov(C,80,S)
CS:
C > 0.98*Mov(C,80,S)
Can someone help?
Thanks
Gabriel
Jose
21st September 2004, 10:18 PM
Try this:
{ Parameters }
SMAperiods:=80;
BandsPercent:=2;
{ 2% SMA bands }
UpperBand:=
Mov(C,SMAperiods,S)*(1+BandsPercent/100);
LowerBand:=
Mov(C,SMAperiods,S)*(1-BandsPercent/100);
{ Band breakout signals }
In:=Cross(C,UpperBand);
Out:=Cross(LowerBand,C);
{ Remove extra signals }
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=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));
{ Plot in own indicator window,
or place in exploration filter }
0;signals
You may want to try a contrarian approach, and reverse signals:
{ Parameters }
SMAperiods:=80;
BandsPercent:=2;
{ 2% SMA bands }
UpperBand:=
Mov(C,SMAperiods,S)*(1+BandsPercent/100);
LowerBand:=
Mov(C,SMAperiods,S)*(1-BandsPercent/100);
{ Reverse band breakout signals }
In:=Cross(LowerBand,C);
Out:=Cross(C,UpperBand);
{ Remove extra signals }
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=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));
{ Plot in own indicator window,
or place in exploration filter }
0;signals
jose '-)
gapellegrini
22nd September 2004, 01:57 PM
Jose , thanks for your help. But I want a formula to be used in system tester. If i put the 1.02*Mov(C,80,S) and 0.98*Mov(C,80,S)
as a Indicator works fine.The channel works fine around the moving average. And if a put the formula EL= C > fml( indicator I build 1.02*Mov(C,80,S) ) don´t work too. Can you help?
Thanks
Gabriel
Jose
23rd September 2004, 01:17 AM
You're out of luck, Gabriel - I don't support or waste any time on MetaStock's system tester.
jose '-)
gapellegrini
23rd September 2004, 04:57 PM
I want to use MS system tester because the opt function.
Thanks
Gabriel
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.