開平倉問題
作者:MC 來源:cxh99.com 發布時間:2015年01月17日
- 咨詢內容:
本帖最后由 hangdoa 于 2014-10-15 13:57 編輯
滿足條件1平空倉一手,同時開多倉一手,滿足條件2時平多倉一手,同時開空倉一手,如何寫?
if condition1 then
Buy ( "BEntry" ) 1 share this bar at close ;
if (MarketPosition = 1) and condition2 then begin
sell from entry("BEntry") this bar at close;
end;
if condition2 then
Sell Short ( "SEntry" ) 1 share this bar at close ;
if (MarketPosition = -1) and condition1 then begin
buytocover from entry("SEntry") this bar at close;
end;
Sell Short優先如何用,盤中會出現2手的賣,且買有時不開倉啊?
- MC技術部:
if condition1 then
buy next bar at market;
if condition2 then
sellshort next bar at market;
buy /sellshort 在有倉位時是平倉反向 無倉位時是開倉