謝謝許教授。
它好像在K棒內,由1變成0。
例如:
20251208 90000 ---> 0 // 型態shintai= 1
20251208 90000 ---> 1 // 型態shintai= 0
20251208 90000 ---> 1 // 型態shintai= 0
20251208 90300 ---> 1 // 型態shintai= 0
我的部分程式碼如下,註解於該程式碼上方//,
如有需要補充,麻煩再請您告知。
SetBarBack(2);
var:intraBarPersist shintai(0),intraBarPersist BuWei(0);
BuWei=Filled;
if date<>date[1] then
begin
shintai=0;
End;
//===================================================================================================================
//進場條件
condition1=Time>=090000 and Time<123000 and Filled=0 and
CloseD(1)=GetField("漲停價", "D")[1] and GetField("C", "tick")>C[1] ;
if shintai=0 and condition1 then
begin
shintai=1;
SetPosition(1,Market);
End;
BuWei=Filled;
//===================================================================================================================
//出場
//漲跌停
if Time<132400 and BuWei<>0 and
{(} GetField("C", "Tick")>AddSpread(GetField("漲停價", "D"),-2) then
begin
SetPosition(0, Market);
end;
//停利
if Time<132400 and shintai=1 and filled>0 and GetField("C", "tick")>=FilledAvgPrice*1.015 then
begin
SetPosition(0,Market);
end;
if Time<132400 and shintai=1 and filled>0 and GetField("C", "1")<FilledAvgPrice*0.98 then
begin
SetPosition(0,Market);
end;
BuWei=Filled;
//===================================================================================================================
Print(
NumToStr(date,0),NumToStr(time,0),"--->",
NumToStr(BuWei,0),
"// 型態shintai=",NumToStr(shintai,0)
);
//===================================================================================================================
5 評論