[求助] 单语句函数嵌套层次太多 [通达信]
-
咨询内容:
我的通达信一个公式出现了‘详细信息 : 单语句函数嵌套层次太多!建议分多条语句编写 ’的问题,拜托各位老师给我修改一下,不胜感激!
以下是源码:
A1:=DATE <= 1170615;
A2:=(100 * (CLOSE - (MA(CLOSE,30)))) / (MA(CLOSE,30));
A3:=100 - ((90 * ((HHV(HIGH,20)) - CLOSE)) / ((HHV(HIGH,20)) - (LLV(LOW,20))));
A4:=100 - (MA(((100 * ((HHV(HIGH,6)) - CLOSE)) / ((HHV(HIGH,6)) - (LLV(LOW,6)))),28));
A5:=MA(A4,6);
红持股:IF((A3 < A5),A5,A3),COLORRED;
绿持币:IF((A3 > A5),A5,A3),COLORGREEN;
强弱:(A5),LINETHICK1,COLORYELLOW;
A6:=(3 * (SMA((((CLOSE - (LLV(LOW,27))) / ((HHV(HIGH,27)) - (LLV(LOW,27)))) * 100),5,1))) - (2 * (SMA((SMA((((CLOSE - (LLV(LOW,27))) / ((HHV(HIGH,27)) - (LLV(LOW,27)))) * 100),5,1)),3,1)));
A7:=(10);
百万测底:((CROSS(A6,A7)) * 75) * A1,LINETHICK2,COLOR0000FF;
A8:=(REF(CLOSE,1)) / CLOSE;
A9:=MIN((MA(((AMOUNT / VOL) / 100),15)),(EMA(((AMOUNT / VOL) / 100),15)));
A10:=((1 - ((SMA(((LOW * A8) - (A8 / 10)),6,1)) / (EMA(((AMOUNT / VOL) / 100),15)))) * 100) - (100 / 10);
A11:=((((1 - ((MA((LOW - (A8 / 10)),6)) / A9)) * (DMA(CLOSE,(VOL / CAPITAL)))) / (MA(LOW,6))) * 100) - (100 / 10);
A12:=((((A10 + (A11 / 10)) > 0) AND (DATE > 1000101)) AND (DATE < 1991231)) AND ((COUNT((((1 - (CLOSE / (REF(CLOSE,1)))) > 0.099) AND ((1 - ((REF(CLOSE,1)) / (REF(CLOSE,2)))) > 0.099)),20)) < 3);
A13:=(((((((A10 + (A11 / 10)) > -3.688) AND (DATE > 1000101)) AND (DATE < 1991231)) AND ((CLOSE / (REF(CLOSE,1))) > 1.02)) AND ((COUNT((((1 - (CLOSE / (REF(CLOSE,1)))) > 0.099) AND ((1 - ((REF(CLOSE,1)) / (REF(CLOSE,2)))) > 0.099)),20)) < 3)) AND (((REF(CLOSE,1)) / (REF(CLOSE,2))) < 0.95)) AND ((CLOSE / (HHV(HIGH,20))) < 0.855);
灵桥黑马:((IF(((((100 < 100) AND ((A10 + (A11 / 10)) > 0)) AND (DATE > 1000101)) AND (DATE < 1991231)),(A12 = 1),(A13 = 1))) * 100) * A1,LINETHICK2,COLORRED;
A14:=EMA(CLOSE,8);
A15:=EMA(A14,20);
A16:=CROSS(A14,A15);
A17:=A14 < (EMA(CLOSE,120));
大波黑马起步:((A16 AND A17) * 75) * A1,LINETHICK2,COLORYELLOW;
A18:=SUM((IF((CLOSE > (REF(CLOSE,1))),VOL,(IF((CLOSE < (REF(CLOSE,1))),(0 - VOL),0)))),0);
A19:=SUMBARS(VOL,CAPITAL);
A20:=(IF((CLOSE > (LLV(CLOSE,A19))),1,-1)) * (IF((A18 > (LLV(A18,A19))),1,-1));
A21:=IF((A20 = -1),1,0);
A22:=(COUNT((A21 = 1),8)) > 2;
A23:=((SUM(AMOUNT,13)) / ((AMOUNT / VOL) / 100)) / 100;
A24:=DMA((((((3 * HIGH) + LOW) + OPEN) + (2 * CLOSE)) / 7),(VOL / A23));
A25:=(((CLOSE - A24) / A24) * 100) < -15;
A26:=((CLOSE - (MIN(((REF(CLOSE,5)) * 0.865),((REF(CLOSE,21)) * 0.772)))) / CLOSE) < 0.05;
A27:=REF(LOW,1);
A28:=((SMA(ABS((LOW - A27)),3,1)) / (SMA((MAX((LOW - A27),0)),3,1))) * 100;
A29:=EMA((IF((CLOSE * 1.2),(A28 * 10),(A28 / 10))),3);
A30:=LLV(LOW,38);
A31:=HHV(A29,38);
A32:=IF((LLV(LOW,90)),1,0);
A33:=((EMA((IF((LOW <= A30),((A29 + (A31 * 2)) / 2),0)),3)) / 618) * A32;
(STICKLINE(A33,0,A33,6,1)) ,COLORBLUE;
底部不买你后悔:(IF(((A25 AND A26) AND A22),60,0)) * A1;
以下是测试结果:
当前公式 : 财神出现 (指标画线公式)
错误句 :
A13:=(((((((A10 + (A11 / 10)) > -3.688) AND (DATE > 1000101)) AND (DATE < 1991231)) AND ((CLOSE / (REF(CLOSE,1))) > 1.02)) AND ((COUNT((((1 - (CLOSE / (REF(CLOSE,1)))) > 0.099) AND ((1 - ((REF(CLOSE,1)) / (REF(CLOSE,2)))) > 0.099)),20)) < 3)) AND (((REF(CLOSE,1)) / (REF(CLOSE,2))) < 0.95)) AND ((CLOSE / (HHV(HIGH,20))) < 0.855)
详细信息 : 单语句函数嵌套层次太多!建议分多条语句编写
错误起始位置 : 1430 ; 长度: 3
来源:C X H 9 9 .C O M )
-
通达信技术部:
以下是源码: A1:=DATE <= 1170615; A2:=(100 * (CLOSE - (MA(CLOSE,30)))) / (MA(CLOSE,30)); A3:=100 - ((90 * ((HHV(HIGH,20)) - CLOSE)) / ((HHV(HIGH,20)) - (LLV(LOW,20)))); A4:=100 - (MA(((100 * ((HHV(HIGH,6)) - CLOSE)) / ((HHV(HIGH,6)) - (LLV(LOW,6)))),28)); A5:=MA(A4,6); 红持股:IF((A3 < A5),A5,A3),COLORRED; 绿持币:IF((A3 > A5),A5,A3),COLORGREEN; 强弱:(A5),LINETHICK1,COLORYELLOW; A6:=(3 * (SMA((((CLOSE - (LLV(LOW,27))) / ((HHV(HIGH,27)) - (LLV(LOW,27)))) * 100),5,1))) - (2 * (SMA((SMA((((CLOSE - (LLV(LOW,27))) / ((HHV(HIGH,27)) - (LLV(LOW,27)))) * 100),5,1)),3,1))); A7:=(10); 百万测底:((CROSS(A6,A7)) * 75) * A1,LINETHICK2,COLOR0000FF; A8:=(REF(CLOSE,1)) / CLOSE; A9:=MIN((MA(((AMOUNT / VOL) / 100),15)),(EMA(((AMOUNT / VOL) / 100),15))); A10:=((1 - ((SMA(((LOW * A8) - (A8 / 10)),6,1)) / (EMA(((AMOUNT / VOL) / 100),15)))) * 100) - (100 / 10); A11:=((((1 - ((MA((LOW - (A8 / 10)),6)) / A9)) * (DMA(CLOSE,(VOL / CAPITAL)))) / (MA(LOW,6))) * 100) - (100 / 10); A12:=((((A10 + (A11 / 10)) > 0) AND (DATE > 1000101)) AND (DATE < 1991231)) AND ((COUNT((((1 - (CLOSE / (REF(CLOSE,1)))) > 0.099) AND ((1 - ((REF(CLOSE,1)) / (REF(CLOSE,2)))) > 0.099)),20)) < 3); A13:=(((((((A10 + (A11 / 10)) > -3.688) AND (DATE > 1000101)) AND (DATE < 1991231)) AND ((CLOSE / (REF(CLOSE,1))) > 1.02)) AND ((COUNT((((1 - (CLOSE / (REF(CLOSE,1)))) > 0.099) AND ((1 - ((REF(CLOSE,1)) / (REF(CLOSE,2)))) > 0.099)),20)) < 3)) AND (((REF(CLOSE,1)) / (REF(CLOSE,2))) < 0.95)) AND ((CLOSE / (HHV(HIGH,20))) < 0.855); 灵桥黑马:((IF(((((100 < 100) AND ((A10 + (A11 / 10)) > 0)) AND (DATE > 1000101)) AND (DATE < 1991231)),(A12 = 1),(A13 = 1))) * 100) * A1,LINETHICK2,COLORRED; A14:=EMA(CLOSE,8); A15:=EMA(A14,20); A16:=CROSS(A14,A15); A17:=A14 < (EMA(CLOSE,120)); 大波黑马起步:((A16 AND A17) * 75) * A1,LINETHICK2,COLORYELLOW; A18:=SUM((IF((CLOSE > (REF(CLOSE,1))),VOL,(IF((CLOSE < (REF(CLOSE,1))),(0 - VOL),0)))),0); A19:=SUMBARS(VOL,CAPITAL); A20:=(IF((CLOSE > (LLV(CLOSE,A19))),1,-1)) * (IF((A18 > (LLV(A18,A19))),1,-1)); A21:=IF((A20 = -1),1,0); A22:=(COUNT((A21 = 1),8)) > 2; A23:=((SUM(AMOUNT,13)) / ((AMOUNT / VOL) / 100)) / 100; A24:=DMA((((((3 * HIGH) + LOW) + OPEN) + (2 * CLOSE)) / 7),(VOL / A23)); A25:=(((CLOSE - A24) / A24) * 100) < -15; A26:=((CLOSE - (MIN(((REF(CLOSE,5)) * 0.865),((REF(CLOSE,21)) * 0.772)))) / CLOSE) < 0.05; A27:=REF(LOW,1); A28:=((SMA(ABS((LOW - A27)),3,1)) / (SMA((MAX((LOW - A27),0)),3,1))) * 100; A29:=EMA((IF((CLOSE * 1.2),(A28 * 10),(A28 / 10))),3); A30:=LLV(LOW,38); A31:=HHV(A29,38); A32:=IF((LLV(LOW,90)),1,0); A33:=((EMA((IF((LOW <= A30),((A29 + (A31 * 2)) / 2),0)),3)) / 618) * A32; (STICKLINE(A33,0,A33,6,1)) ,COLORBLUE; 底部不买你后悔:(IF(((A25 AND A26) AND A22),60,0)) * A1;
-
通达信客服:
以下是测试结果: 当前公式 : 财神出现 (指标画线公式) 错误句 : A13:=(((((((A10 + (A11 / 10)) > -3.688) AND (DATE > 1000101)) AND (DATE < 1991231)) AND ((CLOSE / (REF(CLOSE,1))) > 1.02)) AND ((COUNT((((1 - (CLOSE / (REF(CLOSE,1)))) > 0.099) AND ((1 - ((REF(CLOSE,1)) / (REF(CLOSE,2)))) > 0.099)),20)) < 3)) AND (((REF(CLOSE,1)) / (REF(CLOSE,2))) < 0.95)) AND ((CLOSE / (HHV(HIGH,20))) < 0.855) 详细信息 : 单语句函数嵌套层次太多!建议分多条语句编写 错误起始位置 : 1430 ; 长度: 3
-
网友交流:
中间赋值一次再嵌套。
-
网友交流:
把A13那一行替换成以下就好了。
A13A:=(( ((COUNT((((1 - (CLOSE / (REF(CLOSE,1)))) > 0.099) AND ((1 - ((REF(CLOSE,1)) / (REF(CLOSE,2)))) > 0.099)),20)) < 3)) AND (((REF(CLOSE,1)) / (REF(CLOSE,2))) < 0.95)) AND ((CLOSE / (HHV(HIGH,20))) < 0.855);A13B:((( ((A10 + (A11 / 10)) > -3.688) AND ( DATE > 1000101)) AND (DATE < 1991231)) AND ((CLOSE / (REF(CLOSE,1))) > 1.02));A13:=A13A AND A13B;
下次如果碰到很多括号,而不知道哪个括号是中括哪些参数,可以把公式复制到“KT交易师”这个软件的公式编辑里里,可以很清楚的看到哪一双括号是属于一对。
也建议通达信实现这个功能。
此主题相关图片如下2.png:
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容