Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:老师帮我检查一下,后台程式全局变量这种写法是否有问题

1楼
IF左边 发表于:2016/12/16 15:43:08
if duo and extgbdata(stklabel+'bn1')=0  then begin
   tbuy(1,手数,mkt);
   extgbdataset(stklabel+'bn1',1);
   extgbdataset(stklabel+'bn15',手数);
   extgbdataset(stklabel+'bdcs',0);
   end

if l<=tENTERPRICE-z*s  and tENTERBARS>0 and extgbdata(stklabel+'bn1')=1 and extgbdata(stklabel+'bdcs')=0 and extgbdata(stklabel+'bn15')<>0 then begin
 tsell(1,extgbdata(stklabel+'bn15'),mkt);
 extgbdataset(stklabel+'bn1',0);
  extgbdataset(stklabel+'bn15',0);
  extgbdataset(stklabel+'bdcs',1);

 end其中 extgbdataset(stklabel+'bdcs',0)这种写法和后面的extgbdata(stklabel+'bdcs')=0是否重复没有意义。是否应该这样写:

if duo and extgbdata(stklabel+'bn1')=0  then begin
   tbuy(1,手数,mkt);
   extgbdataset(stklabel+'bn1',1);
   extgbdataset(stklabel+'bn15',手数);
   extgbdataset(stklabel+'bdcs',1);
   end

if l<=tENTERPRICE-z*s  and tENTERBARS>0 and extgbdata(stklabel+'bn1')=1 and extgbdata(stklabel+'bdcs')=1 and extgbdata(stklabel+'bn15')<>0 then begin
 tsell(1,extgbdata(stklabel+'bn15'),mkt);
 extgbdataset(stklabel+'bn1',0);
  extgbdataset(stklabel+'bn15',0);
  extgbdataset(stklabel+'bdcs',0);
2楼
jinzhe 发表于:2016/12/16 15:49:44

这两句代码是做什么用的,为什么你会觉得重复没意义

3楼
IF左边 发表于:2016/12/16 15:52:13
不需要定义extgbdataset(stklabel+'bdcs',0)的情况下,extgbdata(stklabel+'bdcs')=0也是成立的,所以是否是多此一举了
4楼
jinzhe 发表于:2016/12/16 15:55:35

是的,不定义也是0。如果你没有其他的赋值动作,只有这一句判断,也是可以不用写赋值。

如果有其他赋值之类的,就要写,这样可以重新赋值为0

5楼
IF左边 发表于:2016/12/16 16:06:35
有其他赋值,按后面这种写法才是对的吧
if duo and extgbdata(stklabel+'bn1')=0  then begin
   tbuy(1,手数,mkt);
   extgbdataset(stklabel+'bn1',1);
   extgbdataset(stklabel+'bn15',手数);
   extgbdataset(stklabel+'bdcs',1);
   end

if l<=tENTERPRICE-z*s  and tENTERBARS>0 and extgbdata(stklabel+'bn1')=1 and extgbdata(stklabel+'bdcs')=1 and extgbdata(stklabel+'bn15')<>0 then begin
 tsell(1,extgbdata(stklabel+'bn15'),mkt);
 extgbdataset(stklabel+'bn1',0);
  extgbdataset(stklabel+'bn15',0);
  extgbdataset(stklabel+'bdcs',0);
开仓后赋值(stklabel+'bdcs')=1,extgbdata(stklabel+'bdcs')=1的情况下才允许有平仓动作。

6楼
jinzhe 发表于:2016/12/16 16:17:32
可以
共6 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.04688 s, 3 queries.