<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Calendar day index</title>
	<atom:link href="http://www.amibroker.com/kb/2007/03/15/calendar-day-index/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amibroker.com/kb/2007/03/15/calendar-day-index/</link>
	<description>Providing you with tips &#038; tricks for everyday AmiBroker use</description>
	<lastBuildDate>Tue, 29 Mar 2011 08:43:54 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: GP</title>
		<link>http://www.amibroker.com/kb/2007/03/15/calendar-day-index/comment-page-1/#comment-1418</link>
		<dc:creator>GP</dc:creator>
		<pubDate>Mon, 11 Jun 2007 07:45:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/15/calendar-day-index/#comment-1418</guid>
		<description>Here&#039;s a version of TotalDays that handles leap years correctly:

function TotalDays()
{
    yy = Year();
    dy = DayOfYear();
    LastLeapYear = (yy % 4) == 1 &amp;&amp; yy != 2001;
    YearChg = yy != Ref(yy, -1);
    YearChg = IIf(IsNull(YearChg), False, YearChg);
    YearLen = IIf(YearChg, IIf(LastLeapYear, 366, 365), 0);
    return Cum(YearLen) + dy - dy[0];
}</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a version of TotalDays that handles leap years correctly:</p>
<p>function TotalDays()<br />
{<br />
    yy = Year();<br />
    dy = DayOfYear();<br />
    LastLeapYear = (yy % 4) == 1 &amp;&amp; yy != 2001;<br />
    YearChg = yy != Ref(yy, -1);<br />
    YearChg = IIf(IsNull(YearChg), False, YearChg);<br />
    YearLen = IIf(YearChg, IIf(LastLeapYear, 366, 365), 0);<br />
    return Cum(YearLen) + dy &#8211; dy[0];<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GP</title>
		<link>http://www.amibroker.com/kb/2007/03/15/calendar-day-index/comment-page-1/#comment-1414</link>
		<dc:creator>GP</dc:creator>
		<pubDate>Thu, 07 Jun 2007 22:55:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/15/calendar-day-index/#comment-1414</guid>
		<description>There seems to me to be a slight problem with the leap year calculation here. The statement yearlen*(yy-yy[0]) multiplies all previous years by the number of days in the current year, so on leap years, all previous years are assumed to have had 366 days. This is going to make TotalDays return a few more days than it should on leap years, and a few less days than it should on other years, once yy-yy[0] has spanned a few leap years. It would not make much difference to RefDays though unless the number of days was large (multiple years).</description>
		<content:encoded><![CDATA[<p>There seems to me to be a slight problem with the leap year calculation here. The statement yearlen*(yy-yy[0]) multiplies all previous years by the number of days in the current year, so on leap years, all previous years are assumed to have had 366 days. This is going to make TotalDays return a few more days than it should on leap years, and a few less days than it should on other years, once yy-yy[0] has spanned a few leap years. It would not make much difference to RefDays though unless the number of days was large (multiple years).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://www.amibroker.com/kb/2007/03/15/calendar-day-index/comment-page-1/#comment-1405</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Sun, 03 Jun 2007 02:05:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/15/calendar-day-index/#comment-1405</guid>
		<description>Thanks for this Tomasz. How can the code below be altered to show trading days as well?

&quot;In the last example I want to show how to calculate number of calendar days in a range selected using begin/end markers (double click to mark begin and double click again to mark end)&quot;</description>
		<content:encoded><![CDATA[<p>Thanks for this Tomasz. How can the code below be altered to show trading days as well?</p>
<p>&#8220;In the last example I want to show how to calculate number of calendar days in a range selected using begin/end markers (double click to mark begin and double click again to mark end)&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomasz Janeczko</title>
		<link>http://www.amibroker.com/kb/2007/03/15/calendar-day-index/comment-page-1/#comment-1219</link>
		<dc:creator>Tomasz Janeczko</dc:creator>
		<pubDate>Thu, 29 Mar 2007 08:37:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/15/calendar-day-index/#comment-1219</guid>
		<description>It is this &quot;wordpress&quot; changing the letters. Argghh... should be i - - (i minus minus)</description>
		<content:encoded><![CDATA[<p>It is this &#8220;wordpress&#8221; changing the letters. Argghh&#8230; should be i &#8211; - (i minus minus)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cam</title>
		<link>http://www.amibroker.com/kb/2007/03/15/calendar-day-index/comment-page-1/#comment-1218</link>
		<dc:creator>Cam</dc:creator>
		<pubDate>Thu, 29 Mar 2007 02:43:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.amibroker.com/kb/2007/03/15/calendar-day-index/#comment-1218</guid>
		<description>TJ, the code above creates an error message on the following line:

for( i = BarCount -1; i &gt;= -Days; i– )</description>
		<content:encoded><![CDATA[<p>TJ, the code above creates an error message on the following line:</p>
<p>for( i = BarCount -1; i &gt;= -Days; i– )</p>
]]></content:encoded>
	</item>
</channel>
</rss>

