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

Re: ELA DATES HELP PLEASE



PureBytes Links

Trading Reference Links

> I am using TS4 Build27 (I had to give up on Prosuite 2000i)
> For seasonal trading,  I need to code an entry like;
> "If the date is between the first trading day after jan 9 through the
> last trading day of Feb, then take a long entry  at 10 ticks above the
> 12 day high STOP; 

Greg, the date part of this is fairly simple.  The trick is to use the 
Month() and DayOfMonth() functions to ignore the year.  You could 
use something like this:

vars: OneTick(MinMove points);
if (Month(Date)=1 and DayOfMonth(Date)>9) or Month(Date)=2 then
  buy at highest(High,12)+10*OneTick stop

Note the parentheses carefully.  You need them around the 
January test so the "month=jan" and "day>9" tests are grouped 
together.

The OneTick variable is a trick to calculate the point value of one 
tick in your current market.  EL uses points, not ticks, but the 
OneTick variable will contain the point value of one tick.

(I'm assuming you're running daily data.  If not, then 
Highest(High,12) would compute the high of the last 12 BARS, not 
the last 12 DAYS.)

This example is pretty easy because you just have to catch the 
latter part of January with one test, and all of Feb with another.  If 
you wanted to get more complex, you could just add more tests.  
For example, let's say you wanted to test for a date between Jan 
15 and Sep 13 inclusive:

if (Month(Date)=1 and DayOfMonth(Date) >= 15)
  or (Month(Date) >=2 and Month(Date) <= 8)
  or (Month(Date)=9 and DayOfMonth(Date) <= 13) then ...

Gary