欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 输出无效值##的问题

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有3262人关注过本帖树形打印复制链接

主题:输出无效值##的问题

帅哥哟,离线,有人找我吗?
OscarDeng
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
输出无效值##的问题  发帖心情 Post By:2021/3/28 20:04:39    Post IP:58.246.57.26[只看该作者]

我使用IF THEN 语句对 BK4赋值, 但是输出结果BK4 一直是##, 这是为什么? 要怎样修改?


IF DIFF60<-30 AND DIFF60>-70 AND DIFF15>-30 AND PV4 THEN BK4:=1;
IF DIFF60<-30 AND DIFF15>-70 AND PV4  THEN BK4:=1;
IF DIFF60<=-30 AND DIFF60>-70 AND DIFF15>5 AND PV4 THEN BK4:=1;

 回到顶部
帅哥哟,离线,有人找我吗?
FireScript
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2021/3/29 9:10:31    Post IP:58.246.57.26[只看该作者]

 ## 说明是无效值。通常是定义改变量的条件没有满足或者是数值无效。你这里应该是条件没有满足吧。
你不妨把几个条件定义成变量输出看下呢。


命数如织,当如磐石。
 回到顶部
帅哥哟,离线,有人找我吗?
OscarDeng
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
  发帖心情 Post By:2021/3/29 9:19:39    Post IP:61.140.231.197[只看该作者]

你不妨把几个条件定义成变量输出看下呢。  我已经测试定义过了, 在条件都变成1的情况下, BK4:=1; 还是没有被赋值。?  
我有十几条 IF THEN 语句对 BK4赋值,这个在语法上没有问题吧?

 回到顶部
帅哥哟,离线,有人找我吗?
FireScript
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2021/3/29 9:22:24    Post IP:58.246.57.26[只看该作者]

 语法上你定义多少个IF...THEN 都没问题。

帖一段能重现这个现象的代码吧。另外你是shift+q查看变量还是把变量输出到文本了。


命数如织,当如磐石。
 回到顶部
帅哥哟,离线,有人找我吗?
OscarDeng
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
  发帖心情 Post By:2021/3/29 11:26:32    Post IP:61.140.231.197[只看该作者]

shift+q 也查看查看, 另外用test::那些条件; 也输出过, 条件都能到1, 但是 BK4 就是没有赋值

 回到顶部
帅哥哟,离线,有人找我吗?
FireScript
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2021/3/29 13:14:10    Post IP:58.246.57.26[只看该作者]

 帖一段能测试的代码,我们本地测试下。


命数如织,当如磐石。
 回到顶部
帅哥哟,离线,有人找我吗?
OscarDeng
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
  发帖心情 Post By:2021/3/29 15:49:25    Post IP:61.140.231.197[只看该作者]

IF DIFFMON>-8 THEN BEGIN
IF DIFFWEEK>-200 THEN BEGIN
IF DIFFDAY>-10 THEN BEGIN
IF (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*12 AND 60MINMACD3NV距离>60*4*12 AND 60MIN量价NV3距离>60*4*12 AND 60MIN量价NV距离>60*12 OR 价格背离后下跌) THEN BEGIN
    IF DIFF60>-10 AND DIFF15>-15 AND DIFF5>-7 AND PV3  THEN BK3:=1;
    END
      IF (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) THEN BEGIN
    IF DIFF60>-10 AND DIFF15>-15 AND DIFF5>-7   AND PV4 THEN BK4:=1;
    IF DIFF60>-10 AND DIFF15>-20 AND PV3  THEN BK3:=1;
    END
    IF (60MINMACDNV距离>60*4*12  AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌) THEN BEGIN
    IF DIFF60>-30 AND PV4 THEN BK4:=1;
    IF DIFF60<-30 AND DIFF15>-70 AND PV4  THEN BK4:=1;
    END
END             
IF DIFFDAY>-30 AND DIFFDAY<=-10 THEN BEGIN
IF (60MINMACDNV距离>60*4*12 AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌) THEN BEGIN
IF DIFF60>-30 AND DIFF15>-40 AND PV4 THEN BK4:=1;  //此处用-40, 而没有用-30 是做一个缓冲
IF DIFF60>-30 AND DIFF15<=-40 AND DIFF15>-100 AND PV3 THEN BK3:=1;
IF DIFF60<-30 AND DIFF60>-70 AND DIFF15>-30 AND PV4 THEN BK4:=1;
IF DIFF60<-30 AND DIFF60>-70 AND DIFF15<=-30 AND DIFF15>-70 AND PV3 THEN BK3:=1;
END
    IF (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) THEN BEGIN
    IF DIFF60>-30 AND DIFF15>-30 AND PV3 THEN BK3:=1;
