Hi, This version removes a redundency, and correctly handles the case where your data is missing values or when the preceding Monday was a holliday.
Monday = IIF(DayOfWeek() == 1, 1, 0); MondayLow = ValueWhen(Monday, Low); Friday = IIF(DayOfWeek() == 5, 1, 0); FridayClose = ValueWhen(Friday, Close); FridayLower = Friday && Close < MondayLow && BarsSince(Monday) == 4; // Set Filter to 1 if you want all days, including false days. Filter = FridayLower; AddColumn(MondayLow, "Monday Low"); AddColumn(FridayClose, "Friday Close"); AddColumn(FridayLower, "Friday Lower"); Mike --- In [email protected], "Mike" <[EMAIL PROTECTED]> wrote: > > Hi, > > You can try the following. Though, I wonder if you made a mistake in > your question? You say to "check close of Friday", but then want to > filter on "friday low is less than monday low". Which is it, Friday > close or Friday low? > > In the code below, I'm assuming that you really wanted to filter on > Friday close less than Monday low. Save as a .afl file then run as an > Exploration over any number of days. Fridays closing lower than the > preceding Monday will show with a 1 in the Friday Lower column. > > Note that I have not added any special handling for when the > preceding Monday was a holliday. You can try that part yourself ;) > > Monday = IIF(DayOfWeek() == 1, 1, 0); > MondayLow = ValueWhen(Monday, Low); > > Friday = IIF(DayOfWeek() == 5, 1, 0); > FridayClose = ValueWhen(Friday, Close); > > FridayLower = Friday && Close < ValueWhen(Monday, MondayLow); > > // Set Filter to 1 if you want all days, including false days. > Filter = FridayLower; > AddColumn(MondayLow, "Monday Low"); > AddColumn(FridayClose, "Friday Close"); > AddColumn(FridayLower, "Friday Lower"); > > Mike > > --- In [email protected], "loshude8888" <shublok@> wrote: > > > > Dear Members, > > > > Plz help me to find out following results using AFL language : > > > > 1. Check low of Monday > > 2. Check close of Friday > > > > filter : friday low is less than monday low > > > > Thanks in advance. > > > > Regards, > > Lokesh > > >
