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

Re: Buy X number of days before month-end and exit X number of days after


  • To: "Scott Gearhart" <omega-list@xxxxxxxxxx>
  • Subject: Re: Buy X number of days before month-end and exit X number of days after
  • From: "N&M Smith" <nmsmith@xxxxxxxxx>
  • Date: Mon, 25 Dec 2000 13:34:29 -0800

PureBytes Links

Trading Reference Links

The difficulty I found trying to write this was (without using hindsight)
knowing what day the last trading day of the month is going to be.
As I didn't know this I coded it to buy DsBefore(5) days before the last day
of the month.
The system does not know if any of those days fall on the weekend, so when
this occurs, there is one less day traded before the month end.
For the Exit, it is always DsAfter (5) trading days into the new month }

Written for Supercharts EOD in the Quickeditor, works ok transferring into
TS4 on Daily Data
Neville

{ Function  LeapYear_Q }
If year(Date)= 84 or year(Date)= 88 or year(Date)= 92 or year(Date)= 96 or
year(Date)= 00 or year(Date)= 04 then LeapYear_Q=1 else LeapYear_Q=0

{ Function  DaysInFeb_Q }
If month(date)= 2 and LeapYear_Q = 0 then DaysInFeb_Q = 28 else DaysInFeb_Q
= 29

{ Function  DaysInMonth_Q }
If month(date)<> 2 and month(date)=4 or month(date)=6 or month(date)=9 or
month(date)=11 then DaysInMonth_Q = 30 else DaysInMonth_Q=31

{ System  Month-End_Q }
Input: DsBefore(5),DsAfter(5);
IF (Month(Date)=2 and DayOfMonth(Date) >= DaysInFeb_Q - (2+DsBefore)) or
(Month(Date)<>2  and DayOfMonth(Date) >= DaysInMonth_Q - (2+DsBefore))
Then Buy at Market;
IF DayOfMonth(Date[DsAfter-1]) < DayOfMonth(Date[DsAfter]) Then ExitLong on
Close;
{ The System as written buys DsBefore(5) days before the last day of the
month, The system does not know if any of those days fall on the weekend, so
if one of those days is on a weekend, there is one less day traded before
the month end. For the Exit, it is always DsAfter(5) trading days into the
new month }


-----Original Message-----
From: Scott Gearhart <sgearhart1@xxxxxxxxxxx>
To: omega-list@xxxxxxxxxx <omega-list@xxxxxxxxxx>
Date: Saturday, December 23, 2000 1:31 PM
Subject: Buy X number of days before month-end and exit X number of days
after


>Does anyone have some code that will buy X number of days before month-end
and exit X
>number of days after month-end. I have SC and have not been able to program
 this
>system.
>Thanks

Attachment: Description: "Monthend.ela"