Registered User Joined: 7/1/2007 Posts: 9
|
I have been trying to write a pcf when the 13 day moving average crosses over the 55 day moving average and they are both going up. And then conversely when they are both going down on a separate scan. Thanks
DJ
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
DJ,
The general form of the PCFs is:
a) MA13 upcrossing MA55 both increasing:
MA13.1<=MA55.1 AND MA55.1<MA55.0 AND MA55.0<MA10.0
b) MA13 downcrossing MA55 both decreasing:
MA13.1>=MA55.1 AND MA55.1>MA55.0 AND MA55.0>MA10.0
In the case of Simple Moving Averages (SMA) on C, the center inequality can be simplified:
a) SMA13 upcrossing SMA55 both increasing:
AVGC13.1<=AVGC55.1 AND C55<C0 AND AVGC55.0<AVGC10.0
b) SMA13 downcrossing SMA55 both decreasing:
AVGC13.1>=AVGC55.1 AND C55>C0 AND AVGC55.0>AVGC10.0
In the case of Exponential Moving Averages (EMA) on C, the center inequality can be eliminated:
a) EMA13 upcrossing EMA55 both increasing:
XAVGC13.1<=XAVGC55.1 AND XAVGC55.0<AVGC10.0
b) EMA13 downcrossing EMA55 both decreasing:
XAVGC13.1>=AVGC55.1 AND XAVGC55.0>XAVGC10.0
It may be of interest that the EMA is the one and only Linear Time Invariant (LTI) Moving Average for which the center inequality can be eliminated.
Thanks, Jim Murphy
|