以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  盈亏比例  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=139186)

--  作者:guohg129
--  发布时间:2016/9/6 10:14:01
--  盈亏比例

有哪个函数可以取买入的品种的盈亏比例?


--  作者:jinzhe
--  发布时间:2016/9/6 10:15:57
--  
函数PAYOFFRATE
--  作者:guohg129
--  发布时间:2016/9/6 10:26:48
--  

如果我的是某一特定品种的盈亏比呢,而且我是准备些在后台交易系统里,怎么写呢?

 

谢谢


--  作者:jinzhe
--  发布时间:2016/9/6 10:37:32
--  
这个需要计算得出了,还有这个品种盈亏比是只计算当天交易的吗?
--  作者:guohg129
--  发布时间:2016/9/6 10:49:18
--  

因为我的是日内交易策略,所以是计算当前的盈亏比,为了止损用


--  作者:jinzhe
--  发布时间:2016/9/6 11:05:30
--  

在用户的策略最后加上:

 

if tenterbars=1 and time<>extgbdata(stklabel+\'tt\') then begin

    if tnumprofit(1)>0 then extgbdataset(stklabel+\'ying\',extgbdata(stklabel+\'ying\')+tnumprofit(1));

    if tnumprofit(1)<0 then extgbdataset(stklabel+\'kui\',extgbdata(stklabel+\'kui\')+tnumprofit(1));

    extgbdataset(stklabel+\'tt\',time);

end

盈亏比:extgbdata(stklabel+\'ying\')/extgbdata(\'stklabel\'+kui);

 

 

if time=closetime(0) then begin

    extgbdataset(stklabel+\'ying\',0);

    extgbdataset(stklabel+\'kui\',0);

end