你好,
如題我的寫法在跑盤中時,會出現有無窮迴圈的錯誤,可否指導一下?謝
var: intrabarpersist last_seqno(0); // 上次洗價時最後一筆Tick的SeqNo
var: curr_seqno(0); // 這次洗價時最後一筆Tick的SeqNo
if Date <> CurrentDate then return; // 只跑今日的資料
curr_seqno = GetField("SeqNo", "Tick"); // 最新一筆Tick編號
if last_seqno = 0 then last_seqno = curr_seqno - 1; // 第一次洗價時只洗當時那一筆
var: seq_no(0), offset(0);
seq_no = curr_seqno;
offset = 0;
var:intraBarPersist b1(0),intraBarPersist s1(0);
var:intraBarPersist CountBS(0),intraBarPersist Count0(0),intraBarPersist Event_time1(0);
while seq_no > last_seqno begin
// 讀取Tick資料
value1 = GetField("Time", "Tick")[offset];
value4 = GetField("BidAskFlag", "Tick")[offset];
b1 =GetField("BidPrice", "Tick")[offset];//買1
s1 =GetField("AskPrice", "Tick")[offset];//賣1
if b1[4] = b1[6] then Event_time1 = time;
if b1 = b1[2] and b1[2] = b1[4] and b1[4] = b1[6]
and time - Event_time1 <=7
then
begin
ret = 1 ;
retmsg ="委買委賣互換3次(6秒內)";
print(date,time,"委買委賣互換3次(6秒內)","此時買1",b1);
end;
end; {end while}
8 評論