PureBytes Links
Trading Reference Links
|
FWIW, You may want to think about using log (or ln) returns, i.e.
simply ln(C/Ref(C,-1)). Has to do with returns in continuous time/
continuous compounding, instead of periodic returns which (C/Ref(C,-
1)-1) is.
For theoretical background there is plenty to find on the web.
PS
--- In amibroker@xxxxxxxxxxxxxxx, kris45mar <kris45mar@xxxx> wrote:
> Rick
>
> Thanks for that, and for a new way (for me at least)
> of calculating percentages: quite neat.
>
> The idea is based on an article in a local newsletter.
> The basis is to use multiples of SD of the mean of the
> price (effectively a Mov Average) to avoid market
> noise, but has to be expressed as a percentage of
> price movement. The theory behind this is beyond me
> but has to do with the need to use Ln and I quote " We
> use percentage price change in place of price change
> due to the frequency distribution of the data.
> Frequency distribution of price change resembles a log
> normal distribution and causes problems due to its
> asymmetry around the mean; this is caused by the fact
> that stocks don't have negative values.
> Using percentage price change gives it a more normal
> distribution and is symmetrical around the mean.
> "
> The article goes on to give MS code to be placed in
> the indicator builder for the initial stop as
> initially posted, and this as the moving average of
> that to be the trailing stop to be inserted into the
> indicator list.
>
> "
> Name: VMOVSTOP:
> Formulae: Periods:= Input("periods",5,30,15);
> M:= Mov(((C/Ref(C,-1))-1),14,E);
> SD:= Stdev(((C/Ref(C,-1))-1),14);
> R:= M-(2.364)*(SD);
> {R at 2.364 will give a 99% confidence rating}
> Stop:=Mov((C*Exp(R)*1),periods,E);
> If(C>Ref(C,-1),Stop,PREVIOUS)
> "
>
> I thought that the C*Exp(R)*1 had something to do with
> the reverse of the Log normal calculation. The format
> for AB is
>
> SYNTAX exp( NUMBER )
> exp( ARRAY )
> RETURNS NUMBER,
> ARRAY
> FUNCTION Calculates e raised to the NUMBER or ARRAY
> power
>
>
> ... which I thought may be different from the MS
> format for Exp function.
>
> So far for AB then I have the following:
>
> *****
> x = (C / Ref(C,-1)) - 1;
> M= EMA(C,14);
> SD = StDev(M,14);
> Rlower = M - (2.326 * SD);// for 99% confidence
> interval of not being stopped out initially.
> Rupper = M + (2.326 * SD);
> //Rlower = C * exp(Rlower);// clearly this value is
> wrong.
>
> Plot(C,"c",colorBlack,64);
> Plot(M,"emaC_14",colorPink,1);
> Plot(Rlower,"lowerRange",colorBlue,1);
> Plot(Rupper,"upperRange",colorGreen,1);
> //Plot(Rlower,"LowerRange",colorIndigo,1);
>
> *****
>
> but these don't quite seem right as you have
> mentioned.
>
> ChrisB
>
>
> --- ricko8294_98 <ricko@xxxx> wrote:
>
> >
> > Chris
> >
> > I think your interpretation is correct, except that
> > the line
> > R = M - 2.326 * Sd should be
> > R = M + 2.326 * SD
> >
> > The minus 1 just removes the value to the left of
> > the decimal in the
> > division. For example, if C = 35.00 and Ref(C,-1) =
> > 34.75, then C /
> > Ref(c,-1) is 1.00719. Subtracting 1 leaves you with
> > .00719 - the
> > percentage difference between the 2 values.
> >
> > Also I don't understand the "*1" at the end of Stop.
> > Why bother.
> > You also mentioned something about Ln of the price
> > change. I don't
> > see this in the code anywhere. Are you sure the MS
> > code is accurate,
> > and complete? The Stop values produced by this code
> > is about 3 times
> > the close - something seems wrong
> >
> > Rick
> > --- In amibroker@xxxxxxxxxxxxxxx, kris45mar
> > <kris45mar@xxxx> wrote:
> > > Hi Group:
> > >
> > > Can anyone give me a steer in the right direction
> > with
> > > this Metastock code, please?
> > >
> > > Designed to be a volatility based stop, based on
> > Stdev
> > > of the Ln of the percent price change.
> > >
> > > M:= Mov(((C/Ref(C,-1))-1),14,E);
> > > SD:= Stdev(((C/Ref(C,-1))-1),14);
> > > R:= M+(2.326)*(SD);
> > > {R at 2.326 will give a 99% confidence rating}
> > > C*Exp(R)*1;
> > >
> > > Here is what I have so far:
> > >
> > > x = c/ref(c,-1) ; // what is the ((C/Ref(C,-1))-1)
> > > part of the MS code. Is this the value for
> > yesterday?
> > >
> > > M = ema(x,14);
> > > Sd = stdev( x,14);
> > > R = M - 2.326 * sd;
> > > Stop = C * exp( R ) * 1; is this correct for AB?
> > >
> > > Regards
> > >
> > > ChrisB
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Yahoo! Mail - PC Magazine Editors' Choice 2005
> > > http://mail.yahoo.com
> >
> >
> >
> >
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|