Moving Average filter by STD dev

Category: Indicators By: Nicolas Created: February 7, 2016, 12:47 PM
February 7, 2016, 12:47 PM
Indicators
0 Comments

Here is another modification of a simple moving average curve. This one is filtered by standard deviation of price over 2 different periods.

I have coded this one by request, post it here for any useful purpose you’ll find to this moving average.

// parameters : 
// MAperiod = 50
// STDperiod1 = 30
// STDperiod2 = 9

if(barindex>STDperiod1) then
 mb = average[MAperiod](TypicalPrice)
 dev = STD[STDperiod1](Close)
 i = STD[STDperiod2](Close)/dev
 a = 2/(STDperiod2+1)

 filt = a*i*Close+(1-(a*i))*filt[1]

 buffer = (mb+filt)/2
endif

if(buffer>buffer[1]) then
 d=1
else
 d=-1
endif

RETURN buffer coloured by d

 

Download
Filename: MA-std-dev-filter.itf
Downloads: 99
Nicolas Master
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

Logo Logo
Loading...