C/C++ www.gszb.com 股票公式指标网提供 Code复制内容到剪贴板
- TYP:=(HIGH+LOW+CLOSE)/3;
- CCI1:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
-
- HH:=CONST(HHV(C,120))*1;{取现价的N日最大值}
-
- LL:=CONST(LLV(C,120))*1;{取现价的N日最小值}
- HL:=CONST(IF(CONST((HH+LL)/2)<CONST(C),LL-(HH-LL)*0.08,HH+(HH-LL)*0.08));
- {取叠加副图自动转换高低值,当现价小于中间值时以LL-(HH-LL)*0.2为副图自动转换高低值,反之以HH+(HH-LL)*0.2为副图自动转换高低值}
- HH1:=IF(CONST((HH+LL)/2)>CONST(C),HH,HL);{当现价小于中间值时以最大值为最高点,反之以HL为最高点}
- LL1:=IF(CONST((HH+LL)/2)<CONST(C),LL,HL);{当现价小于中间值时以最小值为最低点,反之以HL为最低点}
- HLMAX:=MAX(HH1,LL1);{设定所要叠加副图比例的最大值}
- HLMIN:=MIN(HH1,LL1);{设定所以叠加副图比例的最小值}
- HLMN1:=(HLMAX+HLMIN)/2;{取设定所要叠加副图比例的最大最小值的中间值}
- HLMN2:=HLMAX-HLMIN;{取设定所要叠加副图比例的最大最小值的差值}
- HLMN3:=(100-0)/2;
- HLMN4:=100-0;
- (130-0)*HLMN2/100+HLMN1,COLOR00FFFF,POINTDOT,LINETHICK4;
-
-
- (0-0)*HLMN2/100+HLMN1,COLOR00CD93,POINTDOT,LINETHICK2;
- (-120-0)*HLMN2/100+HLMN1,,COLOR808040,POINTDOT,LINETHICK4;
-
- (-150-0)*HLMN2/100+HLMN1,COLOR00FF00,POINTDOT,LINETHICK4;
-
-
- {以上定义叠加副图坐标}
-
- CCI:(CCI1-0)*HLMN2/100+HLMN1,COLORFFFFFF,LINETHICK2;
-
-
-
-
- 高1:=REF(HHV(H,150),3);
- 低1:=REF(LLV(L,150),3);
- HQ3:=高1-(高1-低1)*0.5;
- 中轴:=REFDATE(HQ3,DATE),POINTDOT,COLORLIGRAY,LINETHICK3;
- B1:=EMA(C,12);
- B2:=EMA(C,26);
- BQ3:=B1-B2;
- WDIF:=EMA(EMA(EMA(C,3),3),3)+BQ3;
- WDEA:=EMA(WDIF,9);
- MACD:=2*(WDIF-WDEA);
-
- STICKLINE(MACD>0,中轴,中轴+MACD,0,1),COLORRED;
- STICKLINE(MACD<0,中轴,中轴+MACD,0,1),COLORLIBLUE;
- STICKLINE(MACD<REF(MACD,1)AND MACD>0,中轴,中轴+MACD,0,0 ),COLOR00BBFF;
- STICKLINE(MACD>=REF(MACD,1)AND MACD>0,中轴,中轴+MACD,0,0 ),COLOR0011BB;
- STICKLINE(MACD>REF(MACD,1)AND MACD<0,中轴,中轴+MACD,0,0),COLORBB11BB;
- STICKLINE(MACD<=REF(MACD,1)AND MACD<0,中轴,中轴+MACD,0,0),COLORFFBB11;
-
- 双线持币:HHV(MA(HIGH,2),2),COLORGREEN,LINETHICK2;
- 单线持股:LLV(MA(HIGH,2),1),,COLORRED,LINETHICK2;
-
- CYC13:=0.01*EXPMA(AMOUNT,13)/EXPMA(VOL,13);
- CYS:(CLOSE-CYC13)/CYC13*100,NODRAW;
-
-
- {DRAWGBK((DATE > 0),COLORRGB(0,33,0),COLORRGB(0,33,0),1);}
- {模拟}
- QJ0:=V/IF(H=L,4,H-L);
- QJ1:=IF(CAPITAL=0,QJ0*((H+L+C)/3-MIN(C,O)),QJ0*IF(H=L,1,MIN(O,C)-L));
- QJ2:=IF(CAPITAL=0,QJ0*(MIN(O,C)-L),QJ0*IF(H=L,1,(H+L+C)/3-MIN(C,O)));
- QJ3:=IF(CAPITAL=0,QJ0*(H-MAX(O,C)),QJ0*IF(H=L,1,H-MAX(O,C)));
- QJ4:=IF(CAPITAL=0,QJ0*(MAX(C,O)-(H+L+C)/3),QJ0*IF(H=L,1,(MAX(C,O)-(H+L+C)/3)));
- {增减仓}
- X:=2008;
- 总1:=(QJ1+QJ2)-(QJ3+QJ4); ZJ:=REF(总1,1); W1:=(QJ1+QJ2);
- 周仓:=SUM(总1,5); 月仓:=SUM(总1,25);
- 年仓:=SUM(总1,240); 上周:=REF(周仓,1);
- 上月:=REF(月仓,1); 上年:=REF(年仓,BARSLAST(YEAR=X));
- 周增:周仓-上周,NODRAW; 月增:月仓-上月,NODRAW; 年增:=年仓-上年;
- {};
-
-
- 换手率:V/CAPITAL*100,COLORGREEN,LINETHICK2,NODRAW;
-
-
-
-
-
- {BZ-预测明天(主图)-----------------<<预测明天公式>> 通达信修改版}
- P1:=5;
- P2:=10;
- P3:=20;
- P4:=30;
- P5:=60;
- P6:=120;
- P7:=240;
- P8:=340;
- N:=4;
- WX:=MA(CLOSE,0);
- M1:=MA(CLOSE,P1);
- M2:=(MA(CLOSE,P2) * IF((N < 2),WX,1));
- M3:=(MA(CLOSE,P3) * IF((N < 3),WX,1));
- M4:=(MA(CLOSE,P4) * IF((N < 4),WX,1));
- M5:=(MA(CLOSE,P5) * IF((N < 5),WX,1));
- M6:=(MA(CLOSE,P6) * IF((N < 6),WX,1));
- M7:=(MA(CLOSE,P7) * IF((N < 7),WX,1));
- M8:=(MA(CLOSE,P8) * IF((N < 8),WX,1));
- C1:=REF(CLOSE,1);
- C2:=HHV(C1,2);
- C3:=LLV(C1,1);
- ET:=HHV(C1,2);
- ET1:=REF(ET,1);
- XB:=LLV(C1,1);
- XB1:=REF(XB,1);
- M:=BARSLAST(((CLOSE < XB) AND (C1 >= XB1)));
- M11:=REF(M,1);
- N9:=BARSLAST(((CLOSE > ET) AND (C1 <= ET1)));
- N1:=REF(N9,1);
- M21:=(BARSLAST((((M - N9) > 0) AND (M11 <= N1))) + 1);
- N2:=(BARSLAST((((N9 - M) > 0) AND (N1 <= M11))) + 1);
- ET2:=HHV(ET,M21);
- XB2:=LLV(XB,N2);
- A:=IF((((M - N9) > 0) AND (M11 <= N1)),1,IF((((N9 - M) > 0) AND (N1 <= M11)),0,2));
- H1:=IF(((M - N9) > 0),CLOSE,ET2);
- H2:=IF((A = 1),CLOSE,C2);
- H3:=IF(((M - N9) < 0),CLOSE,XB2);
- H4:=IF((A = 1),CLOSE,XB2);
- H5:=IF((((M - N9) > 0) OR (A = 1)),CLOSE,H3);
- H6:=REF(H5,1);
- H7:=REF(H5,2);
- H8:=(H5 > H6);
- H9:=(((H4 = REF(H4,1)) AND (REF(H4,1) < REF(H4,2))) AND (H5 > REF(H5,2)));
- H10:=(((H2 = REF(H2,1)) AND (H4 = REF(H4,1))) AND (H5 = REF(H5,2)));
- W:=((H8 OR H9) OR H10);
- T9:=((H5 < H6) AND (H5 < REF(H5,2)));
- T10:=((H4 = REF(H4,1)) AND (H5 < REF(H5,2)));
- T11:=((H3 > REF(H3,1)) AND (H5 < REF(H5,1)));
- T12:=((H5 = REF(H5,1)) AND (H3 = H4));
- T13:=((H2 = REF(H2,1)) AND (H2 = H5));
- TW:=((((T9 OR T10) OR T11) OR T12) OR T13);
- PK:=((AMOUNT * (((OPEN + CLOSE) + HIGH) + LOW)) / 4);
- PK1:=IF((VOL > 0),(PK / AMOUNT),((((OPEN + CLOSE) + HIGH) + LOW) / 4));
- BBP:=(((CLOSE - LLV(LOW,9)) / (HHV(HIGH,9) - LLV(LOW,9))) * 100);
-
- 量涨幅%:(V/REF(V,1)-1)*10,NODRAW;
-
-
- STICKLINE((ISLASTBAR AND W),(H5 * 1.025),(H5 * 0.99),0.5,0),COLORFF8800;
- STICKLINE((ISLASTBAR AND W),(H5 * 1.02),H5,8,0),COLOR102088;
- STICKLINE((ISLASTBAR AND W),(H5 * 1.02),H5,7,0),COLOR102099;
- STICKLINE((ISLASTBAR AND W),(H5 * 1.02),H5,6,0),COLOR1020AA;
- STICKLINE((ISLASTBAR AND W),(H5 * 1.02),H5,5,0),COLOR1020BB;
- STICKLINE((ISLASTBAR AND W),(H5 * 1.02),H5,4,0),COLOR1020CC;
- STICKLINE((ISLASTBAR AND W),(H5 * 1.02),H5,3,0),COLOR1020DD;
- STICKLINE((ISLASTBAR AND W),(H5 * 1.02),H5,2,0),COLOR1020EE;
- STICKLINE((ISLASTBAR AND W),(H5 * 1.02),H5,1,0),COLOR1020FF;
- DRAWTEXT((ISLASTBAR AND (BBP >= 96.5)),(H5 * 1.022),'明见\N 短高\N 龙头\N 除外'),COLORRED;
- DRAWTEXT((ISLASTBAR AND (BBP < 1)),((H5 + H4) / 1.96),'明见\N 短低\N 跌停\N 除外'),COLORGREEN;
- DRAWTEXT(((ISLASTBAR AND W) AND (BBP < 96.5)),(H5 * 1.022),'明日\N 看涨'),COLORYELLOW;
- DRAWTEXT(((ISLASTBAR AND TW) AND (BBP > 1)),((H5 + H4) / 2),'明日\N 看跌'),COLORGREEN;