Hi there,

Can one of you clever AFL guys check my AFL code :-) 

The following creates a buy signal when the current end of week 
close is greater than the 40 week (end of week close) moving average 
AND the end of week close is greater than the previous 12 end of 
week closes.

On Automatic Analysis window:
Periodicity set to Weekly (and Weekly on chart as well).
Run on a Friday after close and upload of prices.
For range, set n last days to n=1.

Cond1 = Close > MA( Close, 40 );
Cond2 = Close > Ref( HHV( Close, 12 ), -1 ) ;
Buy = Cond1 AND Cond2;

And for this one - the same as above but where the trend of the 
moving average over the last 26 weeks (end of week close) is more 
than horizontal.

Filter = LinRegSlope( MA( C, 40 ), 26 ) > 0 AND Close > Ref( HHV( 
C,12 ), -1 );
AddColumn( LinRegSlope( MA( C, 40 ), 26 ), "Linreg");

Thanks and regards
Gary Niemen

Reply via email to