PureBytes Links
Trading Reference Links
|
Karile must be rubbing her/his hands in glee to
have started this. WOW.
I really have to sit back and mull thru
this.
Dusant
Chief Architect
<A
href="">http://www.candlestrength.com/
----- Original Message -----
From: "Ron" <<A
href=""><FONT face=Verdana
size=2>ronber@xxxxxxxxxxxxx<FONT face=Verdana
size=2>>
To: <<A
href=""><FONT face=Verdana
size=2>Metastockusers@xxxxxxxxxxxxxxx<FONT face=Verdana
size=2>>
Sent: Thursday, April 15, 2004 8:45
PM
Subject: Re: [Metastockusers] Re: Code
adjustment
> Attached is a screen capture of a
chart segment.> The Yellow line is Dusant's code> The Green line
is Jose's code> The White line is TrendChaser's code (most
recent)> The Red Line is a the original code for a Linear RegressionLine
adjusted > for a 20 bar period.> The white dots are
closes.> The green dots are a plot of Mov(Typ(),20,S)> >
From just eyeballing (both eyes) seems that the red line does >
approximate a linear regression line of the closes.> None of the other
lines comes as close to going through the data points > of the
Mov(Typ(),20,S) plot.> > Is it the case that this magnitude of
discrepancy is due to a number > crunching problem in MS?> Is
there that great a difference in the nature of the calculation > between
C and MOV(TYP(),20,S)> when TYP=(high + low + close) / 3. >
Is the software overwhelmed by these differences in the amount of >
calculation?> If yes, Bummer!> > Jose wrote:>
> >Trendchaser, your code is a Linear Regression mixture of the Typ()
SMA > >and Close. It doesn't address the original
problem.> >> >Ron, > ><A
href=""><FONT
face=Verdana
size=2>http://finance.groups.yahoo.com/group/Metastockusers/message/9753<FONT
face=Verdana size=2>> >welcome to one of MetaStock's single precision
limitations:> >MS can't handle accurate number crunching in complex
processing.> >> >The code below, using and external dll to
process the Linear > >Regression values, tracks the Mov(Typ(),20,S)
correctly:> >> >---8<-------------------->
>> >{ Adaptive.dll (not avail to public) must be in> >
...\MetaStock\External Function DLLs\ folder }> >>
>pds:=Input("Linear Regression Trendline periods",2,2520,21);>
>> >x:=Mov(Typ(),20,S);>
>LRSlope:=ExtFml("Adaptive.LinRegSlope",x,pds);>
>LRInd:=LRSlope*Cum(1)> >
-LRSlope*ExtFml("Adaptive.Mov",Cum(1),pds)> >
+ExtFml("Adaptive.Mov",x,pds);> >>
>lastVal:=LastValue(LRInd);>
>countback:=LastValue(Cum(1))-Cum(1);> >LR:=>
>lastVal-LastValue(LRSlope)*countback;>
>restrict:=0-(LastValue(Cum(1))-pds);>
>LRT:=Ref(Ref(LR,-restrict),restrict);> >> >LRT>
>> >---8<--------------------> >>
>Adaptive.dll is not available for public release, so you'll have to >
>take my word for it.> >> >> >Now, the same
code, using MetaStock's Linear Regression functions, > >plots a Linear
Regression line that does not track Mov(Typ(),20,S):> >>
>---8<--------------------> >> >pds:=Input("Linear
Regression Trendline periods",2,2520,21);> >>
>x:=Mov(Typ(),20,S);> >LRSlope:=LinRegSlope(x,pds);>
>LRInd:=LinearReg(x,pds);> >>
>lastVal:=LastValue(LRInd);>
>countback:=LastValue(Cum(1))-Cum(1);> >LR:=>
>lastVal-LastValue(LRSlope)*countback;>
>restrict:=0-(LastValue(Cum(1))-pds);>
>LRT:=Ref(Ref(LR,-restrict),restrict);> >> >LRT>
>> >---8<--------------------> >> >>
>Linear Regression has been a thorn in MetaStock's side for a while.>
>> >> >jose '-)> >> >> >---
In <FONT face=Verdana
size=2>Metastockusers@xxxxxxxxxxxxxxx,
"trendchaser2003" > ><<A
href=""><FONT face=Verdana
size=2>trendchaser2003@xxxx>
wrote:> > > >> >>Try this.>
>>> >>Ps:=Input("Mov(Typ() Periods",2,1000,20);>
>>Pe:=Input("LinearReg Periods",2,1000,21);>
>>x:=Mov(Typ(),Ps,S);> >>x:=LastValue(X);>
>>Z:=LastValue(LinearReg(C,Pe));> >>Z:=(Z+X)-Z;>
>>Y:=LastValue(Cum(1))-Cum(1);>
>>U:=Z-(LastValue(LinRegSlope(C,Pe))*Y);>
>>R:=0-(LastValue(Cum(1))-Pe);>
>>A:=U+Ref(C,R)-Ref(C,R);>
>>Range:=LastValue(Mov(H,Pe,E)-LastValue(Mov(L,Pe,E)));>
>>a+(16*(0.125*Range));> >>a+(8*(0.125*Range));>
>>A;> >>a-(8*(0.125*Range));>
>>a-(16*(0.125*Range));> >>>
>>Trendchaser> >><A
href=""><FONT face=Verdana
size=2>http://www.freewebs.com/trendchaser/<FONT face=Verdana
size=2>> >> > >>> >>
> > >> >>>--- In <A
href=""><FONT face=Verdana
size=2>Metastockusers@xxxxxxxxxxxxxxx,
karile <<FONT face=Verdana
size=2>karile@xxxx> >
>>> > >>>>
>wrote:> > > > > >>
>>>Hi,> >>> >
>>>> > > > > >>
>>>I have a code which calculates a linear regression (see >
>>> > >>>>
>below).> >> > > >>
>>>What I would like to have is a linear regression of a 20 SMA>
>>>( (mov(typical(),20,s) ) instead of the close.>
>>>Could anyone adjust the code below to perform that ?>
>>> > >>>> >
> > > >> >>>Here is the code :>
>>> > >>>> >
> > > >>
>>>Pe:=Input("Periods",2,1000,6);>
>>>Z:=LastValue(LinearReg(C,Pe));>
>>>Y:=LastValue(Cum(1))-Cum(1);>
>>>U:=Z-(LastValue(LinRegSlope(C,Pe))*Y);>
>>>R:=0-(LastValue(Cum(1))-Pe);>
>>>U+Ref(C,R)-Ref(C,R);>
>>> > >>>>
>> > > >> >>>Thanks for your
help,> >>>Regards,>
>>> > >>>> >
> > > >> >>>Karile>
>>> > >>>>
>> >> >> >> >> > >
>Yahoo! Groups Links> >> >> >> >
> >> >> > > >> >
> > ------------------------ Yahoo! Groups Sponsor
---------------------~-->> Buy Ink Cartridges or Refill Kits for your
HP, Epson, Canon or Lexmark> Printer at MyInks.com. Free s/h on
orders $50 or more to the US & Canada.> <A
href=""><FONT face=Verdana
size=2>http://www.c1tracking.com/l.asp?cid=5511<FONT face=Verdana
size=2>> <A
href=""><FONT
face=Verdana
size=2>http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM<FONT
face=Verdana size=2>>
---------------------------------------------------------------------~->>
> > Yahoo! Groups Links> > <*> To visit
your group on the web, go to:> <A
href=""><FONT face=Verdana
size=2>http://groups.yahoo.com/group/Metastockusers/<FONT
face=Verdana size=2>> > <*> To unsubscribe from this group, send
an email to:> <A
href=""><FONT face=Verdana
size=2>Metastockusers-unsubscribe@xxxxxxxxxxxxxxx<FONT
face=Verdana size=2>> > <*> Your use of Yahoo! Groups is subject
to:> <A
href=""><FONT face=Verdana
size=2>http://docs.yahoo.com/info/terms/<FONT face=Verdana
size=2>> >
<IMG
src="">
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/Metastockusers/
To unsubscribe from this group, send an email to:Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|