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

Re: Perpetual Contracts



PureBytes Links

Trading Reference Links


You can't get intraday data on the perpetual contracts - can you?

BTW - Compuserve has perpetual contract data.  It's not cheap data - but
it's very clean.  Robyn

=================================

No intraday perp is not available unless you know exceptionally brilliant
programers.

Credits to Rich Estrem

since TraderWare will have this as a standard available data I wont be
needing this much longer, so enjoy everyone.  It may change your life. mb

=================================




{for Mark Brown - bond perpetual contract User function. call this every bar
and use it to base signals on.
Actual trades should be done on data1 real-time, but signals are based on
this perpetual data series.
This function will return the close of data4 (historical ascii file) up
until new month becomes front month,
then it returns perpetual data calculated here using data1,2,3 files.
USperp.csv file must be updated thru
the last trade day of old month. This should be done after the close on last
day of old month.

data required:
 data1 = hourly bars of current front month.
 data2 = daily bars of current front month.
 data3 = daily bars of next exp. month.
 date4 = USperp.csv ascii file, hourly data. setup as 8:00am-3:00pm trade
times

input rolldate: set this to the first date which new month becomes front.
}

input:rolldate(numeric);
vars:xdate(0),jd1(0),x(0),len(90),daysto0(0),eom(0),count(0),dow(0),daydif(0
),adjust(0);

value1=DeliveryMonth data2;
value2=DeliveryYear data2;
if value1=9 or value1=6 then value10=30 else value10=31;
eom=value2*10000 + value1*100 + value10;  {last day of month of expiration
in YYMMDD format}

{find date 7+5 business days back from eom:}
if currentbar=1 then begin  {only need to do this once}
 value4=datetojulian(eom);
 count=0;
 x=1;
  while count < 12 begin
  value5=juliantodate(value4-x);
  dow=dayofweek(value5);
  if dow < 6 and dow > 0 then count=count+1;  {found a trade day}
  if count=12 then xdate=juliantodate(value4-x);  {this is date that this
contract weight goes to 0}
  x=x+1;
 end;
end;

daysto0=DateToJulian(xdate) - DateToJulian(Date);
if daysto0 > 91 then daysto0=91;
daydif=c data2 - c data3;
adjust=daydif * ((91-daysto0)/91);

if d >= rolldate then USperp=c-adjust else USperp= c data4;