PDA

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:

&#123; Parameters &#125;
SMAperiods&#58;=80;
BandsPercent&#58;=2;

&#123; 2% SMA bands &#125;
UpperBand&#58;=
Mov&#40;C,SMAperiods,S&#41;*&#40;1+BandsPercent/100&#41;;
LowerBand&#58;=
Mov&#40;C,SMAperiods,S&#41;*&#40;1-BandsPercent/100&#41;;

&#123; Band breakout signals &#125;
In&#58;=Cross&#40;C,UpperBand&#41;;
Out&#58;=Cross&#40;LowerBand,C&#41;;

&#123; Remove extra signals &#125;
Init&#58;=Cum&#40;In+Out>-1&#41;=1;
InInit&#58;=Cum&#40;In&#41;=1;
flag&#58;=BarsSince&#40;Init OR In&#41;
<BarsSince&#40;Init OR Out&#41;+InInit;
signals&#58;=&#40;InInit AND Alert&#40;InInit=0,2&#41;
OR flag AND Alert&#40;flag=0,2&#41;&#41;
-&#40;flag=0 AND Alert&#40;flag,2&#41;&#41;;

&#123; Plot in own indicator window,
or place in exploration filter &#125;
0;signals


You may want to try a contrarian approach, and reverse signals:

&#123; Parameters &#125;
SMAperiods&#58;=80;
BandsPercent&#58;=2;

&#123; 2% SMA bands &#125;
UpperBand&#58;=
Mov&#40;C,SMAperiods,S&#41;*&#40;1+BandsPercent/100&#41;;
LowerBand&#58;=
Mov&#40;C,SMAperiods,S&#41;*&#40;1-BandsPercent/100&#41;;

&#123; Reverse band breakout signals &#125;
In&#58;=Cross&#40;LowerBand,C&#41;;
Out&#58;=Cross&#40;C,UpperBand&#41;;

&#123; Remove extra signals &#125;
Init&#58;=Cum&#40;In+Out>-1&#41;=1;
InInit&#58;=Cum&#40;In&#41;=1;
flag&#58;=BarsSince&#40;Init OR In&#41;
<BarsSince&#40;Init OR Out&#41;+InInit;
signals&#58;=&#40;InInit AND Alert&#40;InInit=0,2&#41;
OR flag AND Alert&#40;flag=0,2&#41;&#41;
-&#40;flag=0 AND Alert&#40;flag,2&#41;&#41;;

&#123; Plot in own indicator window,
or place in exploration filter &#125;
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