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

Re: [amibroker] Re: What does LinRegSlope return?



PureBytes Links

Trading Reference Links

All the results from the AB geometric(math) functions return radians.  To convert, use a constant

or use what DTsokakis used in the routine below . The tan of 45 deg is 1, right? - the ratio of the

two equal leg lengths.  So in Amibroker the  atan(1) -  the inverse function, is the equivalent of 45 in radians. 

So 45/atan(1) will give you the constant to multiply your results in radians to give you degrees.

angle(in radians) * 45/atan(1), or   angle(in radians) * 45/.7854   or    angle in radians* 57.30  degrees/radians

Let me know if this works.    57.30 * linregslope( ) ?   Looks reasonable? 

BUT, as Graham pointed out before all is not as meets the eye, because your axis scaling on the indicator chart will significant change the slope you see visually. 

Hope this helps

JOE

   

(Abbr. tan) Mathematics. The trigonometric function of an acute angle in a right triangle that is the ratio of the length of the side opposite the angle to the length of the side adjacent to the angle.

 

========================== DT's Code ============================================

/* Suppose you START 50 bars before the last bar AND the END is 20 bars

ago.

for any ARRAY, the angle is

*/

Start = Param("Starting Bar", 50,10,122,1);

End = Param("Ending Bar",30,10,122,1);

// START=50;END=30;

ARRAY=RSI();

L1=LastValue(Cum(1));

X0=L1-START;X1=L1-END;

Y0=ARRAY[X0];Y1=ARRAY[X1];

Plot(ARRAY,"",1,1);

Plot(LineArray(X0,Y0,X1,Y1),"",4,1);

Plot(LineArray(X0,Y0,X1,Y0),"",4,1);

ANGLE=atan((Y1-Y0)/(X1-X0));

Title="ANGLE="+WriteVal(ANGLE)+" RADS"+", ["+WriteVal(45*ANGLE/atan

(1),1.0)+" DEGS]";

----- Original Message -----
Sent: Wednesday, February 23, 2005 10:24 PM
Subject: [amibroker] Re: What does LinRegSlope return?


Well...I plotted the return value and its atan value. Both look very
close...yes you are rite there...
Thanks.
Steven.

--- In amibroker@xxxxxxxxxxxxxxx, "stevenpang21" <stevenpang21@x...>
wrote:
>
> Thanks,
> I checked the return value and it seems to be in radians to me...so I
> am puzzled. Can anyone else confirm?
>
> Regards,
> Steven.
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> > Linereg value change per bar
> >
> > from the help screen
> > SYNTAX  linregslope( ARRAY, periods ) 
> > RETURNS ARRAY 
> > FUNCTION  Calculates linear regression line slope from the ARRAY using
> > periods range.
> >
> > On Thu, 24 Feb 2005 02:17:40 -0000, stevenpang21 <stevenpang21@xxxx>
> wrote:
> > >
> > >
> > > Hi,
> > > Does LinRegSlope returns the slope in radians or the y-axis value?
> > >
> > > Thanks.
> > > Steven.
> > >
> > >
> > > Check AmiBroker web page at:
> > > http://www.amibroker.com/
> > >
> > > Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Cheers
> > Graham
> > http://e-wire.net.au/~eb_kavan/





Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html





Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links