Slope of a Line> convert from metstock to afl

#1
( (14 * (Sum(Cum( 1 ) * C ,14 ) ) ) - (Sum(Cum( 1 ) ,14 ) * (Sum( C ,14) ) ) ) / ( (14 * Sum(Pwr (Cum( 1 ) ,2 ) ,14 ) ) - Pwr(Sum(Cum( 1 ) ,14 ) ,2 ) )

{To apply this to different lines you would replace C with the desired syntax for the line. For example the slope of a 25 period simple moving average would be:}
( ( Sum(Cum(1) * Mov(C,25,S),14) ) - (Sum(Cum(1),14) * Sum(Mov(C,25,S),14) / 14) ) / ( (Sum(Power(Cum(1),2),14) ) - (Power(Sum(Cum(1),14),2) / 14) )

{You could also make this a universal formula by using the P variable. You could then plot the formula on top of any line.}
( (14*(Sum(Cum(1)*P,14) ) ) - Sum(Cum(1),14)*(Sum(P,14 ) ) ) / ( (14*Sum(Pwr(Cum(1),2 ),14 ) )-Pwr(Sum(Cum(1),14),2 ) )
 
#2
Slope of a Linear Regression Line tp:=Input("Time Periods",1,200,21);

((tp*(Sum(Cum(1)*C,tp)))-(Sum(Cum(1),tp)*(Sum(C,tp))))/((tp*Sum(Pwr(Cum(1),2),tp))-Pwr(Sum(Cum(1),tp),2)) anybody convert me this two indicator in afl please!!!!!!!
 

Similar threads