IF DIFF60>-30 AND DIFF15<=-30 AND DIFF15>-100 AND PV2 THEN BK2:=1;
IF DIFF60<-30 AND DIFF60>-70 AND DIFF15>-30 AND PV3 THEN BK3:=1;
IF DIFF60<-30 AND DIFF15>-70 AND DIFF15<=-30  AND DIFF15>-70 AND PV2 THEN BK2:=1;
END
END
IF DIFFDAY>-150 AND DIFFDAY<=-30 THEN BEGIN
IF DIFF60>-30 AND DIFF15>0 AND PV4 THEN BK4:=1;
IF DIFF60>-30 AND DIFF15>-30 AND DIFF15<=0 AND (60MINMACDNV距离>60*4*12 AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌)AND PV4 THEN BK4:=1;
IF DIFF60>-30 AND DIFF15<=-30 AND DIFF15>-70 AND PV3 THEN BK3:=1;
IF DIFF60<=-30 AND DIFF60>-70 AND DIFF15>5 AND PV4 THEN BK4:=1;
IF DIFF60<=-30 AND DIFF60>-70 AND DIFF15>-20  AND DIFF15>0 AND PV4 AND (60MINMACDNV距离>60*4*12 AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌) THEN BK4:=1;
IF DIFF60<=-30 AND DIFF60>-70 AND DIFF15<=-20 AND DIFF15>-70 AND PV3 THEN BK3:=1;
IF DIFF60<=-70 AND DIFF60>-150 AND DIFF15>-20 AND PV3 THEN BK3:=1;
IF DIFF60<=-70 AND DIFF60>-150 AND DIFF15<=-20 AND DIFF15>-70 AND PV2 THEN BK2:=1;
IF DIFF60<=-150 AND (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) AND PV2 THEN BK2:=1;
IF DIFF60<=-150 AND PV0 THEN BK1:=0;
END
END
END
IF DIFFMON<=-8 AND DIFFMON>-120 THEN BEGIN
IF DIFFWEEK>-50 THEN BEGIN
IF DIFFDAY>-150 AND PV1 THEN BK1:=1;
IF DIFFDAY<=-150 AND PV0 THEN BK0:=1;
END
    IF DIFFWEEK<=-50 AND DIFFWEEK>-200 THEN BEGIN
    IF DIFFDAY>-150 AND PV1 THEN BK1:=1;
    IF DIFFDAY<=-150 AND (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) AND PV0 THEN BK0:=1;
    END
END
IF DIFFMON<=-120 THEN BEGIN
IF DIFFWEEK>-50 AND DIFFDAY>-20 AND (60MINMACDNV距离>60*12*4  AND 60MIN量价NV距离>60*12  OR 价格背离后下跌) AND PV1 THEN BK1:=1;
IF DIFFWEEK>-50 AND DIFFDAY>-120 AND (60MINMACDNV距离>60*12*4  AND 60MIN量价NV距离>60*12  OR 价格背离后下跌) AND PV0 THEN BK0:=1;
IF DIFFWEEK<=-50 AND DIFFWEEK>-200 AND DIFFDAY>-20 AND (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) AND PV0 THEN BK0:=1;
END    

 回到顶部
帅哥哟,离线,有人找我吗?
FireScript
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2021/3/29 16:02:30    Post IP:58.246.57.26[只看该作者]

 你这个嵌套了很多if 的啊。如果要触发
BK4:=1; 的赋值操作。  离这个语句最近的if满足是不够的,它外面好几层的if对应的条件都要满足才行啊。

你这些语句里面最近的一个赋值

图片点击可在新窗口打开查看此主题相关图片如下:temp.png
图片点击可在新窗口打开查看

也要满足五组条件才能执行到。


命数如织,当如磐石。
 回到顶部
帅哥哟,离线,有人找我吗?
OscarDeng
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
  发帖心情 Post By:2021/3/29 17:48:48    Post IP:61.140.231.197[只看该作者]


我即使满足所有条件测试test1和test2 , 都不能输出1. 

if  1 then test1:=1;
IF (60MINMACDNV距离>60*4*12  AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌) AND  DIFFMON>-8 AND DIFFWEEK>-200 AND DIFFDAY>-10 AND DIFF60>-30 AND PV4 THEN TEST2:1;
test3:(60MINMACDNV距离>60*4*12  AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌) AND  DIFFMON>-8 AND DIFFWEEK>-200 AND DIFFDAY>-10 AND DIFF60>-30 AND PV4;


con1:DIFF60>-10 AND DIFF15>-15 AND DIFF5>-7  AND PV4;
con2:DIFF60>-30 AND PV4;

IF DIFFMON>-8 THEN BEGIN
IF DIFFWEEK>-200 THEN BEGIN
IF DIFFDAY>-10 THEN BEGIN
IF (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*12 AND 60MINMACD3NV距离>60*4*12 AND 60MIN量价NV3距离>60*4*12 AND 60MIN量价NV距离>60*12 OR 价格背离后下跌) THEN BEGIN
    IF DIFF60>-10 AND DIFF15>-15 AND DIFF5>-7 AND PV3  THEN BK3:=1;
    END
      IF (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) THEN BEGIN
    IF DIFF60>-10 AND DIFF15>-15 AND DIFF5>-7   AND PV4 THEN BK4:=1;
    IF DIFF60>-10 AND DIFF15>-20 AND PV3  THEN BK3:=1;
    END
    IF (60MINMACDNV距离>60*4*12  AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌) THEN BEGIN
    IF DIFF60>-30 AND PV4 THEN BK4:=1;
    IF DIFF60<-30 AND DIFF15>-70 AND PV4  THEN BK4:=1;
    END
