编写要求:
请老师将通达信《风险测评》副图公式改为飞狐所用,谢谢! 源码如下: {指标 1,100,1} RSVA1:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100; RSVA2:=100*(HHV(HIGH,9)-CLOSE)/(HHV(HIGH,9)-LLV(LOW,9)); VAR21:=SMA(RSVA2,9,1)+100; VAR11:=SMA(RSVA1,3,1); VAR51:=SMA(VAR11,3,1)+100; 顶底线:=VAR51-VAR21+50; VAR2:=LLV(LOW,33); VAR3:=HHV(HIGH,21); VAR4:=EMA((CLOSE-VAR2)/(VAR3-VAR2)*100,10)*-1+100; 趋势:=100-EMA(0.191*REF(VAR4,1)+0.809*VAR4,1); STICKLINE(C,100,90,4,0),COLORFFCC33; STICKLINE(C,90,80,4,0),COLORFF9933; STICKLINE(顶底线>REF(顶底线,1),20,80,4,0),COLOR9999FF; STICKLINE(顶底线REF(趋势,1) AND 顶底线REF(顶底线,1)),20,80,4,0),COLOR009966; STICKLINE(C,20,10,4,0),COLORFF6633; STICKLINE(C,10,0,4,0),COLORFF3333; 10,COLORLIGRAY; 90,COLORLIGRAY; {MACD} Y:=(L+H)/2; AO:=SMA(Y,5,1); AC:=SMA(Y,34,1); DIFZ:=(AO-AC)*10; DH:=(SMA(DIFZ-SMA(DIFZ,3,1),2,1))*6,COLORSTICK; RC:=50; DRAWBAND(DIFZ+RC,RGB(185,50,50),EMA(DIFZ+RC,9),RGB(0,50,190)); DRAWBAND(-DIFZ+RC,RGB(0,50,190),EMA(-DIFZ+RC,9),RGB(185,50,50)); IF(C,DIFZ+RC,DRAWNULL),COLORRED,LINETHICK1; IF(DIFZ<=REF(DIFZ,1),DIFZ+RC,DRAWNULL),COLORGRAY; HS:RC,COLORYELLOW,LINETHICK1; IF(DH>0,HS,DRAWNULL),COLOR2266FF,LINETHICK1; IF(DH<=0,HS,DRAWNULL),COLORDDDD66,LINETHICK1; STICKLINE(DH>0 AND DH>REF(DH,1),RC,RC+DH,1,0),COLORRED; STICKLINE(DH>0 AND DH<=REF(DH,1),RC,RC+DH,1,0),COLORLIGREEN; STICKLINE(DH<0 AND DH>REF(DH,1),RC,RC+DH,1,0),COLORLIRED; STICKLINE(DH<0 AND DH<=REF(DH,1),RC,RC+DH,1,0),COLORLIBLUE; DRAWTEXT(FILTER(CLOSE>0,25),5,'高安区'),COLORLIGRAY; DRAWTEXT(FILTER(CLOSE>0,25),15,'安全区'),COLORLIGRAY; DRAWTEXT(FILTER(CLOSE>0,25),35,'绿持币'),COLORYELLOW; {DRAWTEXT(FILTER(CLOSE>0,25),50,'(投资区)'),COLORBROWN;} DRAWTEXT(FILTER(CLOSE>0,25),75,'粉持股'),COLORYELLOW; DRAWTEXT(FILTER(CLOSE>0,25),85,'风险区'),COLORBROWN; DRAWTEXT(FILTER(CLOSE>0,25),95,'高险区'),COLORBROWN; 趋势线:100-EMA(0.191*REF(VAR4,1)+0.809*VAR4,1),LINETHICK2,COLORBLUE; IF(趋势线>REF(趋势线,1),趋势线,DRAWNULL),COLORRED,LINETHICK2; 当前安全度:100-EMA(0.191*REF(VAR4,1)+0.809*VAR4,1),CIRCLEDOT,LINETHICK1,COLORBLUE; IF(当前安全度>REF(当前安全度,1),当前安全度,DRAWNULL),CIRCLEDOT,COLORRED,LINETHICK2; {背离} 短势:=IF(指标=1,"KDJ.K",IF(指标=2,"MACD.DIF",IF(指标=3,"CCI.CCI",IF(指标=4,"DMA.AMA", IF(指标=5,"RSI.RSI1",IF(指标=6,"DMI.ADX",IF(指标=7,"PSY.PSY",IF(指标=8,"BIAS.BIAS1", IF(指标=9,"CR.MA1",IF(指标=10,"MTM.MTM","VMA.VMA1")))))))))); 局部低点预选A:=BACKSET(LLV(L,5)REF(HHV(H,4),1),4); 局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2); 局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选B,1)=0,1,0); 缺口判断:=IF(L>REF(H,1),1,IF(HREF(距前低天,1) AND LLV(L,距前高天+1)=4 OR LLV(缺口判断,距前高天)=-1 OR LLV(L,距前低天+2)REF(小值周期,距前低天+1) AND 大值周期>REF(小值周期,距前低天) AND 大值周期>REF(大值周期,距前高天),1,0); 高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1)>REF(距前高天,1) AND HHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0); 高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天>=4 OR HHV(缺口判断,距前低天)=1),1,0); 高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) AND H>REF(L,距前低天+1),1,0); 预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0); 判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND 预判A=1 AND 小值周期>REF(大值周期,距前高天+1) AND 小值周期>REF(大值周期,距前高天) AND 小值周期>REF(小值周期,距前低天),-1,0); 低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)=4 OR LLV(缺口判断,距前高天)=-1 OR 判断A=-1),-1,0); 低保留:=IF((低保留A=-1 OR 低保留B=-1) AND LREF(小值周期,距前低天A+1) AND 大值周期>REF(小值周期,距前低天A) AND 大值周期>REF(大值周期,距前高天A),1,0); 高保留XA:=IF(局部高点预选C=1 AND REF(距前低天A,1)>REF(距前高天A,1) AND HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0); 高保留XB:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND REF(低保留,距前低天A)=-1 AND (距前低天A>=4 OR HHV(缺口判断,距前低天A)=1),1,0); 高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判断X=1) AND H>REF(L,距前低天A+1),1,0); 预判XA:=IF((距前高天A<4 AND HHV(缺口判断,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0); 判断XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND 预判XA=1 AND 小值周期>REF(大值周期,距前高天A+1) AND 小值周期>REF(大值周期,距前高天A) AND 小值周期>REF(小值周期,距前低天A),-1,0); 低保留XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)>REF(距前低天A,1) AND LLV(L,距前高天A+1)=4 OR LLV(缺口判断,距前高天A)=-1 OR 判断XA=-1),-1,0); 低保留X:=IF((低保留XA=-1 OR 低保留XB=-1) AND LREF(小值周期,距前低天YA+1) AND 大值周期>REF(小值周期,距前低天YA) AND 大值周期>REF(大值周期,距前高天YA),1,0); 高保留YXA:=IF(局部高点预选C=1 AND REF(距前低天YA,1)>REF(距前高天YA,1) AND HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0); 高保留YXB:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND REF(低保留X,距前低天YA)=-1 AND (距前低天YA>=4 OR HHV(缺口判断,距前低天YA)=1),1,0); 高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判断YX=1) AND H>REF(L,距前低天YA+1),1,0); 预判YXA:=IF((距前高天YA<4 AND HHV(缺口判断,距前高天YA)!=1) OR REF(高保留YXA,距前高天YA)=0,1,0); 判断YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND 预判YXA=1 AND 小值周期>REF(大值周期,距前高天YA+1) AND 小值周期>REF(大值周期,距前高天YA) AND 小值周期>REF(小值周期,距前低天YA),-1,0); 低保留YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)>REF(距前低天YA,1) AND LLV(L,距前高天YA+1)=4 OR LLV(缺口判断,距前高天YA)=-1 OR 判断YXA=-1),-1,0); 低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) AND LREF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1 AND LREF(局部势高,1)&&局部高REF(局部低,1),0.5,0),COLOR00FF00; DRAWICON(REF(对比高离,1)=1&&对比高离=0.5,趋势线,2); DRAWICON(REF(对比低背,1)=0&&对比低背=0.5,趋势线,1); DRAWTEXT(指标=0&&CURRBARSCOUNT=18,0.5+RC,'VMA.VMA1'); DRAWTEXT(指标=1&&CURRBARSCOUNT=18,0.5+RC,'KDJ.K'); DRAWTEXT(指标=10&&CURRBARSCOUNT=18,0.5+RC,'MTM.MTM');
解答:
?input:指标(1,1,100);
CURRBARSCOUNT:=DATACOUNT-BARPOS+1;
Copyright 2018- www.dyjian.com/ 大宇股票知识网 海口美兰韩哲棚百货商行 版权所有 琼ICP备2023001966号
免责声名:本站所发表的内容仅用于学术交流和学习,内容所带来的一切后果均与本站无关。若您发现本站存在您非授权的原创作品,请第一时间联系本站删除!