What about something like this: condition = timenum() == 09300; interesting = IIF(condition, High - Low, 0); avgInteresting = Sum(interesting, 20) / Sum(interesting != 0, 20);
Plot(1, "Cond.", IIF(condition, colorGreen, colorRed), styleArea | styleOwnScale | styleNoLabel); Plot(interesting, "Interesting", colorGreen, styleDots | styleNoLine); Plot(avgInteresting, "Avg. Interesting", colorBlue); Mike --- In [email protected], jim fenster <normanj...@...> wrote: > > is there a way to check on another statistic? Like the average? > like > condition=timenum()==09300; > if condition then h-l; > then finding the average of the last 20 bars (h-l) that was 093000? > > > J > > > > > ________________________________ > From: peter843 <yg2...@...> > To: [email protected] > Sent: Sat, December 12, 2009 11:16:56 AM > Subject: [amibroker] Re: How do you check for a condition that occurred over > X days? > > > Thanks. That worked. > > That one little statement taught me a lot about how AFL works. > > --- In amibro...@yahoogrou ps.com, Herman <psytek@> wrote: > > > > sum( Condition, NumberOfDays) ? > > > > herman > > > > > > peter843 wrote: > > > I want to check for conditions that occur over a number of consecutive > > > days and specify the number of days with a variable. I assume I can do > > > this with a FOR loop. Is there a simpler way? > > > > > > > > > > > > ------------ --------- --------- ------ > > > > > > **** IMPORTANT PLEASE READ **** > > > This group is for the discussion between users only. > > > This is *NOT* technical support channel. > > > > > > TO GET TECHNICAL SUPPORT send an e-mail directly to > > > SUPPORT {at} amibroker.com > > > > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > > > http://www.amibroke r.com/feedback/ > > > (submissions sent via other channels won't be considered) > > > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > > http://www.amibroke r.com/devlog/ > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > __________________________________________________________________ > Make your browsing faster, safer, and easier with the new Internet Explorer® > 8. Optimized for Yahoo! Get it Now for Free! at > http://downloads.yahoo.com/ca/internetexplorer/ >
