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

EL code for spreads



PureBytes Links

Trading Reference Links

I wrote the following code to export an ascii file of the high low and
close of a spread, derived from intraday data (close of data1 - close of
data2.) This seems to work, but I would like to include data from the whole
day of trading not just session 1 start time until session 1 end time. Any
ideas?
(The reason for doing this is to be able to apply indicators that use the
high and low as well as the close without rewriting all those indicators
specifically for spreads.)

Thanks,
David Cicia

Input: Folder("D:\Data\Spreads\"), Name("TED"), Ext(".txt"); 
Var:  Sclose(0), SprdHigh(0), SprdLow(0), XFILE(" ");

XFILE = Folder + Name + Ext;

If  time = sess1starttime  +  barinterval  then begin
   SprdHigh =(c of data1 - c of data2);
   end;
If (c of data1 - c of data2) > SprdHigh then SprdHigh = (c of data1 - c of
data2);
If  time = sess1endtime then begin
Fileappend(Xfile, NumToStr(Date[1],0) + "  " + NumToStr(SprdHigh,4));
end;

If  time = sess1starttime + barinterval then begin
   SprdLow = (c of data1 - c of data2);
   end;
If (c of data1 - c of data2) < SprdLow then SprdLow = (c of data1 - c of
data2);
If  time = sess1endtime then begin
Fileappend(Xfile,  "  " + NumToStr(SprdLow,4));
end;

   Sclose = (c of data1 - c of data2);
If time = sess1endtime then begin
Fileappend(Xfile, "  " + NumToStr(Sclose,4)+Newline);
end;

If currentbar = 1 then begin
Filedelete(xfile);
end;