各位大神您們好,我想要寫停損5%後出場,但我遇到問題是出場後馬上就進場了,我想要當天出場後要隔一天才重新計算,我設定進場條件為昨日外資買超>300張,請問我程式碼要怎麼改呢,以下是我的程式碼
input: loss_percent(5, "停損(%)"); value1=getField("外資買賣超","D")[1]; condition1=value1>300; if condition1 and position=0 then begin setposition(1); print("進場價格",close,"進場日期與時間",date,currentTime); end; if position <> 0 then begin if loss_percent > 0 and //停損 Close <= FilledAvgPrice*(1-0.01*loss_percent) then begin print("出場價格:",close,"出場時間:",date,currentTime,"停損出場","。停損區間",FilledAvgPrice*(1-0.01*loss_percent)); SetPosition(0, label:="停損出場"); end; end;
3 評論