PureBytes Links
Trading Reference Links
|
Let's see if this will at least get you going.
BTW, Its much easier to address someone by a name not "stock market".
The formula you are seeking requires a bit of manipulation and use
of "if" variables which are tricky but can be done. I've coded the
first part but the moving averages you requested in 4,5,and 6 are
not standard metastock indicators so you need to decide how you will
deal with them. You can include the formula in the indicator code or
call a Formula variable from an external indicator formula. You
should also keep in mind that you may be reaching a line limitation
so the external FMLVAR call may save you some space.
Here's part one of the formula:
Sec:= Security("C:\MetaStock Data\EOD-NSE\S&P CNX Nifty",C);
P1:=Input("Enter Moving Avg Period of Index",1,250,6);
R1:=Input("Enter ROC Period of Index",1,250,6);
MOVtypeCode1:=Input("EMA(1),TEMA(2),Vol(3),ZeroLag(4),Hull(5),AdapMV
(6)",1,6,1);
{place all input variables above this line}
RA1:=ROC(SEC {close of sec},R1,%);
{manipulate data above this line}
MA1:=Mov(RA1,P1, E);
MA2:= Tema(RA1, P1);
MA3:= Mov(RA1,P1,V);
MA4:= {Zero Lag here};
MA5:= {Hull here};
MA6:= {Adap MV here};
RAMA:= If(MOVtypeCode1=1, MA1,
{else}
If(MOVtypeCode1=2, MA2,
{else}
If(MOVtypeCode1=3, MA3,
{else}
If(MOVtypeCode1=4, MA4,
{else}
If(MOVtypeCode1=5, MA5,
{else}
MA6)))));
RAMA;{no need for this line if you do not wish to plot RAMA}
hope this helps,
Preston
--- In equismetastock@xxxxxxxxxxxxxxx, "stock market"
<stockmarket1974@xxx> wrote:
>
> hi,
> i am trying to build and indicator for comparing the price
movement of the
> security with the index. This should give the market out
performers. as i am
> not very good at this. Help from all the seniors in the line is of
great
> value.
>
> the indicator would do as under
> calculate the daily ROC of index and the security
> calculate the moving average of this roc(both the index and
security)
> the diff of the two would be the chart
>
> i have writen the following code but cannot understand how to
> 1) use the input that selects the kind of moving avg to be used.
(line 6)
> 2) how to select the price of index that has been selected with
the variable
> sec(line5)
>
> please also check the rest of the code and suggest improvements
>
>
====================================================================
> Sec:= Security("C:\MetaStock Data\EOD-NSE\S&P CNX Nifty",C);
> P1:=Input("Enter Moving Avg Period of Index",1,250,6);
> MOVtypeCode1:=Input("EMA(1),TEMA(2),Vol(3),ZeroLag(4),Hull
(5),AdapMV(6)",1,5,1);
> MOVtype1:=0; {this varriable is to select the moving avg type in
formulae
> language}
> ROC1:=ROC(c{close of sec},1,%);
> ROCma1:=Mov(ROC1,P1,e{kind of mov to be used});
>
> P2:=Input("Enter Moving Avg Period of security",1,250,6);
> MOVtypeCode2:=Input("EMA(1),TEMA(2),Vol(3),ZeroLag(4),Hull
(5),AdapMV(6)",1,5,1);
> MOVtype2:=0; {this varriable is to select the moving avg type in
formulae
> language}
> ROC2:=ROC(C,1,%);
> ROCma2:=Mov(ROC2,P2,e{1/2/3/4/5/6});
>
> diff:=(ROCma1-ROCma2)/
>
> {Plot}
> diff;
>
=====================================================================
===
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|