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

RE: [amibroker] DayOfYear()



PureBytes Links

Trading Reference Links

Hello,

I don't know if this is what you are searching for...  
...and I hope this can help.

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

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+styleOwn
Scale+styleNoLabel);

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


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! Messenger: chiamate gratuite in tutto il mondo 
http://it.messenger.yahoo.com


------------------------ 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/