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

[amibroker] Re: Calendar Dates vs Trading Dates



PureBytes Links

Trading Reference Links

Peter,
You may create my CALCOUNTER ticker once, say from 1/1/2000 till 
31/12/2010 and update it by the 1st of 2011, supposed we will be 
healthy and happy [and still creative] this great day.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "bluesinvestor" <investor@xxxx> 
wrote:
> Yassas Dimitris,
> 
> While your code is shorter you would have to maintain the CALCOUNTER
> ticker daily.  This should get you where you want to go without the
> maintenance.
> 
> function Greg2Jul( d, m, y )
> {
> 	/*var y = parseFloat(cd2jdform.yearf.value)
>    var m = parseFloat(cd2jdform.monthf.value)
>    var d = parseFloat(cd2jdform.dayf.value)
>    var uh = parseFloat(cd2jdform.uthf.value)
>    var um = parseFloat(cd2jdform.utmf.value)
>    var us = parseFloat(cd2jdform.utsf.value)*/
> 	uh=12;
> 	um=0;
> 	us=0;
> 
>    extra = 100.0*y + m - 190002.5;
>    rjd = 367.0*y;
>    //rjd -= floor(7.0*(y+floor((m+9.0)/12.0))/4.0);
> 	rjd = rjd - floor(7.0*(y+floor((m+9.0)/12.0))/4.0);
>    //rjd += floor(275.0*m/9.0);
> 	rjd = rjd + floor(275.0*m/9.0);
>    //rjd += d;
> 	rjd = rjd + d;
>    //rjd += (uh + (um + us/60.0)/60.)/24.0;
> 	rjd = rjd + (uh + (um + us/60.0)/60.)/24.0;
>    //rjd += 1721013.5;
> 	rjd = rjd + 1721013.5;
>    //rjd -= 0.5*extra/abs(extra);
> 	rjd = rjd - 0.5*extra/abs(extra);
>    //rjd += 0.5;*/
> 	rjd = rjd + 0.5;
> 
> 	return rjd;
> }
> 
> C1=ValueWhen(L==Lowest(L),Cum(1));
> C2=ValueWhen(L==Lowest(L),Greg2Jul( Day(), Month(), Year() ));
> CAL=ValueWhen(Cum(1)==LastValue(Cum(1)),Greg2Jul( Day(), Month(), 
Year()
> ));
> 
> Filter=1;
> // AddColumn(Cum(1),"");AddColumn(CAL,"");
> // AddColumn(C1,"");AddColumn(C2,"");
> AddColumn(Cum(1)-C1,"TR DAYS",1.0);
> AddColumn(CAL-C2,"CAL DAYS",1.0);
> 
> Regards,
> Peter
> 
> PS  Would love to visit Greece ... was than an invite ;-)

