Rss & SiteMap

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

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

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

1楼
OscarDeng 发表于:2021/3/28 20:04:39
我使用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;
2楼
FireScript 发表于:2021/3/29 9:10:31
 ## 说明是无效值。通常是定义改变量的条件没有满足或者是数值无效。你这里应该是条件没有满足吧。
你不妨把几个条件定义成变量输出看下呢。
3楼
OscarDeng 发表于:2021/3/29 9:19:39
你不妨把几个条件定义成变量输出看下呢。  我已经测试定义过了, 在条件都变成1的情况下, BK4:=1; 还是没有被赋值。?  
我有十几条 IF THEN 语句对 BK4赋值,这个在语法上没有问题吧?
4楼
FireScript 发表于:2021/3/29 9:22:24
 语法上你定义多少个IF...THEN 都没问题。

帖一段能重现这个现象的代码吧。另外你是shift+q查看变量还是把变量输出到文本了。
5楼
OscarDeng 发表于:2021/3/29 11:26:32
shift+q 也查看查看, 另外用test::那些条件; 也输出过, 条件都能到1, 但是 BK4 就是没有赋值
6楼
FireScript 发表于:2021/3/29 13:14:10
 帖一段能测试的代码,我们本地测试下。
7楼
OscarDeng 发表于:2021/3/29 15:49:25
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    
8楼
FireScript 发表于:2021/3/29 16:02:30
 你这个嵌套了很多if 的啊。如果要触发
BK4:=1; 的赋值操作。  离这个语句最近的if满足是不够的,它外面好几层的if对应的条件都要满足才行啊。

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

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

也要满足五组条件才能执行到。
9楼
OscarDeng 发表于:2021/3/29 17:48:48

我即使满足所有条件测试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    

10楼
FireScript 发表于:2021/3/30 9:27:11
 你公式是不是勾选了序列模式?
共20 条记录, 每页显示 10 条, 页签: [1] [2]


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