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

Re: [amibroker] Convert linregslope into degrees



PureBytes Links

Trading Reference Links

Graham, RG:
I agree if you draw a trendline it will change dramatically when you change the scale
on the chart.  The following routine from DT however provides the angle in radians and degrees
based the in this case the closing price, and does not change no matter whether you
zoom or not to change the scale of the chart.  Note it has parameters so you
can move it around the chart to span the area you're interested in.
 
What value?  It could be used in scoring but as Graham pointed out you could do the
same by using the price bars and the bar axis to calculate the rate of change,
 ROC(array,bars)
 
Best regards
JOE
======== Dimitris' code with a couple of additions

END=Param("End",1,1,250.1);

START=Param("start",50,10,250,1);

 

ARRAY=Close;

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);

Plot(Close,"Close",colorBlue,styleThick);

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

Title="ANGLE="+WriteVal(ANGLE)+" RADS"+", ["+WriteVal(45*Angle/atan(1),2.4)+" DEGS]"+ ", ["+ WriteVal(ROC(Close,49),2.2)+ "%] ROC";

----- Original Message -----
From: Graham
Sent: Friday, February 04, 2005 2:49 AM
Subject: Re: [amibroker] Convert linregslope into degrees

draw a line on the chart and thenzoom in and out and see what happens
to the slope of the line


On Fri, 4 Feb 2005 08:57:28 +0900, Rigged Game <RiggedGame@xxxxxxxxx> wrote:
>
>
> Can you elaborate with some code examples?
>
> RG
>
> On Thu, 3 Feb 2005 18:27:34 +0800, Graham <kavemanperth@xxxxxxxxx> wrote:
>
> > degrees mean nothing in charting as the angle on the screen will
> > change as you zoom in and out. Price / bar is the only way to measure
> > slope of a line.
>
>
> 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 Links