Nicolas

Percentage from MA

Category: Indicators By: Nicolas Created: October 13, 2015, 9:21 PM
October 13, 2015, 9:21 PM
Indicators
2 Comments
Percentage from MA

Simple representation of the percentage derivative price from a N periods moving average.

//Parameters :
//Period = 200
//percentH = 15
//percentL = -15

xEMA = exponentialaverage[Period](close)
nRes = (close - xEMA) * 100 / close

RETURN nRes as "% deviation from MA", 0, percentH, percentL

 

Download
Filename: Percentage-from-MA.itf
Downloads: 123
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

AnamaTrader
5 years ago
#

ah, great, was just looking for something similar. will try this. I have also been considering adding the percents deviation from an MA as a fixed percent above/below as a line on the chart ("MA envelope") but hasnt found any such code on the forums. maybe I'll try to construct it myself. but thanks for this!

gabri
9 years ago
#

Great job. If you divide the numerator by xEMA and not Close you obtain the Disparity Index that, used with an EMA26 represents perfectly the RSI.

ProRealCode ProRealCode
Loading...