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

Re: function



PureBytes Links

Trading Reference Links

I just noticed an error in my post:

> 1.  Record the date as you go.  This lets you know that N bars ago 
> was the 43rd trading day or whatever, but you can't ask "what was the 
> Nth trading day of 1999."
>   if Year(Date) <> Year(Date[1]) then TradeDate = 1;
>   if Date <> Date[1] then TradeDate = TradeDate + 1;

That should be:

   if Year(Date) <> Year(Date[1]) then TradeDate = 0; { *** }
   if Date <> Date[1] then TradeDate = TradeDate + 1;

... since the Date <> Date[1] test will succeed on Jan 2 (or 
whatever) after the Year test has set TradeDate to 0, thus setting 
TradeDate to 1 on Jan 2.

Gary




  • References: