板块选择:=6;
股价上限:=120;
股价下限:=2;
市值上限:=1000;
市值下限:=15;
基准值:=5;
投入金额:=5;
KS:=BARSCOUNT(C)+1;
STBZ:=IF(NAMEINCLUDE('ST'),0,1);
GPDM:=STR2CON(CODE);
GPJD:=REF(C,1);
ZGB:=FINANCE(1);
ZSZ:=INTPART(GPJD*ZGB/10000/10000);
SCXZA:=IF(GPDM>=1 AND GPDM<2000,1,IF(GPDM>=2000 AND GPDM<300000,2,
IF(GPDM>=300000 AND GPDM<600000,3,IF(GPDM>=600000 AND GPDM<688000,4,
IF(GPDM>=688000 AND GPDM<690000,5,0)))));
{个股所属市场表示,1-深圳主板,2-深圳中小板,3-深圳创业板,4-上海主板,
5-上海科创板,6-全市场所有股票}
JA1A:=IF(板块选择=6,1,IF(板块选择=SCXZA,1,0));
JA1B:=IF(GPJD<=股价上限 AND GPJD>=股价下限,1,0);
JA1C:=IF(ZSZ<=市值上限 AND ZSZ>=市值下限,1,0);
JA1D:=IF((JA1A+JA1B+JA1C+STBZ)=4,1,0);
JX1:=INTPART(MA(C,基准值)*100)/100;
JX2:=INTPART(MA(C,基准值*2)*100)/100;
JX3:=INTPART(MA(C,基准值*4)*100)/100;
JA2A:=IF(JX1<JX2 AND JX2<JX3,1,0);
JA2B:=IF(REF(JA2A,1)=1 AND JA2A=0,1,0);
JA3A:=IF(JX1>JX2 AND JX2>JX3,1,0);
JA3B:=IF(REF(JA3A,1)=0 AND JA3A=1,1,0);
CSH:=IF(COUNT(JA2B=1,KS)>=2 AND COUNT(JA3B=1,KS)>=2,1,0);
JB1A:=IF(CSH=1,
IF(COUNT(JX1<JX2,SUMBARS(JA3B,1))=0 AND COUNT(JX2<JX3,SUMBARS(JA3B,1))=0,1,0),0);
JB1B:=IF(CSH=1,IF(JA3A=1 OR JB1A=1,1,0),0);
JB1C:=IF(REF(JB1B,1)=0 AND JB1B=1,1,0);
JB2A:=IF(JX1>JX2,1,0);
JB2B:=IF(COUNT(JX1<JX2,SUMBARS(JB2A,1))=0,1,0);
JB2C:=IF(REF(JB2B,1)=1 AND JB2B=0,1,0);
JB2D:=IF(JB2C=1,LLV(L,3),0);
JB2E:=IF(COUNT(JB2C=1,KS)>=1,IF(COUNT(C<REF(JB2D,SUMBARS(JB2C,1)-1),SUMBARS(JB2C,1))=0
AND COUNT(JB2B=1,SUMBARS(JB2C,1))=0,1,0),0);
JB2F:=IF(JB2B=1 OR JB2E=1,1,0);
JC1A:=IF(JB1B=1,IF(SUMBARS(JB1C,1)<=基准值 AND SUMBARS(JA2B,1)<=2*基准值
AND COUNT(JA1D=1,SUMBARS(JB1C,1))>=1,1,0),0);
JC1B:=IF(REF(JC1A,1)=1,1,0);
JC1C:=IF(REF(JC1B,1)=0 AND JC1B=1,1,0);
JC2A:=IF(JC1A=1,JX2,0);
JC3A:=IF(JC1B=1,IF(L<=REF(JC2A,1),1,0),0);
JC3B:=IF(JC1B=1,IF(JC3A=1,IF(O<REF(JC2A,1),O,REF(JC2A,1)),0),0);
JC3C:=IF(JC1B=1,IF(JC3A=1,IF(COUNT(JC3A=1,SUMBARS(JC1C,1))=1,1,0),0),0);
JC4A:=IF(COUNT(JC3C=1,KS)>=1,IF(COUNT(JB2F=0,SUMBARS(JC3C,1))=0,1,0),0);
JC4B:=IF(JC4A=1 OR (JC4A=0 AND REF(JC4A,1)=1),1,0);
TRE:=投入金额*10000;
JD1A:=IF(CSH=1,IF(REF(JC4B,1)=0 AND JC4B=1 AND JC3C=1,1,0),0);
JD1B:=IF(COUNT(JD1A=1,KS)>=1,IF(JC4B=1,IF(COUNT(JC4B=0,SUMBARS(JD1A,1))=0,1,0),0),0);
JD2A:=IF(JD1A=1,JC3B,0);
JD2B:=IF(JD1A=1,INTPART(TRE/JD2A/100)*100,0);
JD2C:=IF(JD1A=1,JD2A*JD2B,0);
JD2D:=IF(JD1B=1,REF(JD2A,SUMBARS(JD1A,1)-1),0);
JD2E:=IF(JD1B=1,REF(JD2B,SUMBARS(JD1A,1)-1),0);
JD2F:=IF(JD1B=1,REF(JD2C,SUMBARS(JD1A,1)-1),0);
JD2G:=IF(JD1B=1,(C-JD2D)*JD2E,
IF(REF(JD1B,1)=1 AND JD1B=0,(O-REF(JD2D,1))*REF(JD2E,1),0));
JD2H:=IF(JD1B=1,JD2G/JD2F*100,IF(REF(JD1B,1)=1 AND JD1B=0,JD2G/REF(JD2F,1)*100,0));
买价格:JD2A;
买数量:JD2B;
买金额:JD2C;
持成本:JD2D;
持数量:JD2E;
持投入额:JD2F;
持盈亏:JD2G;
持盈亏率%:JD2H;
卖价:IF(REF(JD1B,1)=1 AND JD1B=0,O,0);
DRAWICON(JD1A,JD2C,1);
DRAWICON(REF(JD1B,1)=1 AND JD1B=0,IF(JD2G>REF(JD2F,1),JD2G,REF(JD2F,1)),2);