Hello Prashanth, I didnt get u when u said monthly returns but this is what i have maybe that can solve the purpose or give u some leads. and for limiting ur scan period u can use something like this i think datenum()> and < with or without = as per ur requirement.
_SECTION_BEGIN("Monthly return"); TimeFrameSet(inMonthly); Filter=1; e=Ref(C,-1); j=ROC(C,1)+100; AddTextColumn(FullName(),"name",88); AddColumn(e,"LmnthCls",1.2); AddColumn(C,"TodaysCls",1.2); AddColumn(j,"ROC1mnth",1.2); // Remove -100 if u want Though u get the output in % percentage if that is what u are looking for. I dont think this is what u want but maybe that can help u. hetu --- In amibroker@yahoogroups.com, Prashanth <[EMAIL PROTECTED]> wrote: > > Hello Graham, > > Using the syntax you have given gives the Output in terms of the Month Number, ie 4 for April, 6 for June and so on. > > What I am looking for is for getting Montly Returns of a Scrip for a Particular period, ie If I Explore for 1 Year, the output should be the Movement the Scrip made in each Month in percentage terms. > > Regards > > Prashanth > > ----- Original Message ----- > From: Graham > To: amibroker@yahoogroups.com > Sent: Friday, September 01, 2006 4:32 AM > Subject: Re: [amibroker] Explore for getting Monthly Returns > > > Try using this condition to get the end of the month > > month()!=ref(month(),1) > > > -- > Cheers > Graham > AB-Write >< Professional AFL Writing Service > Yes, I write AFL code to your requirements > http://e-wire.net.au/~eb_kavan/ab_write.htm > > > > > On 31/08/06, Prashanth <[EMAIL PROTECTED]> wrote: > Hello, > > I wanted to write a AFL which shall give me the Monthly returns of any scrip for which I explore. > > I tried out the following > > // Explore to get Monthly Returns; > A = ValueWhen(Day()==31 AND Month()==8 ,C); > B = ValueWhen(Day()==30 AND Month()==9 ,C); > D = ( (100 * B) / A ) - 100; > Filter=1; > AddColumn(A," A "); > AddColumn(B," B "); > AddColumn(D," D "); > > But I am finding some problems. > > 1. For Value of B, it takes previous years data. This can be overcome by maybe using the Year() function, but the Explore I am trying to write is for running over multiple years and hence cant use the same. > > 2. If 30 or 31st is a Holiday, I can get incorrect data. How do I overcome that. > > If anyone has a simple method, I would be very much interested. > > Thanks in Advance > > Regards > > Prashanth > 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 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/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/