通达信坡度几何副图公式 源码

[复制链接]
查看34 | 回复0 | 2022-7-24 03:29:43 | 显示全部楼层 |阅读模式

HJ_1:=BACKSET(LOWRANGE(LOW)>=5,4);
 HJ_2:=BACKSET(HJ_1=0 AND REF(HJ_1,1)=1,2);
 HJ_3:=IF(HJ_2=1 AND REF(HJ_2,1)=0,(-1),0);
 HJ_4:=BACKSET(TOPRANGE(HIGH)>=5,4);
 HJ_5:=BACKSET(HJ_4=0 AND REF(HJ_4,1)=1,2);
 HJ_6:=IF(HJ_5=1 AND REF(HJ_5,1)=0,1,0);
 HJ_7:=REF(BARSLAST(HJ_6=1),1)+1;
 HJ_8:=REF(BARSLAST(HJ_3=(-1)),1)+1;
 HJ_9:=LOWRANGE(LOW);
 HJ_10:=TOPRANGE(HIGH);
 HJ_11:=IF(HJ_3=(-1) AND NOT(HJ_6=1),(-1),IF(NOT(HJ_3=(-1)) AND HJ_6=1,1,IF(HJ_3=(-1) AND HJ_6=1,IF(HJ_7>HJ_8,1,(-1)),0)));
 HJ_12:=IF(HJ_3=(-1) AND REF(HJ_7,1)>REF(HJ_8,1) AND LLV(LOW,HJ_7+1)<REF(LLV(LOW,HJ_7+1),1),(-1),0);
 HJ_13:=IF(HJ_3=(-1) AND REF(HJ_7,1)<REF(HJ_8,1) AND HJ_7>=4,(-1),0);
 HJ_14:=HJ_7<4;
 HJ_15:=HJ_3=(-1) AND REF(HJ_7,1)<REF(HJ_8,1);
 HJ_16:=LOW<REF(LOW,HJ_8) OR HJ_9>REF(HJ_10,HJ_7);
 HJ_17:=HJ_14 AND HJ_15 AND HJ_16;
 HJ_18:=IF(HJ_12=(-1) OR HJ_13=(-1) OR HJ_17 AND HJ_11=(-1),(-1),0);
 HJ_19:=IF(HJ_6=1 AND REF(HJ_8,1)>REF(HJ_7,1) AND HHV(HIGH,HJ_8+1)>REF(HHV(HIGH,HJ_8+1),1),1,0);
 HJ_20:=IF(HJ_6=1 AND REF(HJ_8,1)<REF(HJ_7,1) AND HJ_8>=4,1,0);
 HJ_21:=HJ_8<4 OR REF(HJ_18,HJ_8)=0;
 HJ_22:=HJ_6=1 AND REF(HJ_8,1)<REF(HJ_7,1);
 HJ_23:=HIGH>REF(HIGH,HJ_7) OR HJ_10>REF(HJ_9,HJ_8);
 HJ_24:=HJ_21 AND HJ_22 AND HJ_23;
 HJ_25:=IF(HJ_19=1 OR HJ_20=1 OR HJ_24 AND HJ_11=1,1,0);
 HJ_26:=REF(BARSLAST(HJ_25=1),1)+1;
 HJ_27:=REF(BARSLAST(HJ_18=(-1)),1)+1;
 HJ_28:=IF(HJ_18=(-1) AND REF(HJ_26,1)>REF(HJ_27,1) AND LLV(LOW,HJ_26+1)<REF(LLV(LOW,HJ_26+1),1),(-1),0);
 HJ_29:=IF(HJ_18=(-1) AND REF(HJ_26,1)<REF(HJ_27,1) AND HJ_26>=4,(-1),0);
 HJ_30:=HJ_26<4 OR REF(HJ_25,HJ_26)=0;
 HJ_31:=HJ_18=(-1) AND REF(HJ_26,1)<REF(HJ_27,1);
 HJ_32:=LOW<REF(LOW,HJ_27) OR HJ_9>REF(HJ_10,HJ_26);
 HJ_33:=HJ_30 AND HJ_31 AND HJ_32;
 HJ_34:=IF(HJ_28=(-1) OR HJ_29=(-1) OR HJ_33,(-1),0);
 HJ_35:=IF(HJ_25=1 AND REF(HJ_27,1)>REF(HJ_26,1) AND HHV(HIGH,HJ_27+1)>REF(HHV(HIGH,HJ_27+1),1),1,0);
 HJ_36:=IF(HJ_25=1 AND REF(HJ_27,1)<REF(HJ_26,1) AND HJ_27>=4,1,0);
 HJ_37:=HJ_27<4 OR REF(HJ_18,HJ_27)=0;
 HJ_38:=HJ_25=1 AND REF(HJ_27,1)<REF(HJ_26,1);
 HJ_39:=HIGH>REF(HIGH,HJ_26) OR HJ_10>REF(HJ_9,HJ_27);
 HJ_40:=HJ_37 AND HJ_38 AND HJ_39;
 HJ_41:=IF(HJ_35=1 OR HJ_36=1 OR HJ_40,1,0);
 HJ_42:=REF(BARSLAST(HJ_41=1),1)+1;
 HJ_43:=REF(BARSLAST(HJ_34=(-1)),1)+1;
 HJ_44:=IF(HJ_34=(-1) AND REF(HJ_42,1)>REF(HJ_43,1) AND LLV(LOW,HJ_42+1)<REF(LLV(LOW,HJ_42+1),1),(-1),0);
 HJ_45:=IF(HJ_34=(-1) AND REF(HJ_42,1)<REF(HJ_43,1) AND HJ_42>=4,(-1),0);
 HJ_46:=HJ_42<4 OR REF(HJ_41,HJ_42)=0;
 HJ_47:=HJ_34=(-1) AND REF(HJ_42,1)<REF(HJ_43,1);
 HJ_48:=LOW<REF(LOW,HJ_43) OR HJ_9>REF(HJ_10,HJ_42);
 HJ_49:=HJ_46 AND HJ_47 AND HJ_48;
 HJ_50:=IF(HJ_44=(-1) OR HJ_45=(-1) OR HJ_49,(-1),0);
 HJ_51:=IF(HJ_41=1 AND REF(HJ_43,1)>REF(HJ_42,1) AND HHV(HIGH,HJ_43+1)>REF(HHV(HIGH,HJ_43+1),1),1,0);
 HJ_52:=IF(HJ_41=1 AND REF(HJ_43,1)<REF(HJ_42,1) AND HJ_43>=4,1,0);
 HJ_53:=HJ_43<4 OR REF(HJ_34,HJ_43)=0;
 HJ_54:=HJ_41=1 AND REF(HJ_43,1)<REF(HJ_42,1);
 HJ_55:=HIGH>REF(HIGH,HJ_42) OR HJ_10>REF(HJ_9,HJ_43);
 HJ_56:=HJ_53 AND HJ_54 AND HJ_55;
 HJ_57:=IF(HJ_51=1 OR HJ_52=1 OR HJ_56,1,0);
 HJ_58:=REF(BARSLAST(HJ_57=1),1)+1;
 HJ_59:=REF(BARSLAST(HJ_50=(-1)),1)+1;
 HJ_60:=REF(BARSLAST(HJ_57=1),BARSLAST(HJ_57=1)+1)+BARSLAST(HJ_57=1)+1;
 HJ_61:=REF(BARSLAST(HJ_50=(-1)),BARSLAST(HJ_50=(-1))+1)+BARSLAST(HJ_50=(-1))+1;
 HJ_62:=BACKSET(HJ_50=(-1) AND HJ_58<HJ_59,HJ_58+1);
 HJ_63:=BACKSET(HJ_50=(-1) AND HJ_58>HJ_59,HJ_61+1);
 HJ_64:=BACKSET(HJ_57=1 AND HJ_58>HJ_59,HJ_59+1);
 HJ_65:=BACKSET(HJ_57=1 AND HJ_58<HJ_59,HJ_60+1);
 HJ_66:=BACKSET(HJ_58>HJ_59 AND HJ_59>=4 AND HIGH>=HHV(HIGH,HJ_59) AND LOW>LLV(LOW,HJ_59+1) AND TOPRANGE(HIGH)>=5,HJ_59+1);
 HJ_67:=BACKSET(HJ_58<HJ_59 AND HJ_58>=4 AND LOW<=LLV(LOW,HJ_58) AND HIGH<HHV(HIGH,HJ_58+1) AND LOWRANGE(LOW)>=5,HJ_58+1);
 HJ_68:=IF(HJ_50=(-1) AND (HJ_62+HJ_64=2 OR HJ_63+HJ_64=2 OR HJ_62+HJ_65=2 OR HJ_62+HJ_66=2 OR HJ_63+HJ_66=2),(-1),0);
 HJ_69:=IF(HJ_57=1 AND (HJ_62+HJ_64=2 OR HJ_63+HJ_64=2 OR HJ_62+HJ_65=2 OR HJ_64+HJ_67=2 OR HJ_65+HJ_67=2),1,0);
 HJ_70:=REF(BARSLAST(HJ_68=(-1)),1)+1;
 HJ_71:=REF(BARSLAST(HJ_68=(-1)),HJ_70+1)+HJ_70+1;
 HJ_72:=REF(BARSLAST(HJ_69=1),1)+1;
 HJ_73:=REF(BARSLAST(HJ_69=1),HJ_72+1)+HJ_72+1;
