Gary, I can't check the code now, but suggest use "n last quotations" instead of "n last days". It may save you some problems if you're working on a weekend. Don't know if its a issue or not.
----- Original Message ----- From: "garyniemen" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, August 07, 2007 10:17 PM Subject: [amibroker] Quick check of AFL code... > 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 > > > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > For other support material please check also: > http://www.amibroker.com/support.html > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
