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

RE: Trading day of the month



PureBytes Links

Trading Reference Links

Probably not unless you define a holiday list of your own in easy language,
one definition per stock exchange with different holidays that you trade, at
least there is not an easy way in TS100. There is a bug in the function
Businessdays.

My problem since the holidays has been that a system I have does not behave
as it should when holidays appears (like christmas eve). The code that goes
wrong can be simplified to:

if Date=juliantodate(BusinessDays(datetojulian(dateToBuy),2,-1)) then
   buy next bar at pricetobuyat stop;

An easy way to test the code is placing it in an indicator with some
parameters:
Inputs: DateToBuy(990101),NumberOfShares(200),PriceToBuyAt(200);
if Date=juliantodate(BusinessDays(datetojulian(dateToBuy),2,-1)) then
   Buy("PortfolioBuy") NumberOfShares contracts Next bar at PriceToBuyAt
stop;

Testing the indicator using dates preceded by nontrading days, and dates
preceded by trading days give erratic behavior on these nontrading days that
are special holidays.

Going through the traditional bug reporting procedure with Omega, I have
past all the mandatory stages from this not being reproducable to this not
being a bug to this not currently featured.

Their last stement is below:
>EasyLanguage does not currently provide a means to reference empty bars.
>However, the difference between that and what you describe is Julian.
>Julian calculations see every day of the year, regardless of it being a
>weekend or holiday or not on the chart at all.  What you need to do is
check
>that the value returned by this expression 
>
>	juliantodate(BusinessDays(datetojulian(DateToBuy),2,-1))
>
>is not equal to a day found in a pre-defined holiday list.  EasyLanguage
>does not currently provide a means to reference the holiday list in the
>GlobalServer.  Thus, you would have to create your own function with a list
>of holidays.  For example, the following sample function must be named
>Holiday.
>
>	Input: cDate(Numeric);
>	Array: HolidayList[3](0);
>	Variable: aSize(3);
>
>	If CurrentBar = 1 then begin 
>		HolidayList[1] = 980101;
>		HolidayList[2] = 980704;
>		HolidayList[3] = 981225;
>		{add more if needed}
>	End;
Even though Omega claims the problem to lie within JulianToDate, it is very
clear that the bug they have in TS100 is in the function Businessdays, which
actually does not look at any holiday list at all.