我想請問一下,以下腳本在進單時所記錄的當下低點“red_low",在print時為何都會此被記錄的低點的值都不一樣?
在if position = 0 and Filled = 0 成立後才進單才記錄此低點,此時的得到的低點的值不是已經被固定了嗎?怎麼會在print時都不一樣,感謝。
還有,既然已經if position = 0 and Filled = 0 了,接下來print出來的成本與部位應都是有值的才是,為何仍是0呢?
■腳本
if close[3] > open[3] and close[2] > open[2] and close[1] < open[1]
then begin
condition1= true;
end;
var:red_low(0); //進場低點
//多單
if position = 0 and Filled = 0
and condition1 = true
and close > open
then begin
SetPosition( 1, MARKET,label:="多單進場") ;
red_low = low ;
Print(file("C:\SysJust\XQLite\XS\Print\"),NumToStr(date,0),NumToStr(time,0),"《",SymbolName,"》","多單進場","成本",NumToStr(FilledAvgPrice,0),"部位",NumToStr(position,0),"filledfilled",filled);
print(file("C:\SysJust\XQLite\XS\Print\"),"時間:",NumToStr(time,0),"《",SymbolName,"》","進場紅K低點",red_low,"red_low_time",red_low_time);
end;
■以下為print出來的文字:
20221019 101100 《 小型台指近月 》 多單進場 成本 0 部位 0 filledfilled 0.000000
時間: 101100 《 小型台指近月 》 進場紅K低點 13093.000000
20221019 101400 《 小型台指近月 》 多單進場 成本 0 部位 0 filledfilled 0.000000
時間: 101400 《 小型台指近月 》 進場紅K低點 13102.000000
20221019 102200 《 小型台指近月 》 多單進場 成本 0 部位 0 filledfilled 0.000000
時間: 102200 《 小型台指近月 》 進場紅K低點 13097.000000
20221019 102800 《 小型台指近月 》 多單進場 成本 0 部位 0 filledfilled 0.000000
時間: 102800 《 小型台指近月 》 進場紅K低點 13116.000000
20221019 104100 《 小型台指近月 》 多單進場 成本 0 部位 0 filledfilled 0.000000
時間: 104100 《 小型台指近月 》 進場紅K低點 13094.000000

3 評論