Ken, I see what you mean. You could substitute "periods" for a variable number of months of course and set the start and end period in the AA but using inMonthly it will always start calculating from the next first of the month until the last end of the month.
Out of curiosity, cumulating only the positive gains, what would that tell you about the issue? I could imagine great positive gains over a period of time, though the issue could still be down! Regards --- In [email protected], Ken Close <[EMAIL PROTECTED]> wrote: > > Adrian: > > Say I want to sum the Monthly Gains over some period > > In Monthly > Gain = ROC(C,1) would give me monthly gain for each month, EOM to End of > Last Month > > Then to sum the positive gains, I would need something like > > GainUp = IIF(Gain>0, Gain, 0); > TotGainUp = Sum(GainUp, Period); > > But what is Period?? > I wanted it to cumulate the count of months since a specified startdate or > from the start of the test range, which is given in Days. > But when I tried to use a BarsSince within the TimeFrameSet, it did not > count from the start of the test range but seemingly from the beginning of > the data. > > That was when I tried the simple test of Cum(1) within and without the > TimeFrameSet, and got what seemed like an unexpected result, listed below in > my original message. Something I do not understand, is happening within the > inMonthly timeframe that gives unexpected results for Cum and BarsSince and > probably some others. > > That is what I need some help on. As I want always to be counting from EOM > to End of Previous Month, I do not think I can use 21*InDaily due to > differences in month lengths. > > Thanks for commenting. > > Ken > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf > Of tayamaan > Sent: Tuesday, July 15, 2008 11:48 AM > To: [email protected] > Subject: [amibroker] Re: More Mysteries with TimeFrames > > Ken I am not quite positive what you mean, but if you want to set a starting > date you probably better use 21*inDaily since inMonthly always begins with > first day of the month and ends at the last day of the month > > Hope this helps, > > Adrian > > > > > > --- In [email protected], "Ken Close" <ken45140@> wrote: > > > > Here is one I cannot figure out. > > > > I write > > > > Filter = 1; Buy =0; > > Bars = Cum(1); > > AddColumn(Bars,"Bars",1.0); > > > > I set the date to the first date of the data, and I get Bars > > 1 > > 2 > > 3 > > 4 > > > > Now, I set this > > > > Filter = 1; Buy =0; > > Bars = Cum(1); > > > > TimeFrameSet(inMonthly); > > BarsM = Cum(1); > > TimeFrameRestore; > > BarsM = TimeFrameExpand(BarsM,inMonthly); > > > > AddColumn(Bars,"Bars",1.0); > > AddColumn(BarsM,"BarsM",1.0); > > > > and I get > > > > Bars BarsM > > 1 4763 > > 2 4763 > > 3 4763 > > > > I expected > > Bars BarsM > > 1 0 > > 2 0 > > etc > > 22 1 > > > > What is going on? What happened inside the TimeFrameSet section? > Why did I > > get this result? > > I want to operate on Monthly stats and bars yet need to count the > number of > > months since a specified start date and I cannot do it. > > Help please. > > > > Ken > > > > > > ------------------------------------ > > 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 >
