情况是:一、 图表交易 给出开空信号 成交 持仓空单 然后手动平仓 持仓为0 下次给出平空开多 没有开出多单
二、图表交易 给出开空信号 由于其他原因(比如账号掉线等其他情况)没有开出空单 手动加一手空单 持仓空单 下次给出平空开多 空单没有平 多单没有开
老师 这种两种情况怎么解决
本质就是 实际持仓和虚拟持仓的同步问题
代码如下:
sell(duop and holding>0,0,MARKET);
sellshort(kongp and holding<0,0,market);
buy(duo and holding=0,仓位,market);
buyshort(kong and holding=0,仓位,market);
求帮助解决
关于1的问题,本地测试一下,我认为是可以下单的
关于2,出信号后我也认为是能够平空开多的
请贴出完整的公式代码
[此贴子已经被作者于2013-4-11 11:07:10编辑过]
duop:=kong and o>ref(jsj,1); kongp:=duo and o<ref(jsj,1);
sell(duop and holding>0,0,MARKET);
sellshort(kongp and holding<0,0,market);
buy(duo and holding=0,仓位,market);
buyshort(kong and holding=0,仓位,market);
//时间在14:58分强平离场
if time>=151000 then
begin
if holding>0 then sell(1,0,market);
if holding<0 then sellshort(1,0,market);
end
a1:=callstock(stklabel,vtamount,6,0);
v1:=callstock(stklabel,vtvol,6,0);
jsj:=a1/v1/multiplier;