END             
IF DIFFDAY>-30 AND DIFFDAY<=-10 THEN BEGIN
IF (60MINMACDNV距离>60*4*12 AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌) THEN BEGIN
IF DIFF60>-30 AND DIFF15>-40 AND PV4 THEN BK4:=1;  //此处用-40, 而没有用-30 是做一个缓冲
IF DIFF60>-30 AND DIFF15<=-40 AND DIFF15>-100 AND PV3 THEN BK3:=1;
IF DIFF60<-30 AND DIFF60>-70 AND DIFF15>-30 AND PV4 THEN BK4:=1;
IF DIFF60<-30 AND DIFF60>-70 AND DIFF15<=-30 AND DIFF15>-70 AND PV3 THEN BK3:=1;
END
    IF (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) THEN BEGIN
    IF DIFF60>-30 AND DIFF15>-30 AND PV3 THEN BK3:=1;
IF DIFF60>-30 AND DIFF15<=-30 AND DIFF15>-100 AND PV2 THEN BK2:=1;
IF DIFF60<-30 AND DIFF60>-70 AND DIFF15>-30 AND PV3 THEN BK3:=1;
IF DIFF60<-30 AND DIFF15>-70 AND DIFF15<=-30  AND DIFF15>-70 AND PV2 THEN BK2:=1;
END
END
IF DIFFDAY>-150 AND DIFFDAY<=-30 THEN BEGIN
IF DIFF60>-30 AND DIFF15>0 AND PV4 THEN BK4:=1;
IF DIFF60>-30 AND DIFF15>-30 AND DIFF15<=0 AND (60MINMACDNV距离>60*4*12 AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌)AND PV4 THEN BK4:=1;
IF DIFF60>-30 AND DIFF15<=-30 AND DIFF15>-70 AND PV3 THEN BK3:=1;
IF DIFF60<=-30 AND DIFF60>-70 AND DIFF15>5 AND PV4 THEN BK4:=1;
IF DIFF60<=-30 AND DIFF60>-70 AND DIFF15>-20  AND DIFF15>0 AND PV4 AND (60MINMACDNV距离>60*4*12 AND 60MIN量价NV距离>60*4*12 OR 价格背离后下跌) THEN BK4:=1;
IF DIFF60<=-30 AND DIFF60>-70 AND DIFF15<=-20 AND DIFF15>-70 AND PV3 THEN BK3:=1;
IF DIFF60<=-70 AND DIFF60>-150 AND DIFF15>-20 AND PV3 THEN BK3:=1;
IF DIFF60<=-70 AND DIFF60>-150 AND DIFF15<=-20 AND DIFF15>-70 AND PV2 THEN BK2:=1;
IF DIFF60<=-150 AND (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) AND PV2 THEN BK2:=1;
IF DIFF60<=-150 AND PV0 THEN BK1:=0;
END
END
END
IF DIFFMON<=-8 AND DIFFMON>-120 THEN BEGIN
IF DIFFWEEK>-50 THEN BEGIN
IF DIFFDAY>-150 AND PV1 THEN BK1:=1;
IF DIFFDAY<=-150 AND PV0 THEN BK0:=1;
END
    IF DIFFWEEK<=-50 AND DIFFWEEK>-200 THEN BEGIN
    IF DIFFDAY>-150 AND PV1 THEN BK1:=1;
    IF DIFFDAY<=-150 AND (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) AND PV0 THEN BK0:=1;
    END
END
IF DIFFMON<=-120 THEN BEGIN
IF DIFFWEEK>-50 AND DIFFDAY>-20 AND (60MINMACDNV距离>60*12*4  AND 60MIN量价NV距离>60*12  OR 价格背离后下跌) AND PV1 THEN BK1:=1;
IF DIFFWEEK>-50 AND DIFFDAY>-120 AND (60MINMACDNV距离>60*12*4  AND 60MIN量价NV距离>60*12  OR 价格背离后下跌) AND PV0 THEN BK0:=1;
IF DIFFWEEK<=-50 AND DIFFWEEK>-200 AND DIFFDAY>-20 AND (60MINMACDNV距离>60*12 AND 60MINMACD2NV距离>60*4*12  AND 60MIN量价NV距离>60*12  AND 60MIN量价NV3距离>60*4*12 OR 价格背离后下跌) AND PV0 THEN BK0:=1;
END    


 回到顶部
帅哥哟,离线,有人找我吗?
FireScript
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2021/3/30 9:27:11    Post IP:58.246.57.26[只看该作者]

 你公式是不是勾选了序列模式?


命数如织,当如磐石。
 回到顶部
总数 20 1 2 下一页