> 
> -----Original Message-----
> From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...] 
> Sent: Thursday, May 01, 2003 5:37 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Calendar Dates vs Trading Dates
> 
> Example: we can count 140 trading and 204 calendar days from the 
> recent ^NDX lowest, exploring ^NDX for the n=1 last quotation with
> 
> CAL=Foreign("CALCOUNTER","V");
> C1=ValueWhen(L==Lowest(L),Cum(1));
> C2=ValueWhen(L==Lowest(L),CAL);
> Filter=1;
> // AddColumn(Cum(1),"");AddColumn(CAL,"");
> // AddColumn(C1,"");AddColumn(C2,"");
> AddColumn(Cum(1)-C1,"TR DAYS",1.0);
> AddColumn(CAL-C2,"CAL DAYS",1.0);
> DT
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" 
<TSOKAKIS@xxxx> 
> wrote:
> > Peter,
> > Peter,
> > A simple solution was to create in EXCEL a new ticker like
> > <TICKER>,<DDMMYYY>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>
> > CALCOUNTER,1/1/2000,1,1,	1,1,1
> > CALCOUNTER,2/1/2000,1,1,	1,1,2
> > CALCOUNTER,3/1/2000,1,1,	1,1,3
> > CALCOUNTER,4/1/2000,1,1,	1,1,4
> > CALCOUNTER,5/1/2000,1,1,	1,1,5
> > CALCOUNTER,6/1/2000,1,1,	1,1,6
> > CALCOUNTER,7/1/2000,1,1,	1,1,7
> > CALCOUNTER,8/1/2000,1,1,	1,1,8
> > ...
> > adding +1 for every new date in Volume field and import it.
> > Now, in IB I have two counters, the trading and the calendar days 
> with
> > Plot(Cum(1),"TRADING DAYS",1,1);
> > CAL=Foreign("CALCOUNTER","V");
> > Plot(CAL,"CALENDAR DAYS",4,8);
> > It requires the minimum [IMO] coding background.
> > Its use has only historical value after the DayOfYear() built-in 
> > function.
> > Will you visit  Greece this summer ?
> > Dimitris Tsokakis 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "bluesinvestor" <investor@xxxx> 
> > wrote:
> > > Dimitris and Ken,
> > > 
> > > Also see 
http://groups.yahoo.com/group/amibroker/message/39320 ...
> > > 
> > > Regards,
> > > Peter
> > > 
> > > -----Original Message-----
> > > From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...] 
> > > Sent: Wednesday, April 30, 2003 4:18 PM
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: [amibroker] Re: Calendar Dates vs Trading Dates
> > > 
> > > Ken,
> > > as I wrote, the code is not perfect, missing some weekends 
> falling 
> > on 
> > > the beginning of the month. It was the first idea. But, in the 
> mean 
> > > time, a new DayOfYear function is available to make these 
> > > calculations dirrect and simple.
> > > DT
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Ken Close" <closeks@xxxx> 
> wrote:
> > > > DT: thanks for the code....I will now compare it to 
> the "slightly"
> > > > longer Julian code that Bob J shared and see what happens.
> > > > 
> > > > Ken
> > > > 
> > > > -----Original Message-----
> > > > From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...] 
> > > > Sent: Wednesday, April 30, 2003 6:23 AM
> > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > Subject: [amibroker] Re: Calendar Dates vs Trading Dates
> > > > 
> > > > Ken,
> > > > the exploration [select current stock from Jan04, 2000 till 
now]
> > > > 
> > > > x=1+DateNum()-ValueWhen(Cum(1)==1,DateNum());
> > > > Cond=x-Ref(x,-1)>10;
> > > > diff=Cum(Cond*(x-Ref(x,-1)));
> > > > Counter=x-diff+(Year()-2000)*12+Month()-1;
> > > > Filter=1;
> > > > AddColumn(Counter,"COUNTER",1.0);
> > > > gives a good [not perfect yet] calendar counter.
> > > > DT
> > > > > -----Original Message-----
> > > > > From: Ken Close [mailto:closeks@x...]
> > > > > Sent: Tuesday, April 29, 2003 4:26 PM
> > > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > > Subject: RE: [amibroker] Calendar Dates vs Trading Dates
> > > > > 
> > > > > 
> > > > > Thanks Bob. I hope I get something more specific. I imagine 
> > there 
> > > is
> > > > > some manipulation of the DateNum() function but I have not 
> been 
> > > > able to
> > > > > figure it out.
> > > > > 
> > > > > Ken
> > > > > 
> > > > > -----Original Message-----
> > > > > From: Bob Jagow [mailto:bjagow@x...]
> > > > > Sent: Tuesday, April 29, 2003 4:34 PM
> > > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > > Subject: RE: [amibroker] Calendar Dates vs Trading Dates
> > > > > 
> > > > > I don't believe AB has a clue re calendar vs. trading days; 
> you 
> > > > need the
> > > > > difference in Julian days.
> > > > > If you don't want to use a JDay dll and only need to know, 
> for 
> > > > example,
> > > > > when the .75% Fido commission expires, consider a 30 days
> > > > > has Sept.... lookup.
> > > > > 
> > > > > Bob
> > > > > 
> > > > > -----Original Message-----
> > > > > From: Ken Close [mailto:closeks@x...]
> > > > > Sent: Tuesday, April 29, 2003 1:10 PM
> > > > > To: AmiBroker List
> > > > > Subject: [amibroker] Calendar Dates vs Trading Dates
> > > > > 
> > > > > 
> > > > > Help....I want to count the number of calendar days since a 
> buy 
> > or
> > > > > short...
> > > > > 
> > > > > I have read msg # 16104 about creating a For loop inside a 
> > > Jscript, 
> > > > but
> > > > > frankly can not understand what it is advising.
> > > > > 
> > > > > Can someone show me a simple way to determine the number of 
> > > calendar
> > > > > days that have elapsed?  Maybe the new For loop can help?
> > > > > 
> > > > > I want to code in a "close trade" flag if there are more 
than 
> x 
> > > > number
> > > > > of calendar days since the trade was initiated.  Because of 
> > other
> > > > > aspects of the code, I do not want to (can not) use the dll 
> > time 
> > > > stop
> > > > > that is in the files area.
> > > > > 
> > > > > Any help would really be appreciated.
> > > > > 
> > > > > Ken
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Send BUG REPORTS to bugs@xxxx
> > > > > Send SUGGESTIONS to suggest@xxxx
> > > > > -----------------------------------------
> > > > > Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx
> > > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > > --------------------------------------------
> > > > > Check group FAQ at:
> > > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > > 
> > > > > Your use of Yahoo! Groups is subject to
> > > > > http://docs.yahoo.com/info/terms/
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Send BUG REPORTS to bugs@xxxx
> > > > > Send SUGGESTIONS to suggest@xxxx
> > > > > -----------------------------------------
> > > > > Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx
> > > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > > --------------------------------------------
> > > > > Check group FAQ at:
> > > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > > 
> > > > > Your use of Yahoo! Groups is subject to
> > > > > http://docs.yahoo.com/info/terms/
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Send BUG REPORTS to bugs@xxxx
> > > > > Send SUGGESTIONS to suggest@xxxx
> > > > > -----------------------------------------
> > > > > Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx
> > > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > > --------------------------------------------
> > > > > Check group FAQ at: 
> > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > > 
> > > > > Your use of Yahoo! Groups is subject to 
> > > > http://docs.yahoo.com/info/terms/
> > > > 
> > > > 
> > > > 
> > > > Send BUG REPORTS to bugs@xxxx
> > > > Send SUGGESTIONS to suggest@xxxx
> > > > -----------------------------------------
> > > > Post AmiQuote-related messages ONLY to: 
> amiquote@xxxxxxxxxxxxxxx 
> > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > --------------------------------------------
> > > > Check group FAQ at:
> > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > > > 
> > > > Your use of Yahoo! Groups is subject to
> > > > http://docs.yahoo.com/info/terms/
> > > 
> > > 
> > > 
> > > Send BUG REPORTS to bugs@xxxx
> > > Send SUGGESTIONS to suggest@xxxx
> > > -----------------------------------------
> > > Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx 
> > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > --------------------------------------------
> > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > > 
> > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/O10svD/Me7FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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