
請問各位大大們,關於移動停利的疑問,我有列印資料看 更新後 BOUT 理論上應該 只會向上移動,但卻是會變動,應該在移動在獲利點上 出場卻沒有 一直獲利不出場 ,有時出場不是更新後 BOUT 而是原始的BOUT價,求助大大們幫忙^,^
// 初始化變數
var:BCost(0),BOUT(0);
input: move_profit_point(10, "移動停利(點)");
input: loss_point(30, "停利損(點)");
//運算區=============================
//邏輯區=============================
///////////////多方進場參數//////////////////////////
if isfirstcall("Bar") and position = 0 and FILLED = 0 AND condition1 and Average(VAlue3,3) >50 then begin
setposition(1,market);
Print("進場條件成立: 當前價格=", Close, ", Value3 平均=", Average(Value3, 3));
end;
IF position = 1 and filled = 1 THEN BEgin
BCost=filledAvgPrice;//進場成本點
BOUT=BCost-loss_point;//出場點停損30點
Print("進場成功: BCost=", BCost, ", BOUT=", BOUT);
end;
/////////////移動停利/////////////////////////
if position = 1 and filled = 1 then begin //MKP=1 代表 手上有單
if C > BCost + move_profit_point then begin
if C - loss_point > BOUT then begin
BOUT= C - loss_point;
Print("移動停利: 當前價格=", C, ", 更新後 BOUT=", BOUT);
end;
end;
end;
/////////////出場/////////////////////////
IF position = 1 and filled = 1 then begin
if currentTime>TimeAdd(Time,"S",50) then begin //BAR的最後55秒才判定要出場
// 若收盤價跌破停損點,出場
if Close < BOUT then begin
Print("出場條件成立: 收盤價=", Close, ", BOUT=", BOUT);
SetPosition(0,Market); // 平倉
end;
end;
END;

13 評論