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

Re: [amibroker] Re: DayOfYear()



PureBytes Links

Trading Reference Links

For simple results, just do an explore with monthly settings
use filter to select the month you want
include whatever calculated variable you want in the columns
may = iif(c>ref(c,-1),1,iif(c<ref(c,-1),-1,0));

filter = month()==5;
addcolumn( may, "month", 1 );


you can then expand this to become cumulative using the Cum function

may = iif(c>ref(c,-1),1,iif(c<ref(c,-1),-1,0));
cummay = cum( may );
cumnum = cum( month()==5);

filter = month()==5;
addcolumn( may, "month", 1 );
addcolumn( cummay/cumnum, "ratio", 1 );


hopefully no typing errors or errors of logic, buty should be enough
to give you an idea

--
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 10/20/05, zoli_j <novizoli@xxxxxxxxxxx> wrote:
> Thx for your help and for your script, but this is not exactly, what
> I think about...
>
> I would like to examine if there is some correlation between months
> (or weeks or days) and price moving...
>
> For example:
> Januar: "JANUAR EFFECT" generally rising
> May: "SELL IN MAY AND GO AWAY!" generally falling
> September, Oktober: "WEAKEST MONTHS" generally falling
>
> I would like to Plot the
> (the falled May from 1927 til now) / (CurrentYear-1927)
>
> For example:
> Date : Rise/Fall => (SumOfRisedOrFalledMayMonths / SumOfMayMonths)
> 1928.may : down(-1) => (-1) / (1) = -1
> 1929.may : down(-1) => (-2) / (2) = -1
> 1930.may : down(-1) => (-3) / (3) = -1
> 1931.may : up(1)    => (-2) / (4) = -0.5
> 1932.may : down(-1) => (-3) / (5) = -0.6
> 1933.may : up(1)    => (-2) / (6) = -0.33
> 1933.may : down(-1) => (-3) / (7) = -0.42
> ..
> 2005.may : up(1)    => (-38) / (77) = -0.49
>
> I would like to see this Series:
> MaysOfYears = -1;-1;-1;-0.5;-0.6;-0.33;-0.42
>
> It would be good to see a characteristic about the months(or weeks
> or days) performance...
>
> Do you have any Idea?
>
> BR Zoli.
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Antonio Marra" <antmar65@xxxx>
> wrote:
> >
> > Hello,
> >
> > I don't know if this is what you are searching for...
> > ...and I hope this can help.
> >
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxx
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxx
> >
> > First_Day_Of_The_Year  = ( Month() == 1 ) AND Month() != Ref(Month
> (), -1);
> > Second_Day_Of_The_Year = ValueWhen(First_Day_Of_The_Year, BarIndex
> ()) +1;
> > Third_Day_Of_The_Year  = ValueWhen(First_Day_Of_The_Year, BarIndex
> ()) +2;
> >
> > Open_1Day  = ValueWhen(First_Day_Of_The_Year,Open);
> > Close_1Day = ValueWhen(First_Day_Of_The_Year,Close);
> >
> > Open_2Day  = ValueWhen(BarIndex()==Second_Day_Of_The_Year, Open);
> > Close_2Day = ValueWhen(BarIndex()==Second_Day_Of_The_Year, Close);
> >
> > Open_3Day  = ValueWhen(BarIndex()==Third_Day_Of_The_Year, Open);
> > Close_3Day = ValueWhen(BarIndex()==Third_Day_Of_The_Year, Close);
> >
> >
> > Status_1Day = IIf ( Close_1Day > Open_1Day, 1, 0);
> > Status_2Day = IIf ( Close_2Day > Open_2Day, 1, 0);
> > Status_3Day = IIf ( Close_3Day > Open_3Day, 1, 0);
> >
> > // If all the 3 days are Positive then Sum_Status == 3
> > // If all the 3 days are Negative then Sum_Status == 0
> > Sum_Status = (Status_1Day+Status_2Day+Status_3Day);
> >
> > // If all the 3 days are Positive then Status_All3Days == 100
> > // If all the 3 days are Negative then Status_All3Days == 0
> > Status_All3Days = IIf( Sum_Status == 3, 100,
> >                   IIf( Sum_Status == 2, 66.66,
> >                   IIf( Sum_Status == 1, 33.33, 0)));
> >
> >
> > SEARCH_Conditions = (
> >                      First_Day_Of_The_Year
> >                      //AND BarIndex() == Second_Day_Of_The_Year
> >                      //AND BarIndex() == Third_Day_Of_The_Year
> >
> >                      //AND Status_All3Days == 33.33
> >                     );
> >
> > Filter = SEARCH_Conditions;
> >
> >
> > AddColumn(Status_1Day,"Status_1Day",1.0);
> > AddColumn(Status_2Day,"Status_2Day",1.0);
> > AddColumn(Status_3Day,"Status_3Day",1.0);
> >
> > AddColumn(Status_All3Days,"Status_All3Days ",1.2);
> >
> >
> > Plot(C, "Price", IIf (SEARCH_Conditions, colorWhite,
> colorGrey40),styleBar);
> > Plot
> (SEARCH_Conditions,"",colorLightGrey,styleDashed+styleHistogram+style
> Own
> > Scale+styleNoLabel);
> >
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxx
> > //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxx
> >
> >
> > You can do an exploration on "All Quotations", for a single
> symbol, for
> > example.
> >
> > Regards,
> >       Antonio
> >
> >
> >
> > -----Original Message-----
> > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
> On Behalf
> > Of zoli_j
> > Sent: Wednesday, October 19, 2005 4:22 PM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] DayOfYear()
> >
> > I would like to do a yearly statistic to show if the first and
> second
> > and third day of the year rised or falled is.
> >
> > "
> > for(i=1; i < 366; i++) {
> >  myDayOfYear[i] = 0;
> > }
> >
> > for(i=1; i < 366; i++) {
> >  if(i==DayOfYear()) {
> >    myDayOfYear = myDayOfYear + ROC(C,1);
> >  }
> > }
> >
> > Plot(myDayOfYear, "myDayOfYear", colorRed, styleHistogram);
> > "
> >
> > Could anybody help me?
> >


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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