飞狐趋势主图指标
源码
input: k(3,0,3),n1(4,1,255),n(10,1,255),p1(3,1,255);
DRAWGBK(c>0,COLORRGB(10,60,0),COLORRGB(10,10,0),1);
STICKLINE(CLOSE>OPEN,OPEN,LOW,0.5,0 ),COLOR0000FF;
STICKLINE(CLOSE>OPEN,CLOSE,HIGH,0.5 ,0 ),COLOR0000FF;
STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE,OPEN,HIGH,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLORff7700;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLORff9900;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLORffbb00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLORffcc00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLORffdd00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLORffee00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1,0 ),COLORffFF00;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,7,0) ,COLOR000055;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLOR000066;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,5,0) ,COLOR000077;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLOR000099;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLOR0000bb;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLOR0000dd;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,1,0) ,COLOR0000ff;
var9Q:=c= hhv(c,4)and (ref(c,1)>=ref(c,2) or ref(c,1)>=ref(c,3))
or ref(c,1)=hhv(c,4) and close>=ref(c,2)
or ref(c,2)=hhv(c,4) and ref(c,3)=llv(c,4) and c>=ref(c,1)
or ref(c,3)=hhv(c,4) and c>=ref(c,1) and c>=ref(c,2);
红持:var9Q,color0000ff,LINETHICK0;
varaQ:=c=hhv(c,4) and ref(c,1)=llv(c,4);
粉变:varaQ,colorff99ff,LINETHICK0;
varbQ:=c=llv(c,4) and (ref(c,1)<ref(c,2) or ref(c,1)<ref(c,3))
or ref(c,1)=llv(c,4) and c<ref(c,2)
or ref(c,2)=llv(c,4) and ref(c,1)<>hhv(c,4) and c<ref(c,1)
or ref(c,3)=llv(c,4) and c<ref(c,1) and c<ref(c,2);
灰跌:varbQ,color888888,LINETHICK0;
varcQ:=ref(c,1)=llv(c,4) and c>=ref(c,2) or ref(c,2)=llv(c,4)
and ref(c,1)<=ref(c,3) and ref(c,2)<ref(c,4) and c>=ref(c,1);
绿买:varcQ,color00ff00,LINETHICK0;
vardQ:=ref(c,1)=hhv(c,4) and c<ref(c,2)
or (ref(c,2)=hhv(c,4) and ref(c,1)>ref(c,3)
or ref(c,3)=hhv(c,4) and ref(c,1)>ref(c,2))
and ref(c,2)>=ref(c,4) and c<ref(c,1);
蓝抛:vardQ,colorff9900,LINETHICK0;
stickline(vardQ,o,(o+c)/2,7,0),colorff1100;
stickline(vardQ,o,(o+c)/2,6,0),colorff3300;
stickline(vardQ,o,(o+c)/2,5,0),colorff5500;
stickline(vardQ,o,(o+c)/2,4,0),colorff7700;
stickline(vardQ,o,(o+c)/2,3,0),colorff9900;
stickline(vardQ,o,(o+c)/2,2,0),colorffbb00;
stickline(vardQ,o,(o+c)/2,1,0),colorffdd00;
gj:=if(c=INDEXC,(INDEXC+INDEXh+INDEXl+INDEXO)/4,AMOUNT/(v+0.01)/100);
明日阻力:=l+(gj-l)+(c-l);
明日支撑:=l+(c-gj);
今日阻力:REF(明日阻力 , 1),LINETHICK0;
今日支撑:REF(明日支撑 , 1),LINETHICK0;
STICKLINE(BARSTATUS=2
STICKLINE(BARSTATUS=2
STICKLINE(BARSTATUS=2
STICKLINE(BARSTATUS=2
DRAWTEXTEX(1,1,20,30,'趋势主图'),LINETHICK6,Coloryellow;
DRAWTEXTEX(1,1,200,30,STKLABEL+' '+STKNAME),LINETHICK6,ColorFFFF80;
wyy1:=WEEKDAY,LINETHICK0;
wWj:=' 星期';
wWjj:=IF(wyy1=5 ,wWj+'五',IF(wyy1=4 ,wWj+'四',
IF(wyy1=3 ,wWj+'三',IF(wyy1=2 ,wWj+'二',IF(wyy1=1 ,wWj+'1',wWj)))));
wyy2:=LMONTH;
wyy3:=LDAY;
wWw:=IF( BARSTATUS=2 ,' 农历 '+NUMTOSTR(wyy2,0)+'月 '+NUMTOSTR(wyy3,0)+'日',' ');
wWh:=IF( BARSTATUS=2 ,NUMTOSTR(date+1000000,0),' ' );
DRAWTEXTEX(1,1,120 ,30 ,'
HH:=DYNAINFO(39);
DD:=FINANCE( 1);
SS:=FINANCE( 7);
FF:=FINANCE(18);
GG:=FINANCE(33);
zz:=FINANCE(53);
JJ:=FINANCE(40);
MM:=JJ/SS;
TH:=DYNAINFO(39);
换手率:=100*v/capital,colorfffFff;
RH:=H-L;
R:=DYNAINFO(13)*100;
DRAWTEXTEX(1,1,20,840,'当日振幅:'+NUMTOSTR(R,2)+'%
var100:='所属板块:';
if inblock('电力')=1 then var100:=var100+' 电力';
if inblock('电脑')=1 then var100:=var100+' 电脑';
if inblock('电器')=1 then var100:=var100+' 电器';
if inblock('电子信息')=1 then var100:=var100+' 电子信息';
if inblock('房地产')=1 then var100:=var100+' 房地产';
if inblock('纺织服装')=1 then var100:=var100+' 纺织服装';
if inblock('钢铁')=1 then var100:=var100+' 钢铁';
if inblock('工程建筑')=1 then var100:=var100+' 工程建筑';
if inblock('供水供气')=1 then var100:=var100+' 供水供气';
if inblock('化工')=1 then var100:=var100+' 化工';
if inblock('化纤')=1 then var100:=var100+' 化纤';
if inblock('机械')=1 then var100:=var100+' 机械';
if inblock('建材')=1 then var100:=var100+' 建材';
if inblock('交通工具')=1 then var100:=var100+' 交通工具';
if inblock('交通设施')=1 then var100:=var100+' 交通设施';
if inblock('教育传媒')=1 then var100:=var100+' 教育传媒';
if inblock('金融')=1 then var100:=var100+' 金融';
if inblock('旅游酒店')=1 then var100:=var100+' 旅游酒店';
if inblock('煤炭石油')=1 then var100:=var100+' 煤炭石油';
if inblock('酿酒食品')=1 then var100:=var100+' 酿酒食品';
if inblock('农林牧渔')=1 then var100:=var100+' 农林牧渔';
if inblock('其他行业')=1 then var100:=var100+' 其他行业';
if inblock('汽车')=1 then var100:=var100+' 汽车';
if inblock('汽配')=1 then var100:=var100+' 汽配';
if inblock('商业连锁')=1 then var100:=var100+' 商业连锁';
if inblock('石化')=1 then var100:=var100+' 石化';
if inblock('通信')=1 then var100:=var100+' 通信';
if inblock('外贸')=1 then var100:=var100+' 外贸';
if inblock('医药')=1 then var100:=var100+' 医药';
if inblock('仪电仪表')=1 then var100:=var100+' 仪电仪表';
if inblock('有色金属')=1 then var100:=var100+' 有色金属';
if inblock('运输物流')=1 then var100:=var100+' 运输物流';
if inblock('造纸印刷')=1 then var100:=var100+' 造纸印刷';
if inblock('安徽')=1 then var100:=var100+' 安徽';
if inblock('北京')=1 then var100:=var100+' 北京';
if inblock('福建')=1 then var100:=var100+' 福建';
if inblock('甘肃')=1 then var100:=var100+' 甘肃';
if inblock('广东')=1 then var100:=var100+' 广东';
if inblock('广西')=1 then var100:=var100+' 广西';
if inblock('贵州')=1 then var100:=var100+' 贵州';
if inblock('海南')=1 then var100:=var100+' 海南';
if inblock('河北')=1 then var100:=var100+' 河北';
if inblock('河南')=1 then var100:=var100+' 河南';
if inblock('黑龙江')=1 then var100:=var100+' 黑龙江';
if inblock('湖北')=1 then var100:=var100+' 湖北';
if inblock('湖南')=1 then var100:=var100+' 湖南';
if inblock('吉林')=1 then var100:=var100+' 吉林';
if inblock('江苏')=1 then var100:=var100+' 江苏';
if inblock('江西')=1 then var100:=var100+' 江西';
if inblock('辽宁')=1 then var100:=var100+' 辽宁';
if inblock('内蒙古')=1 then var100:=var100+' 内蒙古';
if inblock('宁夏')=1 then var100:=var100+' 宁夏';
if inblock('青海')=1 then var100:=var100+' 青海';
if inblock('山东')=1 then var100:=var100+' 山东';
if inblock('山西')=1 then var100:=var100+' 山西';
if inblock('陕西')=1 then var100:=var100+' 陕西';
if inblock('上海')=1 then var100:=var100+' 上海';
if inblock('深圳')=1 then var100:=var100+' 深圳';
if inblock('四川')=1 then var100:=var100+' 四川';
if inblock('天津')=1 then var100:=var100+' 天津';
if inblock('***')=1 then var100:=var100+' ***';
if inblock('新疆')=1 then var100:=var100+' 新疆';
if inblock('云南')=1 then var100:=var100+' 云南';
if inblock('浙江')=1 then var100:=var100+' 浙江';
if inblock('重庆')=1 then var100:=var100+' 重庆';
if inblock('3G')=1 then var100:=var100+' 3G';
if inblock('H股')=1 then var100:=var100+' H股';
if inblock('QFII持股')=1 then var100:=var100+' QFII持股';
if inblock('ST')=1 then var100:=var100+' ST';
if inblock('奥运')=1 then var100:=var100+' 奥运';
if inblock('创投')=1 then var100:=var100+' 创投';
if inblock('次新股')=1 then var100:=var100+' 次新股';
if inblock('大盘')=1 then var100:=var100+' 大盘';
if inblock('股权改革')=1 then var100:=var100+' 股权改革';
if inblock('股权投资')=1 then var100:=var100+' 股权投资';
DRAWTEXTEX(1,1,20,960,var100),color00ffff;
DRAWTEXTEX(1,1,20,900,'总股本:'+NUMTOSTR(DD,0)+'万股' +' 流通A股:'+NUMTOSTR(SS,0)+'万股'+' 市盈率:'+NUMTOSTR(HH,2)+'%'+'
xxx1:=(C+L+H)/3;
xxx2:EMA(xxx1,6),COLOR888888;
xxx3:EMA(xxx2,5),COLOR008888;
VAR1111:=BACKSET(REF(HIGH,2)=HHV(HIGH,5),3);
VAR2222:=CROSS(VAR1111,0.9);
VAR3333:=BACKSET(REF(LOW,2)=LLV(LOW,5),3);
VAR4444:=CROSS(VAR3333,0.9);
压力: REF(HIGH,BARSLAST(Var2222)), POINTDOT,ColorEA91B5;
STICKLINE(CLOSE,REF(HIGH,BARSLAST(Var2222)),REF(HIGH,BARSLAST(Var2222)),5,0),ColorEA91B5;
支撑: REF(LOW,BARSLAST(Var4444)), POINTDOT,Color00b4ff;
STICKLINE(CLOSE,REF(LOW,BARSLAST(Var4444)),REF(LOW,BARSLAST(Var4444)),5,0),Color00b4ff;
下档线:=(((CLOSE - LLV(LOW,13)) / (HHV(HIGH,13) - LLV(LOW,13))) * 100);
aRSV:=SMA(下档线,3,1);
aK:=SMA(aRSV,3,1);
aD:=((3 * aRSV) - (2 * aK));
aJ12:=(((CLOSE - LLV(LOW,55)) / (HHV(HIGH,55) - LLV(LOW,55))) * 100);
aRSV24:=SMA(aJ12,3,1);
aK24:=SMA(aRSV24,3,1);
aD24:=((3 * aRSV24) - (2 * aK24));
撑压位:=IF(CROSS(aD24,aD),HIGH,REF(HIGH,BARSLAST(CROSS(aD24,aD))));
底:=LLV(HIGH,30);
STICKLINE(BARSTATUS=2 ,撑压位,撑压位,40,1),LINETHICK1,COLORFFFFFF;
DRAWTEXT(BARSTATUS=2 ,撑压位,'
STICKLINE(BARSTATUS=2 ,底,底,40,1),COLOR00FF00,LINETHICK1;
DRAWTEXT(BARSTATUS=2 ,底,'
partline(c>0,c*2-ref(c,3)),SHIFT3,color005555;
partline(c>0,ref(c,1)*2-ref(c,4)),SHIFT2,color005500;
partline(c>0,ref(c,2)*2-ref(c,5)),SHIFT1,color55335;
if k=1 then begin
aa:=ref(h,n1)=hhv(h,2*n1+1);
aaa:=filter(aa,n1);
bb:=backset(aaa,n1+1);
cc1:=filter(bb,n1);
cc:=cc1 or BARSTATUS=2;
aa2:=ref(l,n1)=llv(l,2*n1+1);
aaa2:=filter(aa2,n1);
bb2:=backset(aaa2,n1+1);
cc22:=filter(bb2,n1);
cc2:=cc22 and not(cc1);
ea:=backset(cc,ref(barslast(cc2),1)+1);
eb:=ea>ref(ea,1);
ee:=backset(eb,2);
ff1:=ee>ref(ee,1);
ee2:=backset(ff1 and count(cc,ref(barslast(cc2),1)+2)=0,ref(barslast(cc2),1)+2);
ff2:=ee2>ref(ee2,1);
ee3:=backset(ff2 and count(cc,ref(barslast(cc2),1)+2)=0,ref(barslast(cc2),1)+2);
ff3:=ee3>ref(ee3,1);
js:=if(cc,count(cc2,ref(barslast(cc),1)+1),0);
g1:=if(js=1 and cc,barslast(ff1),0);
ga:=if(cc and ref(l,barslast(ff1))>=ref(l,barslast(ff2)),barslast(ff2),barslast(ff1));
g2:=if(js=2 and cc,ga,0);
g3:=if(js>=3 and cc,if(cc and ref(l,ga)>=ref(l,barslast(ff3)),barslast(ff3),ga),0);
gg:=g1+g2+g3;
ja:=backset(cc,gg);
jb:=ja>ref(ja,1);
jj:=backset(jb,2);
ld:=jj>ref(jj,1);
ld1:=ld or BARSTATUS=2;
hea:=backset(ld1,ref(barslast(cc),1)+1);
heb:=hea>ref(hea,1);
hee:=backset(heb,2);
hff1:=hee>ref(hee,1);
hee2:=backset(hff1 and count(ld1,ref(barslast(cc),1)+2)=0,ref(barslast(cc),1)+2);
hff2:=hee2>ref(hee2,1);
hee3:=backset(hff2 and count(ld1,ref(barslast(cc),1)+2)=0,ref(barslast(cc),1)+2);
hff3:=hee3>ref(hee3,1);
hjs:=if(ld1,count(cc1,ref(barslast(ld1),1)+1),0);
hg1:=if(hjs=1 and ld1,barslast(hff1),0);
hga:=if(ld1 and ref(h,barslast(hff1))<=ref(h,barslast(hff2)),barslast(hff2),barslast(hff1));
hg2:=if(hjs=2 and ld1,hga,0);
hg3:=if(hjs>=3 and ld1,if(ld1 and ref(h,hga)<=ref(h,barslast(hff3)),barslast(hff3),hga),0);
hgg:=hg1+hg2+hg3;
hja:=backset(ld1,hgg);
hjb:=hja>ref(hja,1);
hjj:=backset(hjb,2);
hd:=hjj>ref(hjj,1);
x1:=backset(BARSTATUS=2,barslast(ld)+1);
x2:=x1>ref(x1,1);
y1:=backset(BARSTATUS=2,barslast(hd)+1);
y2:=y1>ref(y1,1);
z1:=if(barslast(x2)<barslast(y2),x2,y2);
z2:=if(barslast(x2)<barslast(y2),l,h);
drawline(z1,z2,BARSTATUS=2,c,0),pointdot,colorff9900;
uu:=backset(BARSTATUS=2,barslast(ld)+1);
vv:=uu>ref(uu,1);
ww:=backset(vv,ref(barslast(ld),1)+2);
xx:=ww>ref(ww,1);
drawline(xx,l,vv,l,1),color00ffff;
uu2:=backset(BARSTATUS=2,barslast(hd)+1);
vv2:=uu2>ref(uu2,1);
ww2:=backset(vv2,ref(barslast(hd),1)+2);
xx2:=ww2>ref(ww2,1);
drawline(xx2,h,vv2,h,1),color00ffff;
END;
if k=2 then begin
V7:=BARSTATUS=2;
V8:=(REF(HIGH,n) = HHV(HIGH,((2 * n) + 1)));
V9:=FILTER(V8,n);
VA:=BACKSET(V9,(n + 1));
VB:=FILTER(VA,n);
VC:=(VB OR V7);
VD:=(REF(LOW,n) = LLV(LOW,((2 * n) + 1)));
VE:=FILTER(VD,n);
VF:=BACKSET(VE,(n + 1));
V10:=FILTER(VF,n);
V11:=(V10 AND NOT(VB));
V12:=BACKSET(VC,(REF(BARSLAST(V11),1) + 1));
V13:=(V12 > REF(V12,1));
V14:=BACKSET(V13,2);
V15:=(V14 > REF(V14,1));
V16:=BACKSET((V15 AND (COUNT(VC,(REF(BARSLAST(V11),1) + 2)) = 0)),(REF(BARSLAST(V11),1) + 2));
V17:=(V16 > REF(V16,1));
V18:=BACKSET((V17 AND (COUNT(VC,(REF(BARSLAST(V11),1) + 2)) = 0)),(REF(BARSLAST(V11),1) + 2));
V19:=(V18 > REF(V18,1));
V1A:=IF(VC,COUNT(V11,(REF(BARSLAST(VC),1) + 1)),0);
V1B:=IF(((V1A = 1) AND VC),BARSLAST(V15),0);
V1C:=IF((VC AND (REF(LOW,BARSLAST(V15)) >= REF(LOW,BARSLAST(V17)))),BARSLAST(V17),BARSLAST(V15));
V1D:=IF(((V1A = 2) AND VC),V1C,0);
V1E:=IF(((V1A >= 3) AND VC),IF((VC AND (REF(LOW,V1C) >= REF(LOW,BARSLAST(V19)))),BARSLAST(V19),V1C),0);
V1F:=((V1B + V1D) + V1E);
V20:=BACKSET(VC,V1F);
V21:=(V20 > REF(V20,1));
V22:=BACKSET(V21,2);
V23:=(V22 > REF(V22,1));
V24:=(V23 OR V7);
V25:=BACKSET(V24,(REF(BARSLAST(VC),1) + 1));
V26:=(V25 > REF(V25,1));
V27:=BACKSET(V26,2);
V28:=(V27 > REF(V27,1));
V29:=BACKSET((V28 AND (COUNT(V24,(REF(BARSLAST(VC),1) + 2)) = 0)),(REF(BARSLAST(VC),1) + 2));
V2A:=(V29 > REF(V29,1));
V2B:=BACKSET((V2A AND (COUNT(V24,(REF(BARSLAST(VC),1) + 2)) = 0)),(REF(BARSLAST(VC),1) + 2));
V2C:=(V2B > REF(V2B,1));
V2D:=IF(V24,COUNT(VB,(REF(BARSLAST(V24),1) + 1)),0);
V2E:=IF(((V2D = 1) AND V24),BARSLAST(V28),0);
V2F:=IF((V24 AND (REF(HIGH,BARSLAST(V28)) <= REF(HIGH,BARSLAST(V2A)))),BARSLAST(V2A),BARSLAST(V28));
V30:=IF(((V2D = 2) AND V24),V2F,0);
V3B:=IF(((V2D >= 3) AND V24),IF((V24 AND (REF(HIGH,V2F) <= REF(HIGH,BARSLAST(V2C)))),BARSLAST(V2C),V2F),0);
V3C:=((V2E + V30) + V3B);
V3D:=BACKSET(V24,V3C);
V3E:=(V3D > REF(V3D,1));
AA:=BACKSET(V3E,2);
AAA:=(AA > REF(AA,1));
BB:=BACKSET(V7,(BARSLAST(AAA) + 1));
CC1:=(BB > REF(BB,1));
CC:=BACKSET(CC1,(REF(BARSLAST(AAA),1) + 2));
AAA2:=(CC > REF(CC,1));
DRAWLINE(AAA2,HIGH,CC1,HIGH,1),POINTDOT,color00AAAA;
BB2:=(REF(HIGH,4) = HHV(HIGH,((2 * 4) + 1)));
CC22:=FILTER(BB2,4);
CC2:=BACKSET(CC22,(4 + 1));
EA:=FILTER(CC2,4);
EB:=(EA OR BARSTATUS=2);
A6:=(REF(LOW,4) = LLV(LOW,((2 * 4) + 1)));
EE:=FILTER(A6,4);
FF1:=BACKSET(EE,(4 + 1));
EE2:=FILTER(FF1,4);
FF2:=(EE2 AND NOT(EA));
EE3:=BACKSET(EB,(REF(BARSLAST(FF2),1) + 1));
FF3:=(EE3 > REF(EE3,1));
JS:=BACKSET(FF3,2);
G1:=(JS > REF(JS,1));
GA:=BACKSET((G1 AND (COUNT(EB,(REF(BARSLAST(FF2),1) + 2)) = 0)),(REF(BARSLAST(FF2),1) + 2));
G2:=(GA > REF(GA,1));
G3:=BACKSET((G2 AND (COUNT(EB,(REF(BARSLAST(FF2),1) + 2)) = 0)),(REF(BARSLAST(FF2),1) + 2));
GG:=(G3 > REF(G3,1));
JA:=IF(EB,COUNT(FF2,(REF(BARSLAST(EB),1) + 1)),0);
JB:=IF(((JA = 1) AND EB),BARSLAST(G1),0);
JJ:=IF((EB AND (REF(LOW,BARSLAST(G1)) >= REF(LOW,BARSLAST(G2)))),BARSLAST(G2),BARSLAST(G1));
LD:=IF(((JA = 2) AND EB),JJ,0);
LD1:=IF(((JA >= 3) AND EB),IF((EB AND (REF(LOW,JJ) >= REF(LOW,BARSLAST(GG)))),BARSLAST(GG),JJ),0);
HEA:=((JB + LD) + LD1);
HEB:=BACKSET(EB,HEA);
HEE:=(HEB > REF(HEB,1));
HFF1:=BACKSET(HEE,2);
HEE2:=(HFF1 > REF(HFF1,1));
HFF2:=(HEE2 OR BARSTATUS=2);
HEE3:=BACKSET(HFF2,(REF(BARSLAST(EB),1) + 1));
HFF3:=(HEE3 > REF(HEE3,1));
HJS:=BACKSET(HFF3,2);
HG1:=(HJS > REF(HJS,1));
HGA:=BACKSET((HG1 AND (COUNT(HFF2,(REF(BARSLAST(EB),1) + 2)) = 0)),(REF(BARSLAST(EB),1) + 2));
HG2:=(HGA > REF(HGA,1));
HG3:=BACKSET((HG2 AND (COUNT(HFF2,(REF(BARSLAST(EB),1) + 2)) = 0)),(REF(BARSLAST(EB),1) + 2));
HGG:=(HG3 > REF(HG3,1));
HJA:=IF(HFF2,COUNT(EA,(REF(BARSLAST(HFF2),1) + 1)),0);
HJB:=IF(((HJA = 1) AND HFF2),BARSLAST(HG1),0);
HJJ:=IF((HFF2 AND (REF(HIGH,BARSLAST(HG1)) <= REF(HIGH,BARSLAST(HG2)))),BARSLAST(HG2),BARSLAST(HG1));
HD:=IF(((HJA = 2) AND HFF2),HJJ,0);
X1:=IF(((HJA >= 3) AND HFF2),IF((HFF2 AND (REF(HIGH,HJJ) <= REF(HIGH,BARSLAST(HGG)))),BARSLAST(HGG),HJJ),0);
X2:=((HJB + HD) + X1);
Y1:=BACKSET(HFF2,X2);
Y2:=(Y1 > REF(Y1,1));
Z1:=BACKSET(Y2,2);
Z2:=(Z1 > REF(Z1,1));
WW2:=BACKSET(BARSTATUS=2,(BARSLAST(HEE2) + 1));
XX2:=(WW2 > REF(WW2,1));
VAR246:=BACKSET(XX2,(REF(BARSLAST(HEE2),1) + 2));
VAR247:=(VAR246 > REF(VAR246,1));
DRAWLINE(VAR247,LOW,XX2,LOW,1),POINTDOT,color00AAAA;
VAR249:=BACKSET(BARSTATUS=2,(BARSLAST(Z2) + 1));
VAR250:=(VAR249 > REF(VAR249,1));
VAR251:=BACKSET(VAR250,(REF(BARSLAST(Z2),1) + 2));
VAR252:=(VAR251 > REF(VAR251,1));
DRAWLINE(VAR252,HIGH,VAR250,HIGH,1),POINTDOT,color00AAAA;
END;
if k=3 then begin
wN:=p1;{原码 N:=3;}
wA1:=REF(H,wN)=HHV(H,2*wN+1); wB1:=FILTER(wA1,wN);
wC1:=BACKSET(wB1,wN+1);
wD1:=FILTER(wC1,wN);{高点}
wA2:=REF(L,wN)=LLV(L,2*wN+1);
wB2:=FILTER(wA2,wN); wC2:=BACKSET(wB2,wN+1);
wD2:=FILTER(wC2,wN);{低点}
wE1:=(REF(LLV(L,2*wN),1)+REF(HHV(H,2*wN),1))/2;
wE2:=(H+L)/2;
wH1:=(wD1 AND NOT(wD2 AND wE1>=wE2)) OR BARSTATUS=2 OR BARSCOUNT(C)=1;
wL1:=(wD2 AND NOT(wD1 AND wE1<wE2));
wH2:=wD1 AND NOT(wD2 AND wE1>=wE2);
wX1:=REF(BARSLAST(wH1),1)+1; wF1:=BACKSET(wH1 AND COUNT(wL1,wX1)>0,LLVBARS(IF(wL1,L,10000),wX1));
wG1:=wF1>REF(wF1,1); wI1:=BACKSET(wG1,2);
wLD:=wI1>REF(wI1,1);{过滤后低点}
wL2:=wLD OR BARSTATUS=2 OR BARSCOUNT(C)=1;
wX2:=REF(BARSLAST(wL2),1)+1;
wF2:=BACKSET(wL2 AND COUNT(wH2,wX2)>0,HHVBARS(IF(wH2,H,0),wX2));
wG2:=wF2>REF(wF2,1); wI2:=BACKSET(wG2,2);
wHD:=wI2>REF(wI2,1);{过滤后高点}
wR1:=BACKSET(BARSTATUS=2,BARSLAST(wHD)+1);
wS1:=wR1>REF(wR1,1); {前一高}
wT1:=BACKSET(BARSTATUS=2,BARSLAST(wLD)+1); wU1:=wT1>REF(wT1,1); {前一低}
wR2:=BACKSET(wS1,REF(BARSLAST(wHD),1)+2); wS2:=wR2>REF(wR2,1); {前二高}
wT2:=BACKSET(wU1,REF(BARSLAST(wLD),1)+2); wU2:=wT2>REF(wT2,1); {前二低}
wT3:=BACKSET(wU2,REF(BARSLAST(wLD),1)+2); wU3:=wT3>REF(wT3,1); {前三低}
wT4:=BACKSET(wU3,REF(BARSLAST(wLD),1)+2); wU4:=wT4>REF(wT4,1); {前四低}
wR3:=BACKSET(wS2,REF(BARSLAST(wHD),1)+2); wS3:=wR3>REF(wR3,1); {前三高}
wR4:=BACKSET(wS3,REF(BARSLAST(wHD),1)+2); wS4:=wR4>REF(wR4,1); {前四高}
DRAWLINE(wS2,H,wS1,H,1),Color008888; {★压力1:}
DRAWLINE(wU2,L,wU1,L,1),POINTDOT,Color008888;{★支撑1:}
DRAWLINE(wS3,H,wS2,H,1),Color888000; {★压力2:}
DRAWLINE(wU3,L,wU2,L,1),POINTDOT,Color888000;{★支撑2:}
DRAWLINE(wS4,H,wS3,H,1),Color0000CC;{★压力3:}
DRAWLINE(wU4,L,wU3,L,1),POINTDOT,Color0000CC;{★支撑3:};
END;