主力波段,划线主图(通达信公式 主图 源码 测试图)
{主力波段}AF1:=REF(O,1);AF2:=ABS((REF(C,1)-AF1)/AF1);AF3:=ABS((REF(H,1)-AF1)/AF1);AF4:=ABS((REF(L,1)-AF1)/AF1);BF1:=ABS((AF2+AF3+AF4)/3);BF2:=O*BF1;预测低一:=O-BF2;预测高一:=O+BF2;今日保护价:=(REF(C,2)+REF(C,1)+O)/3 ,COLOR4080FF,NODRAW;开盘价1:=OPEN;开盘价2:=REF(OPEN,1);最高价1:=HIGH;最高价2:=REF(HIGH,1);最低价1:=LOW;最低价2:=REF(LOW,1);收盘价1:=CLOSE;收盘价2:=REF(CLOSE,1);AAF:=最高价2;BBF:=最低价2;CCF:=开盘价2;DDF:=收盘价2;EEF:=(AAF+BBF+CCF+2*DDF)/5;AAAF:=EEF+(AAF-BBF);BBBF:=2*EEF-BBF;CCCF:=2*EEF-AAF;DDDF:=EEF-(AAF-BBF);上升突破价:=AAAF;上升阻力价:=BBBF;下跌支撑价:=CCCF;下跌反转价:=DDDF;E:=(HIGH+LOW+OPEN+2*CLOSE)/5;阻力:=E+(HIGH-LOW);支撑:=E-(HIGH-LOW);EEE:=(EEF+上升突破价+上升阻力价+下跌支撑价+下跌反转价)/5;心理价:=EEE;FFF:=(EEE+开盘价1)/2;GGG:=(预测低一+FFF)/2;预测低二:=MIN(GGG,支撑);DRAWRECTREL(0,0,360,399,IF(120,RGB(10,0,0),0));DRAWRECTREL(0,0,360,8,IF(120,RGB(280,0,0),0));DRAWRECTREL(0,265,360,273,IF(120,RGB(280,0,0),0));预测高二:=MAX(MA(REF(HIGH,1)/REF(CLOSE,2),27)*REF(CLOSE,1),阻力);DRAWTEXT_FIX(1,0.18,0.15,0,'测低:'),COLORYELLOW;DRAWNUMBER_FIX(1,0.24,0.17,0,CONST(预测低二)),COLORCYAN;DRAWTEXT_FIX(1,0.04,0.15,0,'测高:'),COLORFFFFFF;DRAWNUMBER_FIX(1,0.10,0.17,0,CONST(预测高二)),COLORYELLOW;MQ1:=12;MQ2:=50;MQ3:=60;EXP1:=EXPMA(CLOSE,MQ1);EXP2:=EXPMA(CLOSE,MQ2);EXP3:=EXPMA(CLOSE,MQ3);AB:=EMA(((2*C+H+L)/4-LLV(LOW,30))/(HHV(HIGH,30)-LLV(LOW,30))*100,8);BA:=EMA(AB,5);A1:=REFDATE(REF(HHV(H,96),5),DATE);B1:=REFDATE(REF(LLV(L,96),5),DATE);DY:=((A1)+(B1))/2;箱顶:=IF(AB>0 AND AB-BA<=0,A1,A1),LINETHICK3,COLOR00FF00;箱腰:=IF(AB>0 AND AB-BA<=0,DY,DY),LINETHICK3,COLOR00FF00;箱低:=IF(AB>0 AND AB-BA<=0,B1,B1),LINETHICK3,COLOR00FF00;高1:=IF(AB>0 AND AB-BA>0,A1,DRAWNULL),LINETHICK3,COLORRED;中1:=IF(AB>0 AND AB-BA>0,DY,DRAWNULL),LINETHICK3,COLORRED;低1:=IF(AB>0 AND AB-BA>0,B1,DRAWNULL),LINETHICK3,COLORRED;顶周期:=TOPRANGE(H);底周期:=LOWRANGE(L);上内:=LLVBARS(H,顶周期);上外:=LLVBARS(L,顶周期);下内:=HHVBARS(L,底周期);下外:=HHVBARS(H,底周期);上力度:=HHV(L,上内+1)>LLV(H,上内+1);下力度:=HHV(L,下内+1)>LLV(H,下内+1);上包含:=COUNT(L>=REF(L,1),上外)>2 AND COUNT(H>=REF(H,1),上内)>2;下包含:=COUNT(H<=REF(H,1),下外)>2 AND COUNT(L<=REF(L,1),下内)>2;顶0:=顶周期 AND 上力度 AND 上包含 AND 上外>3;底0:=底周期 AND 下力度 AND 下包含 AND 下外>3;顶分天数:=BARSLAST(顶0);底分天数:=BARSLAST(底0);含中间K线:=IF(顶分天数=0,底分天数,顶分天数)>=3;顶:=顶0 AND 含中间K线 AND H=HHV(H,BARSLAST(底0));底:=底0 AND 含中间K线 AND L=LLV(L,BARSLAST(顶0));NOTEXT上笔划线