Here is the indicator code that I'm using:
Code: Select all
Inputs:
Directory("C:\Users\name\Trading\Futures\ContContracts"),
WriteOk(true),
PriceDecimals(2),
BeginDate(0);
Vars:
FileName(Directory + "\" + GetSymbolName + ".txt"),
S("");
if WriteOk then
if CurrentBar = 1 then begin
FileDelete(FileName);
S = "Date,Time,Close,";
FileAppend(FileName, S + NewLine);
end;
if Date >= BeginDate then begin
S = Text(ELDateToString(Date),",",
Formattime("HH:mm:ss.MMM", DateTime),",",
NumToStr(Close, PriceDecimals));
FileAppend(FileName, S + NewLine);
end;
Plot1(0, "Save Ticks");
- 02/16/2014,18:50:44.MMM,3662.75
02/16/2014,18:51:02.MMM,3663.00
02/16/2014,18:51:37.MMM,3663.75
02/16/2014,18:51:39.MMM,3663.50
02/16/2014,18:52:01.MMM,3663.75
02/16/2014,18:52:02.MMM,3663.75
2) The FileDelete command isn't working. If I run the indicator an additional time, the output is appended to the end of the existing file. I'd like the old file to be deleted first, then a new file created. Any ideas?