今天测试时,发现竟然上同一秒进行开仓,平仓,平仓条件其实设得很简单就8%止赢,1%止损,代码如下
if dk then
begin
tsellshort(k_holding,lots,mkt);
tbuy(1,lots,mkt);
end;
if ttype(1)=1 and tisremain(0)=0 and tisremain(1)=0 then //上次是开多信号,并且无未成交委托
begin
dzy:=100*(c-tenterprice)/tenterprice>zyd;
dzs:=100*(tenterprice-c)/tenterprice>zsd;
dp:=dzy or dzs;
if dp then tsell(1,lots,mkt);
end;
那么我可以理解为在计算当前tick时,即使当前k线有发出开多信号,tenterprice仍是取8月16日的开仓价?(根据上传的图)
http://www.weistock.com/bbs/dispbbs.asp?BoardID=4&ID=1246&replyID=&skin=1
输出下tenterprice看看,啥时候进行变化
原本这种情况也不经常遇到。tenterprice是成交了之后才开始变化的。但是后面程序是用tisremain来确保它是成交了,照理说不会出现这样的情况啊。。