想請教小編 我嘗試寫一段1.12分~18分
先觸發我的第一條掛內盤第1檔,
但目前遇到瓶頸,如果掛完單瞬間又拉超過我停損位(1.5%)時,
變成會先觸發第三條停損條件而不會觸發第二條,
我該怎麼讓它第一條沒有成交的部位刪單,
寫了第二條原本預期的環境,因為第一條先觸發回補變成position=0 filed= -1,想法是position <> filed
但我目前測試以模擬單改成觸發環境(改手上成本直接讓它超過1.5%),
試了一些想法似乎都不會觸發第二條,會先觸發第三條,
這樣就變成position = filled,我該怎麼解決這個問題呢,
如果寫成position=0 是不是也不太對?
我18分後有另外寫直接市價回補 也是以position<>filed為條件
但就會先刪掉第一條再市價買進(如果順順沒觸發停損位的話)
目前不知道為什麼第二條都不會觸發
(原本是用最笨的方法,時間一到直接market,這樣只要寫一行,但長期都會賠一檔,
所以來嘗試以掛單的方式,資質愚鈍有點碰壁,再請教各位指點了 謝謝)
再此附上腳本
不好意思上來請教一下 謝謝
if currentTime > 131210 and currentTime < 131800 then begin
1.if (position = filled and close <= FilledAvgPrice*1.015 and filled <= -1)
or (position = filled and price_change < 7.7 and close <= FilledAvgPrice*1.015 and filled <= -1)
then SetPosition(0,Value98);
2.if (position <> filled and close > FilledAvgPrice*1.015)
or (position <> filled and price_change > 7.7) then setposition(filled);
3.if (filled <= -1) and (close >= FilledAvgPrice*1.015 or price_change >= 7.7 or close < FilledAvgPrice*0.925 or price_change <= -8.5) then SetPosition(0,market);
end;
Value98=內盤第一檔
price_change = 漲跌幅
4 評論