I found the following formula to calculate the slope of a line:
public int CalcSlope(IDataSeries line)
{
double radToDegrees = 180/Math.PI;
return (int)(radToDegrees*(Math.Atan((line[0]-(line[1]+line[2])/2) /1.5/TickSize))) ;
}
I want to enable the calculation of the slope in degrees given any number of bars, from 1 to n. I don't understand why the line is divided by 1.5.
Would the following formula be valid? Say I want to calculate the slope for the last 3 bars:
return (int)(radToDegrees*(Math.Atan((line[0]-(line[1]+line[2]+line[3])/3) /1.5/TickSize)))
If not, what is the formula?
Thanks.
rpq

Comment