if CurrentTime >= 084500 and CurrentTime <= 130000
Then begin
if Position = 0 and condition1 and condition3 and value1 > value10 then begin SetPosition(1, value1-10);
end;
if Position = 0 and condition5 and condition1 and condition3 and value1 < value10 then begin SetPosition(1, value1-10);
end;
if Position = 0 and condition6 and condition1 and condition3 and value1 < value10 then begin SetPosition(-1, value1+5);
end;
if Position = 0 and condition1 and condition4 then begin SetPosition(-1, value1+5);
end;
if Position = 0 and condition2 and condition3 then begin SetPosition(1, value1);
end;
if Position = 0 and condition7 and condition2 and condition4 then begin SetPosition(-1, value1+5);
end;
if Position = 0 and condition8 and condition2 and condition4 then begin SetPosition(1, value1-10);
end;
//出場狀況
input: profit_point(60, "停利(點)");
input: loss_point(25, "停損(點)");
if Position = 1 and Filled = 1 then begin
if Close < FilledAvgPrice - loss_point then begin SetPosition(0,market); { 停損 }
end;
if close >= FilledAvgPrice + profit_point then begin SetPosition(0,market); { 停利 }
end;
if Position = -1 and Filled = -1 then begin
if Close > FilledAvgPrice + loss_point then begin SetPosition(0,market);{ 停損 }
end;
if close <= FilledAvgPrice - profit_point then begin SetPosition(0,market);{ 停利 }
end;
進場觸發條件與買進後出場條件如上,目前想要設定能進場2次,如果達成停利的話,就只執行一次,如果先停損,就會執行第二次,
但目前不知道RaiseRunTimeError放在哪裡才能得到我要的效果,麻煩小幫手指點一下。
3 評論