以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 高级功能研发区 (http://weistock.com/bbs/list.asp?boardid=5) ---- VBA解释器的一个 BUG (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=58110) |
-- 作者:Marcus -- 发布时间:2013/10/28 16:14:58 -- VBA解释器的一个 BUG Function IsTradingTime(sMarket, iTime) If sMarket="ZJ" then IsTradingTime= iTime>91500+5 and iTime<113000-5 or iTime>130000+5 and iTime<151500-5 Elseif sMarket="DQ" or sMarket="ZQ" then IsTradingTime= iTime>90000+5 and iTime<101500-5 or iTime>103000+5 and iTime<113000-5 or iTime>133000+5 and iTime<150000-5 Elseif sMarket="SQ" then IsTradingTime= iTime>90000+5 and iTime<101500-5 or iTime>103000+5 and iTime<113000-5 or iTime>133000+5 and iTime<1410000-5 or iTime>142000+5 and iTime<150000-5 Else IsTradingTime= 0 End if End Function 调用语句 ddd=IsTradingTime("SQ", 151530) Application.MsgOut(ddd) 返回值-1,预期值为0 |
-- 作者:王锋 -- 发布时间:2013/10/28 16:54:50 -- 在VBA中,的true跟false不是我们在C++中的 1和0,true在VBA中的值就是 -1 的,你的代码返回返回 -1说明你的代码存在逻辑错误。 建议你在IsTradingTime函数中多使用Application.MsgOut调试看看每个步骤及返回值查找问题 |