以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  怎么查询当前仓位盈亏情况  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=76464)

--  作者:gzarmstrong
--  发布时间:2015/3/14 0:34:42
--  怎么查询当前仓位盈亏情况
怎么查询当前仓位盈亏情况?包括:总盈利亏损多少?平均每手盈亏多少?
--  作者:jinzhe
--  发布时间:2015/3/16 9:05:18
--  

variable:n=0,m=0,k=0;

if 平空条件  and holding<0 then begin

    sellshort(1,0,market);

    if numprofit(1)<0 then n:=n+numprofit(1);

    if numprofit(1)>0 then m:=m+1;

    k:=K+1;

end

 

if 平多条件  and holding<0 then begin

    sell(1,0,market);

    if numprofit(1)<0 then n:=n+numprofit(1);

    if numprofit(1)>0 then m:=m+1;

    k:=K+1;

end

总盈利:m;

总亏损:n;

总交易次数:k;

平均盈利:(m+n)k;