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

Re: Help on exits



PureBytes Links

Trading Reference Links

At 3:53 AM -0500 1/4/99, Geko wrote:

>I am trying to write an exit statement for a TSytem (data1=30'; data2=60')
>based on the high & low of the first hour of trading session, but seem to be
>having some difficutly.
>
>Basically, I am trying to construct an exit where if today's open is <>
>Low/High of yesterday's first hour, the system exitshort at "L first
>hour[1]" or exitlong at "H first hour[1]".
>


It is hard to understand what you are trying to do but you might try
something like the attached code. Rather than use all the Omega functions,
it seems easier to just calculate and save the prices you want.

I don't know if you want stop or limit orders or if the exit criteria are
what you wanted but this structure should be generally OK.

Bob Fulks


{ *******************************************************************

   System:       _Geko

   Last Edit:    1/5/99

   Coded By:     Bob Fulks

********************************************************************}

Vars: Active(FALSE), HHigh(0), LLow(0), DHigh(0), DLow(0);


{Initialize on a new day}
if Date <> Date[1] then begin
   Active = FALSE;
   HHigh = High;
   LLow = Low;
   if Open < DLow  then ExitShort at DLow  stop;
   if Open > DHigh then ExitLong  at DHigh stop;
end;

HHigh = iff(High > HHigh, High, HHigh);
LLow  = iff(Low < LLow, Low, LLow);

if Time >= 1030 and Active = FALSE then begin
   Active = TRUE;
   DHigh = HHigh;
   DLow = LLow;
end;