股友量 发表于 2022-1-12 23:19

指标编写问答139学习的宝藏

637.问:
这公式为何再加入条件无效,应在那个位加入?例如:加入条件k>d.

Var41:=COST(10);
Var42:=(CLOSE>OPEN OR CLOSE>REF(CLOSE,1)) AND VOL>REF(VOL,1);
Var43:=COUNT(Var42,3)=3;
Var44:=LLV(LOW,5)=LLV(LOW,120);
Var45:=Var43 AND Var44;
Var46:=COUNT(CROSS(MA(CLOSE,10),MA(CLOSE,20)),2)=1 AND COUNT(CROSS(MA(CLOSE,5),MA(CLOSE,20)),2)=1;
Var47:=COUNT(Var45,3)>0 AND COUNT(Var46,3)>0;
Var48:=Var47 AND COUNT(Var47,20)=1;
Var49:=(INDEXC-LLV(INDEXL,89))/(HHV(INDEXH,89)-LLV(INDEXL,89))*100;
Var4A:=SMA(Var49,8,1);
Var4B:=SMA(Var4A,10,1);
Var4C:=Var4A>REF(Var4A,1) AND Var4A>Var4B AND BARSLAST(CROSS(Var4A,Var4B))<=21;
Var4D:=(CLOSE-LLV(LOW,89))/(HHV(HIGH,89)-LLV(LOW,89))*100;
Var4E:=SMA(Var4D,8,1);
Var4F:=SMA(Var4E,10,1);
Var50:=Var4E>REF(Var4E,1) AND Var4E>Var4F AND BARSLAST(CROSS(Var4E,Var4F))<=34;
Var51:=REF(INDEXC,1);
Var52:=SMA(MAX(INDEXC-Var51,0),6,1)/SMA(ABS(INDEXC-Var51),6,1)*100;
Var53:=Var52>=75 AND Var52<90 ;
Var2:=IF(EMA(CLOSE,5)/EMA(EMA(CLOSE,9),16)<=0.85 AND CLOSE/REF(CLOSE,1)>0.905 AND CLOSE/REF(CLOSE,1)<1.05 AND VOL/CAPITAL*100<5,50,0);
Var3:=(-100)*(HHV(HIGH,34)-CLOSE)/(HHV(HIGH,34)-LLV(LOW,34))+100;
Var4:=(-100)*(HHV(HIGH,50)-CLOSE)/(HHV(HIGH,50)-LLV(LOW,50))+100;
Var5:=(-100)*(HHV(HIGH,70)-CLOSE)/(HHV(HIGH,70)-LLV(LOW,70))+100;
Var6:=((CLOSE-MA(CLOSE,34))/MA(CLOSE,34)*100+10)*5;
Var7:=((CLOSE-MA(CLOSE,50))/MA(CLOSE,50)*100+10)*5;
Var8:=((CLOSE-MA(CLOSE,70))/MA(CLOSE,70)*100+10)*5;
Var9:=(Var3+Var4+Var5+Var6+Var7+Var8)/6;
VarA:=EMA(Var9,3);
VarB:=ABS(Var6-Var8);
VarC:=(Var9+VarB)/2;
VarD:=(-1)*(EMA(100*(1-WINNER(CLOSE)),1)-50)+50;
VarE:=VarD+VarC;
VarF:=IF(Var2>0 AND VarE<0,200,0);
Var10:=IF(VarC<0 AND CLOSE=LLV(CLOSE,5) AND CLOSE/REF(CLOSE,1)>0.905 AND CLOSE/REF(CLOSE,1)<1.05 AND VOL/CAPITAL*100<5,-50,0);
Var11:=IF(VarE<0 AND Var10=-50,100,0);
Var12:=MA(CLOSE,3);
Var13:=REF(CLOSE,2)*0.865;
Var14:=REF(CLOSE,13)*0.772;
Var15:=MIN(Var13,Var14);
Var16:=100*VOL/CAPITAL;
Var17:=MA(CLOSE,13);
Var18:=IF((CLOSE-Var15)/CLOSE<0.03 AND SUM(Var16,5)/5<1.8,1,0);
Var19:=IF(Var18>0 AND (Var10<0 OR Var2>0),100,0);
Var1A:=Var19;
Var1B:=IF(VarF>0 AND Var11>0 AND SUM(VOL/CAPITAL*100,5)/5<1 OR Var18>0 AND REF(CLOSE,1)/REF(CLOSE,2)>0.902 OR (VarF>0 AND Var11>0 AND SUM(VOL/CAPITAL*100,5)/5<1 OR Var18>0) AND (Var10<0 OR Var2>0) AND Var19<10,50,0);
Var1C:=(VarF>0 AND Var11>0 AND SUM(VOL/CAPITAL*100,5)/5<1 OR Var18>0) AND (Var10<0 OR Var2>0);
Var1D:=VarF>0 AND Var11>0 AND SUM(VOL/CAPITAL*100,5)/5<1 OR Var18>0 AND REF(CLOSE,1)/REF(CLOSE,2)>0.902;
Var22:=COST(10)*0;
Var23:=(MA(AMOUNT,5)/MA(VOL,5)/100-MA(AMOUNT,125)/MA(VOL,125)/100)/(MA(AMOUNT,5)/MA(VOL,5)/100);
Var24:=MA((LLV(LOW,45)-CLOSE)/(HHV(HIGH,45)-LLV(LOW,45))*100,5);
Var31:=AMOUNT/VOL/100;
Var32:=(3*HIGH+LOW+OPEN+2*CLOSE)/7;
Var33:=SUM(AMOUNT,13)/Var31/100;
Var34:=DMA(Var32,VOL/Var33);
Var35:=(CLOSE-Var34)/Var34*100;
Var36:=(INDEXC-LLV(INDEXL,9))/(HHV(INDEXH,9)-LLV(INDEXL,9))*100;
Var37:=SMA(Var36,3,1);
Var38:=SMA(Var37,3,1);
青龙:=Var1C OR Var1D or CROSS(-5,Var24) AND Var23<-0.4 AND (CLOSE-MA(CLOSE,30))/MA(CLOSE,30)<-0.19 or CROSS(Var37,Var38) AND Var37<20 AND
COUNT(Var35<=-21,5)>=1 or Var50 AND Var4C AND Var53 AND COUNT(Var48,6) ;

   答(zmr666):
把最后一句里面的 “=” 号去掉,然后加上 and "kdj.k">"kdj.d" ,如下:
青龙:Var1C OR Var1D or CROSS(-5,Var24) AND Var23<-0.4 AND (CLOSE-MA(CLOSE,30))/MA(CLOSE,30)<-0.19 or CROSS(Var37,Var38) AND Var37<20 AND
COUNT(Var35<=-21,5)>=1 or Var50 AND Var4C AND Var53 AND COUNT(Var48,6) and "kdj.k">"kdj.d";
加入的 and 前面要注意留空格。
    答(zmr666):
发现是有问题,可进行如下改进,先用 () 把原句中的内容全部括住,再加上 and "kdj.k">"kdj.d",结果如下:
青龙:(Var1C OR Var1D or CROSS(-5,Var24) AND Var23<-0.4 AND (CLOSE-MA(CLOSE,30))/MA(CLOSE,30)<-0.19 or CROSS(Var37,Var38) AND Var37<20 AND
COUNT(Var35<=-21,5)>=1 or Var50 AND Var4C AND Var53 AND COUNT(Var48,6)) and "kdj.k">"kdj.d";
页: [1]
查看完整版本: 指标编写问答139学习的宝藏