Dynamic Moving Average Cross Over EasyLanguage

{Dynamic Moving AVerage System by George Pruitt}
{Use volatility to adapt moving average lenghts}
{in hopes to outperform a static parameter set!}

vars: avg1Ceil(23),avg1Floor(9),avg2Ceil(100),avg2Floor(25);

vars: shortMALen(19),longMALen(29);
vars: x1(0),y1(0),x2(0),y2(0),deltaVol1(0),deltaVol2(0);

If barNumber = 1 then
	shortMALen = 19;
	longMALen = 29;

x1 = Stddev(close,shortMALen);
y1 = Stddev(close[1],shortMALen);

x2 = Stddev(close,longMALen);
y2 = Stddev(close[1],longMALen);

deltaVol1 = (x1-y1)/y1;
deltaVol2 = (x2-y2)/y2;

shortMALen = (1+deltaVol1)*shortMALen;
shortMALen = MaxList(shortMALen,avg1Floor);
shortMALen = MinList(shortMALen,avg1Ceil);
shortMALen = round(shortMALen,0);

longMALen = (1+deltaVol2)*longMALen;
longMALen = MaxList(longMALen,avg2Floor);
longMALen = MinList(longMALen,avg2Ceil);
longMALen = round(longMALen,0);

If average(c,shortMALen) crosses above average(c,longMALen) then buy next bar at open;
If average(c,shortMALen) crosses below average(c,longMALen) then sellshort next bar at open;