[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: help in building an indicator



PureBytes Links

Trading Reference Links

Adam,

Last line of code reads (RA2MA-RA1MA), meaning that it would have 
taken the difference of the index or security and the close. So if 
you remove the sec function and change it to the close, you end up 
with close minus close which will always equal zero.:-)

This is assuming that is what you did. If not, post your code and 
we'll try to figure it out.

Preston

  

--- In equismetastock@xxxxxxxxxxxxxxx, "adamp_27" <adamp_27@xxx> 
wrote:
>
> Hi Preston
> 
> 
> 
> why this formula can not be recognised my my EOD metastock. after I 
> removed "sec" function with "c" it turn up with a nice straight line
> 
> 
> regards
> 
> 
> adam
> 
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@> wrote:
> >
> > joshik,
> > 
> > A fine piece of work! Nice Job!
> > 
> > I hope other members will take the time to look through your 
> coding. 
> > Basically it is a smoothed ROC (rate of change) using various 
> > smoothing methods to calculate the ROC of a stock and an index. 
It 
> > introduces different lookback periods for the smoothing and ROC 
> > periods. Remember that the ROC is the difference between todays 
> > close and yesterdays close. A longer ROC uses a greater number of 
> > closing periods. This introduces a bit of trend into the 
> > calculations as we are no longer looking at a single close but 
are 
> > now looking at several closes over time. Add to this the 
comparison 
> > of the index and the stock itself.
> > 
> > Plotting this on a chart I would probably split the formula and 
use 
> > use the values of the smoothed ROC of the stock and the index 
> > seperately then the comparative from your formula. Somewhat 
similar 
> > to the way you would plot a MACD. 
> > 
> > One more point Joshik is that attachments will not go through 
Yahoo 
> > so you will need to upload the exploration results to the file 
> > section for others to view.
> > 
> > Again, nice work!
> > 
> > 
> > Preston  
> > 
> > 
> > 
> > 
> > --- In equismetastock@xxxxxxxxxxxxxxx, "stock market" 
> > <stockmarket1974@> wrote:
> > >
> > > Dear Preston,
> > > Thanks a lot for your help. It was a great support and 
guidance. 
> > The
> > > indicator need not be so complex but just for fun of the same i 
> > used added
> > > complexity with 6 types of moving avg and adjustable period of 
> ROC 
> > of and
> > > adjustable periods of the moving avg of the ROC.
> > > 
> > > Also attaching an exploration result of all F&O stocks using 
this 
> > formulae
> > > with 6 and 9 default ROC of EMA.
> > > members comments on improvement are highly valued.
> > > regards
> > > joshik
> > > 
> > > 
> > > 
> > 
> 
=====================================================================
> > ==========
> > > {This indicator calulates the Diff of the moving avg of the 
index
> > (nifty) and
> > > stock. This can be very useful in explorations and shortlisting 
> > the nifty
> > > out performers. (Relative strength comparative cannot be used 
> > there).
> > > 
> > > You need to correct the nifty path in the formulae. and the 
> > default working
> > > is fine. max you may adjust with moving avg. period of the ROC.
> > > 
> > > other complexities are usualy not needed.}
> > > Sec:= Security("C:\MetaStock Data\EOD-NSE\S&P CNX Nifty",C);
> > > R1:=Input("Enter ROC Period of Index",1,250,1);
> > > MOVtypeCode1:=Input("EMA(1),TEMA(2),Vol(3),ZeroLag(4),Hull
> > (5),AdapMV(6)",1,6,1);
> > > P1:=Input("Enter Moving Avg Period of ROC of Index",1,250,9);
> > > 
> > > R2:=Input("Enter ROC Period of Stock",1,250,1);
> > > MOVtypeCode2:=Input("EMA(1),TEMA(2),Vol(3),ZeroLag(4),Hull
> > (5),AdapMV(6)",1,6,1);
> > > P2:=Input("Enter Moving Avg Period of Stock",1,250,9);
> > > 
> > > {calculate ROC of index here}
> > > RA1:=ROC(Sec{close of sec},R1,%);
> > > {calculate ROC of stock here}
> > > RA2:= ROC(C,R2,%);
> > > {variables for adaptive moving Average}
> > > K1:=Power(ROC(sec,P1,$)/Sum(Abs(ROC(sec,1,$)),P1),2);
> > > AMA1:=    If(Cum(1)<=P1+1,Sec,PREV*(1-K1)+sec*K1);
> > > 
> > > K2:=Power(ROC(C,P2,$)/Sum(Abs(ROC(C,1,$)),P2),2);
> > > AMA2:=    If(Cum(1)<=P2+1,C,PREV*(1-K2)+C*K2);
> > > 
> > > {calculate moving avg of ROC of index here}
> > > RA1MA:= If(MOVtypeCode1=1, Mov(RA1,P1, E),
> > > {else}
> > > If(MOVtypeCode1=2, Tema(RA1, P1),
> > > {else}
> > > If(MOVtypeCode1=3, Mov(RA1,P1,VOL),
> > > {else}
> > > If(MOVtypeCode1=4, Mov(RA1,P1, E) + (Mov(RA1,P1, E) -
> > > Mov(Mov(RA1,P1,E),P1,E)),
> > > If(MOVtypeCode1=5, Mov(2*Mov(RA1,P1/2,W) -
> > > Mov(RA1,P1,W),LastValue(Sqrt(P1)),W),
> > > AMA1
> > > )))));
> > > 
> > > {calculate moving avg of ROC of Stock here}
> > > RA2MA:= If(MOVtypeCode2=1, Mov(RA2,P2, E),
> > > {else}
> > > If(MOVtypeCode2=2, Tema(RA2, P2),
> > > If(MOVtypeCode2=3, Mov(RA2,P2,VOL),
> > > If(MOVtypeCode2=4, Mov(RA2,P2, E) + (Mov(RA2,P2, E)- Mov(Mov
> > (RA2,P2,
> > > E),P2,E)),
> > > If(MOVtypeCode2=5, Mov(2*Mov(RA2,P2/2,W) -
> > > Mov(RA2,P2,W),LastValue(Sqrt(P2)),W),
> > > AMA2
> > > )))));
> > > 
> > > {Plot}
> > > (RA2MA-RA1MA);
> > > 
> > 
> 
=====================================================================
> > ========
> > > 
> > > 
> > > 
> > > 
> > > On 12/25/06, pumrysh <no_reply@xxxxxxxxxxxxxxx> wrote:
> > > >
> > > >   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 <equismetastock%
> > 40yahoogroups.com>,
> > > > "stock market"
> > > >
> > > > <stockmarket1974@> 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;
> > > > >
> > > > 
> > 
> 
=====================================================================
> > > > ===
> > > > >
> > > >
> > > >  
> > > >
> > > 
> > > 
> > > [Non-text portions of this message have been removed]
> > >
> >
>




 
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/