小幫手 我寫了一個腳本自動交易選逐筆洗價讓出場可以即時判斷
但進場條件想要K棒收完再判斷,請問再分K,該怎麼修改?
if CLOSE > average(C,length2) [1]
這樣的想法對嗎..?
///////進場條件(多方)//////
if CLOSE > average(C,length2) AND getSymbolField("tse.tw", "收盤價", "D")
//分K均線//
>average(getSymbolField("tse.tw", "收盤價", "D"),length)
AND value60 crosses over value70 and position = 0 and filled = 0 then setposition(2, market);
if value60 crosses below value70 and position = 2 and filled = 2 then setposition(0, market);
//////////出場/////
input: profit_point(1000, "停利(點)");//空方
input: loss_point(100, "停損(點)");//空方
if Position = -2 and Filled = -2 then begin
{ 依照成本價格設定停損/停利: 請注意當作空時, 判斷是否獲利的方向要改變 }
if profit_point > 0 and Close <= FilledAvgPrice - profit_point then begin
{ 停利 }
SetPosition(0);
end else if loss_point > 0 and Close >= FilledAvgPrice + loss_point then begin
{ 停損 }
SetPosition(0);
end;
end;



6 評論