以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://www.weistock.com/bbs/list.asp?boardid=4)
----  不同品种变量赋值  (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=139334)

--  作者:90的硬币
--  发布时间:2016/9/8 13:42:19
--  不同品种变量赋值
后台模型监控多个期货品种,如何编写条件(不用全局函数extgbdataset和extgbdata):
 VARIABLE:n=0;
if  daima=cf00  then  n:=1;
if  daima=au00  then  n:=2;
..................
使代码能自动监测到当前刷到的是哪个品种,给n赋不同的值。

--  作者:jinzhe
--  发布时间:2016/9/8 13:47:37
--  
if  stricmp(stklabel,\'ag00\')=0  then  n:=1;
if  stricmp(stklabel,\'au00\')=0  then  n:=2;
if  stricmp(stklabel,\'cf00\')=0  then  n:=3;
if  stricmp(stklabel,\'rb00\')=0  then  n:=4;
if  stricmp(stklabel,\'ru00\')=0  then  n:=5;
这样的方法写,只要改品种代码就行