高到低:IF(HJ_68=(-1),ATAN((LOW-REF(HIGH,HJ_72))/REF(HIGH,HJ_72)/HJ_72*100)/3.141593*180,DRAWNULL),CIRCLEDOT,COLORYELLOW;
低到高:IF(HJ_69=1,ATAN((HIGH-REF(LOW,HJ_70))/REF(LOW,HJ_70)/HJ_70*100)/3.141593*180,DRAWNULL),CIRCLEDOT,COLORMAGENTA;
 NOTEXT1:DRAWLINE(HJ_69=1,低到高,HJ_68=(-1),高到低,0),COLOR99CCFF;
 NOTEXT2:DRAWLINE(HJ_68=(-1),高到低,HJ_69=1,低到高,0),COLOR000066;
 NOTEXT涨:PLOYLINE(HJ_69=1,低到高),COLORRED;
 NOTEXT跌:PLOYLINE(HJ_68=(-1),高到低),COLORGREEN;
跌坡度:DRAWNUMBER(HJ_68=(-1),高到低*1.3,高到低),COLORYELLOW;
涨坡度:DRAWNUMBER(HJ_69=1,低到高*1.3,低到高),COLORMAGENTA;
 HJ_74:=HJ_69=1 AND HIGH>REF(HIGH,HJ_72) AND 低到高<REF(低到高,HJ_72);
 HJ_75:=HJ_68=(-1) AND LOW<REF(LOW,HJ_70) AND 高到低>REF(高到低,HJ_70);
 DRAWICON(HJ_74,低到高,2);
 DRAWICON(HJ_75,高到低,1);
 HJ_76:=IF(NOT(HJ_69=1) AND HJ_72>HJ_70 AND HIGH>=HHV(HIGH,HJ_70) AND BACKSET(ISLASTBAR,HJ_72+1) AND BACKSET(ISLASTBAR,HJ_70+1) AND BACKSET(ISLASTBAR,BARSLAST(HIGH>=HHV(HIGH,HJ_70))+1),1,0);
 HJ_77:=IF(NOT(HJ_68=(-1)) AND HJ_72<HJ_70 AND LOW<=LLV(LOW,HJ_72) AND BACKSET(ISLASTBAR,HJ_72+1) AND BACKSET(ISLASTBAR,HJ_70+1) AND BACKSET(ISLASTBAR,BARSLAST(LOW<=LLV(LOW,HJ_72))+1),1,0);
