开平仓问题
作者: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 在有仓位时是平仓反向 无仓位时是开仓