Hi Sir,
交易範例基本語法"05-FilledAvgPrice以及停損停利範例" 程式中 "long_condition(false); { 是否做多 }" 是否多餘?感覺不會執行? 因為都是 false,對嗎?
==
var:
long_condition(false); { 是否做多 }
if Position = 0 and long_condition then SetPosition(1);
if Position = 1 and Filled = 1 then begin
{ 多單已經買進1口 }
{ 計算損益% }
var: plratio(0);
{
請注意: 不管Filled是大於0還是小於0, FilledAvgPrice的數值都是'正數'(>0)
}
plratio = 100 * (Close - FilledAvgPrice) / FilledAvgPrice;
if plratio >= 1.5 then SetPosition(0);{ 停利 }
if plratio <= -1.5 then SetPosition(0);{ 停損 }
end;
==
1 評論