临时高点坡度:IF(HJ_76,ATAN((HIGH-REF(LOW,HJ_70))/REF(LOW,HJ_70)/HJ_70*100)/3.141593*180,DRAWNULL),CIRCLEDOT,COLORMAGENTA;
临时低点坡度:IF(HJ_77,ATAN((LOW-REF(HIGH,HJ_72))/REF(HIGH,HJ_72)/HJ_72*100)/3.141593*180,DRAWNULL),CIRCLEDOT,COLORBLUE;
 NOTEXT3:DRAWLINE(HJ_69=1,低到高,HJ_77,临时低点坡度,0),DOTLINE,COLOR99CCFF;
 NOTEXT4:DRAWLINE(HJ_68=(-1),高到低,HJ_76,临时高点坡度,0),DOTLINE,COLOR000066;
 NOTEXT5:DRAWLINE(HJ_69=1 AND BACKSET(ISLASTBAR,HJ_72+1),低到高,HJ_76,临时高点坡度,0),DOTLINE,COLORRED;
 NOTEXT6:DRAWLINE(HJ_68=(-1) AND BACKSET(ISLASTBAR,HJ_70+1),高到低,HJ_77,临时低点坡度,0),DOTLINE,COLORGREEN;
 DRAWNUMBER(HJ_77,临时低点坡度*1.3,临时低点坡度),COLORYELLOW;
 DRAWNUMBER(HJ_76,临时高点坡度*1.3,临时高点坡度),COLORMAGENTA;
 HJ_78:=HJ_76 AND HIGH>REF(HIGH,HJ_72) AND 临时高点坡度<REF(低到高,HJ_72);
 HJ_79:=HJ_77 AND LOW<REF(LOW,HJ_70) AND 临时低点坡度>REF(高到低,HJ_70);
 DRAWICON(HJ_78,临时高点坡度,2);
 DRAWICON(HJ_79,临时低点坡度,1);

713377333.jpg

713377333.jpg

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则