[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Monday's Low broken on Friday



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> 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 amibroker@xxxxxxxxxxxxxxx, "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
> >
>



------------------------------------

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/