有哪个函数可以取买入的品种的盈亏比例?
如果我的是某一特定品种的盈亏比呢,而且我是准备些在后台交易系统里,怎么写呢?
谢谢
因为我的是日内交易策略,所以是计算当前的盈亏比,为了止损用
在用户的策略最后加上:
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