The show code runs as a signal and shall monitor the current order status.
Is was before part of the system itself, but I found it can run independently. Same problem was already before.
Code: Select all
[IntrabarOrderGeneration = false]
{ Name: UW_ATS_Monitor
Task: Supervise broker status. Show current order status by
means of three files:
S2.txt for Short
L2.txt for Long
S2.txt or Flat
files are copied afterwards by means of robocopy into a cloud folder
start Robocopy %Source_Path1% %Target_Path2% /PURGE /MOT:5 /mon:2 /RH:0745-2230 /PF
last change 15.01.2015 }
Vars:
Path1("D:\Users\myName\Documents\Multicharts\Debug\mySystem\"),
Trace_Path("D:\Users\\myName\Documents\Multicharts\Debug\HmySystem\"),
Lenovo_Path3("C:\Users\\myName\Documents\Multicharts\Debug\mySystem"),
FileName(""),
tmpName("ATS_Monitor"),
PValue(false),
Status_FileName("F.txt"),
Debug_T(True), Debug_F(False), Lenovo(false);
if CurrentBar=1 Then begin
// to identify the product machine (I use 2 computers)
PValue=ELC.PathExists(Lenovo_Path3);
If PValue then Lenovo=true;
if Lenovo Then begin
Trace_Path = Lenovo_Path3 + "\";
end;
end;
// +-+-+-+-+-+-+-+-+- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
if Date = CurrentDate and BarStatus(1) = 2 and time > 0830 and time < 1700 then begin
// If ELC.PathExists(Trace_path + Status_FileName) Then
// FileDelete(Trace_path + Status_FileName);
if MarketPosition_at_Broker < 0 then Status_FileName = "S2.txt";
if MarketPosition_at_Broker = 0 then Status_FileName = "F2.txt";
if MarketPosition_at_Broker > 0 then Status_FileName = "L2.txt";
//
if Debug_T then begin // instead of FileAppend
FileDelete(Trace_path + "F2.txt");
FileDelete(Trace_path + "L2.txt");
FileDelete(Trace_path + "S2.txt");
Print(File(Trace_path + Status_FileName),
DateToString(DateToJulian(Date)) + Spaces(2) +
TimeToString(ELTimeToDateTime(Time)) + " " +
NumtoStr(Close,2) + " Profit/Loss: " +
NumtoStr(i_ClosedEquity,2) + Newline);
end;
end; // CurrentDate
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
So always only 1 file should exist. F2.txt, S2.txt or L2.txt.
In fact the deleting works when starting the program, but during run time I can see that files are created or updated, but after a while I have three files instead of 1. Very surprising.
Does anybody have an idea for this behaviour?
regards
Wally_AD