Thanks, That was quick. It must have been too easy. I'll try a harder one next time.
If you can write it, I can roadtest it (I'll try it later). At first read it looks good (you definitely ironed out a couple of the kinks). All good ideas will be written into the UKB code. brian_z --- In [email protected], "Steve Dugas" <[EMAIL PROTECTED]> wrote: > > Hi - I noticed your code assumes 5 days per week, so I tried to tweak it a > little to account for holiday weeks and also added some code to sum up the > days. It's untested but we can keep our fingers crossed... 8 - ) > > Steve > > WeekDay = DayOfWeek(); > BeginWeek = WeekDay < ref( WeekDay, -1 ); > EndWeek = ref( BeginWeek, 1 ); > DaysInWeek = IIf( EndWeek, BarsSince( BeginWeek ) + 1, 0 ); > WeeklyHigh = IIf( EndWeek, HHV( High, DaysInWeek ), 0 ); > DayOfWeeklyHigh = IIf( EndWeek, DaysInWeek - HHVBars( High, DaysInWeek ), > 0 ); > for( i = 1; i <= 5; i++ ) > { > CurrentDay = DayOfWeeklyHigh == i; > Plot( cum( CurrentDay ), "Day " + i, colorCycle, styleLine ); > } > > ----- Original Message ----- > From: "brian_z111" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Thursday, March 06, 2008 7:15 PM > Subject: [amibroker] Re: Calendar Effect Part 2 ? > > > > //P_WeeklyHL > > > > // Day of week numerical descriptor is from 0 == Sunday to 6 == > > Saturday > > // Indentifies which day had the low and the high for the week > > // Export to Excel for counting > > // Note Excel has an upper limit of approx 65000 rows > > > > > > Filter = 1; > > > > WeeklyHigh = IIf(DayOfWeek() == 5, HHV(H,5),0); > > > > Plot(WeeklyHigh,"HighOfWeek(Value)",1,1); > > > > HSB = HighestSinceBars(DayOfWeek() == 1,H,1); > > > > HighOfWeekArray = 5 - HSB; > > > > HighOfWeek = IIf(DayOfWeek() == 5, HighOfWeekArray, 0); > > > > Plot(HighOfWeek,"HighOfWeek(Day)",2,1); > > > > AddColumn(HighOfWeek,"HighDayOfWeek",1,1); > > > > > > /////////////////////////////////////////// > > > > > > //WeeklyLow = IIf(DayOfWeek() == 5, LLV(L,5),0); > > > > //Plot(WeeklyLow,"LowOfWeek(Value)",1,1); > > > > //LSB = LowestSinceBars(DayOfWeek() == 1,L,1); > > > > //LowOfWeekArray = 5 - LSB; > > > > //LowOfWeek = IIf(DayOfWeek() == 5, LowOfWeekArray, 0); > > > > //Plot(LowOfWeek,"LowOfWeek(Day)",2,1); > > > > //AddColumn(LowOfWeek,"LowDayOfWeek",1,1); > > > > > > > > --- In [email protected], "brian_z111" <brian_z111@> wrote: > >> > >> Code tweaking required. > >> > >> I have posted a short exploration to report the days when the > > weekly > >> high and low occurs (at the UKB). > >> > >> At the moment I am exporting to a spreadsheet to total the number > > of > >> times it happens on a Mon or Tue etc. > >> > >> If anybody would like to have a go at improving, or completing the > >> code, please feel free (assuming there is nothing good on TV this > >> weekend). > >> > >> http://www.amibroker.org/userkb/2008/03/06/weekly-high-or-low- days/ > >> > >> It would be better if I could do the counting in AB (ATC?) > >> > >> Any comments on the elegance (?) of the code? > >> Any easier ways to do this? > >> Anybody seen anything similar elsewhere (AFL library)? > >> > >> Maybe the returns could be reported as a pretty chart (don't know > > if it > >> would be worth the effort)? > >> > >> http://www.amibroker.org/userkb/2008/03/06/weekly-high-or-low- days/ > >> > >> Anybody up for a challenge? > >> > >> brian_z11 > >> > > > > > > > > > > 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 > > > > > > > > >
