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

Re: Print to CSV File



PureBytes Links

Trading Reference Links

STGI> So  I  guess  is what I need is an ELA that spits out:
STGI> DATE,  TIME,  OPEN,  HIGH,  LOW, CLOSE in a CSV format
STGI> Every 5-minutes.

    Make  use of FileAppend and MOD. For my uses, I read the
    .csv file using a Visual Basic routine, and as long as I
    write the VB code to open the .csv file as Read Only, it
    won't interfere with TS's writing process.

Inputs: FName("C:\STG.csv");

Vars: sym(""), strng("");

If Mod(Time,5)=0 then begin
  sym = GetSymbolName;
  strng = sym+","+NumToStr(Date,0)+","+NumToStr(Time,0)
    +","+NumToStr(Open,2)...<you get the idea..>;
  FileAppend(FName,strng+newline);

End;

You  can  throw  in  a FileDelete(FName) at the start of the
code  or  for each 5 minute interval, if you'd like to start
with a clean slate.

-- 
Dave Nadeau
Fort Collins, CO