MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Slope of a Line
rev. 01/06/97 The following custom formula returns the slope of a line. For example,
this formula returns the slope of a 14 day run of the security's closing prices.

Slope of a 14 day

((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:

Slope of a 25 day MA

((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.

Slope of a 14 day using the P variable

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

Source / From: TOP
http://www.equis.com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.