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

Re: Converting intraday code into a user-friendly TS array



PureBytes Links

Trading Reference Links

Why not use the "OpenD" userfunction from Omega library.

Code below:

Good trading to all.

Maxime




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

 Function  : OpenD

 Last Edit : 10/3/96

 Provided By : Omega Research, Inc. (c) Copyright 1996

 Returns the Open of the Day based on IntraDay Data.  Returns a -1
 when not on IntraDay Data or when not available.  Input allows you to
 specify which day.  OpenD(0) returns Open for currentday.
 OpenD(1) returns Open of 1 day ago. You may refer up to a maximum
 of 50 days ago.

********************************************************************}
Inputs: DaysAgo(Numeric);
Array: OpenArray[50](-1);

If DataCompression < 2 then begin
 If Date > Date[1]  then begin
  for Value1=50 downto 1 begin
   OpenArray[Value1]=OpenArray[Value1-1];
  end;
  OpenArray[0]=Open;
 End;
 If DaysAgo<=50 then OpenD=OpenArray[DaysAgo];
End;






----- Original Message -----
From: "Robert Bianchi" <r.bianchi@xxxxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Thursday, November 16, 2000 14:58
Subject: Converting intraday code into a user-friendly TS array


> Hi All,
> The below code grabs the opening price on intraday data at the start of
> each trading session (assuming 1 trading session per day) and stores these
> opening prices for the last 5 days.
>
> {INTRADAY CODE TO STORE THE OPENING PRICE}
> Vars:
> VEN_ID_OpenPrice0(0),
> VEN_ID_OpenPrice1(0),
> VEN_ID_OpenPrice2(0),
> VEN_ID_OpenPrice3(0),
> VEN_ID_OpenPrice4(0);
>
> If Date>Date[1] then begin
> VEN_ID_OpenPrice4 = VEN_ID_OpenPrice3;
> VEN_ID_OpenPrice3 = VEN_ID_OpenPrice2;
> VEN_ID_OpenPrice2 = VEN_ID_OpenPrice1;
>            VEN_ID_OpenPrice1 = VEN_ID_OpenPrice0;
>            VEN_ID_OpenPrice0 = Open;
> End;
>
> Plot1(VEN_ID_OpenPrice0,"Open[0]");
> Plot2(VEN_ID_OpenPrice1,"Open[1]");
> Plot3(VEN_ID_OpenPrice2,"Open[2]");
> Plot4(VEN_ID_OpenPrice3,"Open[3]");
>
> My question is, can anyone show me how to change this code into a TS array
> so that:-
> * these opening prices become easier to reference.
> * I can reference any opening price as far back as I want to go. For .e.g.
> I want to use the opening price of 10 days ago.
>
> Any help or insight on this issue would be great !!
>
> Thanking you in advance,
>
> Robert Bianchi
>