最近根据网上资料编写这个分时主图加日K线公式,可以关闭阻力 支撑 日K线或上下 左右 位置调整,就这些东东,想添加其它指标就自己动手吧,没有测试多久,有错的地方请指正,喜欢的就请给加点果果了。大智慧L2 源码如下:3根日K线源码:{引用日线}JC:C;JO:O;JH:H;JL:L;JC1:REF(C,1);JO1:REF(O,1);JH1:REF(H,1);JL1:REF(L,1);JC2:REF(C,2);JO2:REF(O,2);JH2:REF(H,2);JL2:REF(L,2);JC3:REF(C,3);JC4:REF(C,4);JC5:REF(C,5);JCYC:=(HIGH+LOW+OPEN+2*CLOSE)/5;明日阻力:=2*JCYC-LOW;明日支撑:=2*JCYC-HIGH;明日突破:=JCYC+(HIGH-LOW);明日反转:=JCYC-(HIGH-LOW);阻力:REF(明日阻力,1);支撑:REF(明日支撑,1);突破:REF(明日突破,1);反转:REF(明日反转,1);JM1:MA(C,5);JM2:MA(C,10);把以上代码保存为 引用日线 公式名作为主图的引用。
{主图公式)INPUT: 上下调整(400,50,1000),左右调整(550,150,1000),打开关闭(3,0,3);{日K线引用}if 打开关闭>0 then begin阻力:="引用日线.阻力#day";支撑:="引用日线.支撑#day";突破:="引用日线.突破#day";反转:="引用日线.反转#day";JM1:="引用日线.JM1#day";JM2:="引用日线.JM2#day";JC:="引用日线.JC#day";JO:="引用日线.JO#day";JH:="引用日线.JH#day";JL:="引用日线.JL#day";JC1:="引用日线.JC1#day";JO1:="引用日线.JO1#day";JH1:="引用日线.JH1#day";JL1:="引用日线.JL1#day";JC2:="引用日线.JC2#day";JO2:="引用日线.JO2#day";JH2:="引用日线.JH2#day";JL2:="引用日线.JL2#day";JC3:="引用日线.JC3#day";YT1:=JC>JC1 AND JC=JO;YT2:=JCJC2 AND JC1=JO1;YT4:=JC1JC3 AND JC2=JO2;YT6:=JC20.015,JC1/JO1*2000-2000,5);JJHA1:=JH1/JC1*2000-2000;JJLA1:=JO1/JL1*2000-2000;JWA1:=JC1-JO1>0 OR YT3>0;if JWA1>0 then beginDRAWRECTREL(左右调整,上下调整-JJCA1,左右调整+17,上下调整,0),COLOR4535FF;DRAWRECTREL(左右调整+8,上下调整-JJCA1-JJHA1,左右调整+9,上下调整-JJCA1,0),COLOR5040FF;DRAWRECTREL(左右调整+8,上下调整,左右调整+9,上下调整+JJLA1,0),COLOR5040FF;end;JZST:=STRFIND(stkname,'S',1) AND JC1/JC2>=1.048;JZTB:=JC1/JC2>=1.0994 OR JZST;if JZTB>0 then beginDRAWRECTREL(左右调整+2,上下调整-JJCA1+2,左右调整+15,上下调整-2,RGB(255,255,0)),COLORYELLOW;end;{昨收阴}JJHA2:=JH1/JO1*2000-2000;JJLA2:=JC1/JL1*2000-2000;JWA2:=JO1-JC1>0 OR YT4>0;if JWA2>0 then begin DRAWRECTREL(左右调整,上下调整,左右调整+17,上下调整-JJCA1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整+8,上下调整-JJHA2,左右调整+9,上下调整-JJCA1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整+8,上下调整-JJCA1,左右调整+9,上下调整-JJCA1+JJLA2,RGB(0,255,255)),COLORFFFF00;end;JZST1:=STRFIND(stkname,'S',1) AND JC1/JC20.015,JC2/JO2*2000-2000,5);JJHB1:=JH2/JC2*2000-2000;JJLB1:=JO2/JL2*2000-2000;JZKB1:=JO1/JC2*2000-2000;QSYB1:=上下调整+JZKB1;JWB1:=(JC2-JO2>0 OR YT5>0);if JWB1>0 then begin DRAWRECTREL(左右调整-23,QSYB1+JJCB1,左右调整-6,QSYB1,0),COLOR4535FF;DRAWRECTREL(左右调整-15,QSYB1-JJHB1,左右调整-14,QSYB1,0),COLOR5040FF;DRAWRECTREL(左右调整-15,QSYB1+JJCB1+JJLB1,左右调整-14,QSYB1+JJCB1,0),COLOR5040FF;end;JZST2:=STRFIND(stkname,'S',1) AND JC2/JC3>=1.048;JZTB2:=JC2/JC3>=1.0994 OR JZST2;if JZTB2>0 then beginDRAWRECTREL(左右调整-21,QSYB1+JJCB1-2,左右调整-8,QSYB1+2,RGB(255,255,0)),COLORYELLOW;end;{前收阴}JJHB2:=JH2/JO2*2000-2000;JJLB2:=JC2/JL2*2000-2000;JWB2:=(JO2-JC2>0 OR YT6>0);if JWB2>0 then begin DRAWRECTREL(左右调整-23,QSYB1+JJCB1,左右调整-6,QSYB1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整-15,QSYB1+JJCB1-JJHB2,左右调整-14,QSYB1+JJCB1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整-15,QSYB1,左右调整-14,QSYB1+JJLB2,RGB(0,255,255)),COLORFFFF00;end;JZST3:=STRFIND(stkname,'S',1) AND JC2/JC30.015,JC/JO*2000-2000,5);JJHC1:=JH/JC*2000-2000;JJLC1:=JO/JL*2000-2000;JZKC1:=JO/JC1*2000-2000;QSYC1:=上下调整-JJCA1-JZKC1;JWC1:=(JC-JO>0 OR YT1>0);if JWC1>0 then begin DRAWRECTREL(左右调整+23,QSYC1-JJCC1,左右调整+40,QSYC1,0),COLOR4535FF;DRAWRECTREL(左右调整+31,QSYC1-JJCC1-JJHC1,左右调整+32,QSYC1-JJCC1,0),COLOR5040FF;DRAWRECTREL(左右调整+31,QSYC1,左右调整+32,QSYC1+JJLC1,0),COLOR5040FF;end;JZST4:=STRFIND(stkname,'S',1) AND JC/JC1>=1.048;JZTB4:=JC/JC1>=1.0994 OR JZST4;if JZTB4>0 then beginDRAWRECTREL(左右调整+25,QSYC1-JJCC1+2,左右调整+38,QSYC1-2,RGB(255,255,0)),COLORYELLOW;end;{今收阴}JJHC2:=JH/JO*2000-2000;JJLC2:=JC/JL*2000-2000;JWC2:=(JO-JC>0 OR YT2>0);if JWC2>0 then begin DRAWRECTREL(左右调整+23,QSYC1,左右调整+40,QSYC1-JJCC1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整+31,QSYC1-JJHC2,左右调整+32,QSYC1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整+31,QSYC1-JJCC1,左右调整+32,QSYC1-JJCC1+JJLC2,RGB(0,255,255)),COLORFFFF00;end;JZST5:=STRFIND(stkname,'S',1) AND JC/JC12 then beginDRAWTEXTREL(左右调整+38,QSYC1-JZLC1,'ˉˉˉ'),Colorffa800;DRAWTEXTREL(左右调整+60,QSYC1-JZLC1,'阻力 '+NUMTOSTRN(阻力,2)),Colorffa800;DRAWTEXTREL(左右调整+38,QSYC1-JZZC1,'ˉˉˉ'),Colorffa800;DRAWTEXTREL(左右调整+60,QSYC1-JZZC1,'支撑 '+NUMTOSTRN(支撑,2)),Colorffa800;DRAWTEXTREL(左右调整+38,QSYC1-JTPC1,'ˉˉˉ'),Colorffa800;DRAWTEXTREL(左右调整+60,QSYC1-JTPC1,'突破 '+NUMTOSTRN(突破,2)),Colorffa800;DRAWTEXTREL(左右调整+38,QSYC1-JFZC1,'ˉˉˉ'),Colorffa800;DRAWTEXTREL(左右调整+60,QSYC1-JFZC1,'反转 '+NUMTOSTRN(反转,2)),Colorffa800;end;if 打开关闭>1 then beginDRAWTEXTREL(左右调整+20,QSYC1-JMAC1,'ˉˉˉˉˉˉˉ'),ColorFFFFFF;DRAWTEXTREL(左右调整+120,QSYC1-JMAC1,'MA5 '+NUMTOSTRN(JM1,2)),ColorFFFFFF;DRAWTEXTREL(左右调整+20,QSYC1-JMAC2,'ˉˉˉˉˉˉˉˉˉˉ'),COLORYELLOW;DRAWTEXTREL(左右调整+140,QSYC1-JMAC2,'MA10 '+NUMTOSTRN(JM2,2)),COLORYELLOW;end;end;
上图中上下调整 左右调整 就是调整日K线的位置,打开关闭设置为:3 是全部打开,2是只开日K线和5 10 日均线,1是只开日K线,0是全部关闭。
5根日K线源码:{引用日线}JC:C;JO:O;JH:H;JL:L;JC1:REF(C,1);JO1:REF(O,1);JH1:REF(H,1);JL1:REF(L,1);JC2:REF(C,2);JO2:REF(O,2);JH2:REF(H,2);JL2:REF(L,2);JC3:REF(C,3);JO3:REF(O,3);JH3:REF(H,3);JL3:REF(L,3);JC4:REF(C,4);JO4:REF(O,4);JH4:REF(H,4);JL4:REF(L,4);JC5:REF(C,5);JCYC:=(HIGH+LOW+OPEN+2*CLOSE)/5;明日阻力:=2*JCYC-LOW;明日支撑:=2*JCYC-HIGH;明日突破:=JCYC+(HIGH-LOW);明日反转:=JCYC-(HIGH-LOW);阻力:REF(明日阻力,1);支撑:REF(明日支撑,1);突破:REF(明日突破,1);反转:REF(明日反转,1);JM1:MA(C,5);JM2:MA(C,10);
{主图公式}INPUT: 上下调整(460,50,1000),左右调整(550,150,1000),打开关闭(3,0,3);{日K线引用}if 打开关闭>0 then beginJC:="引用日线.JC#day";JO:="引用日线.JO#day";JH:="引用日线.JH#day";JL:="引用日线.JL#day";JC1:="引用日线.JC1#day";JO1:="引用日线.JO1#day";JH1:="引用日线.JH1#day";JL1:="引用日线.JL1#day";JC2:="引用日线.JC2#day";JO2:="引用日线.JO2#day";JH2:="引用日线.JH2#day";JL2:="引用日线.JL2#day";JC3:="引用日线.JC3#day";JO3:="引用日线.JO3#day";JH3:="引用日线.JH3#day";JL3:="引用日线.JL3#day";JC4:="引用日线.JC4#day";JO4:="引用日线.JO4#day";JH4:="引用日线.JH4#day";JL4:="引用日线.JL4#day";JC5:="引用日线.JC5#day";YT1:=JC>JC1 AND JC=JO;YT2:=JCJC2 AND JC1=JO1;YT4:=JC1JC3 AND JC2=JO2;YT6:=JC2JC4 AND JC3=JO3;YT8:=JC3JC5 AND JC4=JO4;YT10:=JC40.015,JC1/JO1*2000-2000,5);JJHA1:=JH1/JC1*2000-2000;JJLA1:=JO1/JL1*2000-2000;JWA1:=JC1-JO1>0 OR YT3>0;if JWA1>0 then beginDRAWRECTREL(左右调整,上下调整-JJCA1,左右调整+17,上下调整,0),COLOR4535FF;DRAWRECTREL(左右调整+8,上下调整-JJCA1-JJHA1,左右调整+9,上下调整-JJCA1,0),COLOR5040FF;DRAWRECTREL(左右调整+8,上下调整,左右调整+9,上下调整+JJLA1,0),COLOR5040FF;end;JZST:=STRFIND(stkname,'S',1) AND JC1/JC2>=1.048;JZTB:=JC1/JC2>=1.0994 OR JZST;if JZTB>0 then beginDRAWRECTREL(左右调整+2,上下调整-JJCA1+2,左右调整+15,上下调整-2,RGB(255,255,0)),COLORYELLOW;end;{昨收阴}JJHA2:=JH1/JO1*2000-2000;JJLA2:=JC1/JL1*2000-2000;JWA2:=JO1-JC1>0 OR YT4>0;if JWA2>0 then begin DRAWRECTREL(左右调整,上下调整,左右调整+17,上下调整-JJCA1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整+8,上下调整-JJHA2,左右调整+9,上下调整-JJCA1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整+8,上下调整-JJCA1,左右调整+9,上下调整-JJCA1+JJLA2,RGB(0,255,255)),COLORFFFF00;end;JZST1:=STRFIND(stkname,'S',1) AND JC1/JC20.015,JC2/JO2*2000-2000,5);JJHB1:=JH2/JC2*2000-2000;JJLB1:=JO2/JL2*2000-2000;JZKB1:=JO1/JC2*2000-2000;QSYB1:=上下调整+JZKB1;JWB1:=(JC2-JO2>0 OR YT5>0);if JWB1>0 then begin DRAWRECTREL(左右调整-23,QSYB1+JJCB1,左右调整-6,QSYB1,0),COLOR4535FF;DRAWRECTREL(左右调整-15,QSYB1-JJHB1,左右调整-14,QSYB1,0),COLOR5040FF;DRAWRECTREL(左右调整-15,QSYB1+JJCB1+JJLB1,左右调整-14,QSYB1+JJCB1,0),COLOR5040FF;end;JZST2:=STRFIND(stkname,'S',1) AND JC2/JC3>=1.048;JZTB2:=JC2/JC3>=1.0994 OR JZST2;if JZTB2>0 then beginDRAWRECTREL(左右调整-21,QSYB1+JJCB1-2,左右调整-8,QSYB1+2,RGB(255,255,0)),COLORYELLOW;end;{前收阴}JJHB2:=JH2/JO2*2000-2000;JJLB2:=JC2/JL2*2000-2000;JWB2:=(JO2-JC2>0 OR YT6>0);if JWB2>0 then begin DRAWRECTREL(左右调整-23,QSYB1+JJCB1,左右调整-6,QSYB1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整-15,QSYB1+JJCB1-JJHB2,左右调整-14,QSYB1+JJCB1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整-15,QSYB1,左右调整-14,QSYB1+JJLB2,RGB(0,255,255)),COLORFFFF00;end;JZST3:=STRFIND(stkname,'S',1) AND JC2/JC30.015,JC3/JO3*2000-2000,5);JJHD1:=JH3/JC3*2000-2000;JJLD1:=JO3/JL3*2000-2000;JZKD1:=JO2/JC3*2000-2000;QSYD1:=QSYB1+JJCB1+JZKD1;JWD1:=(JC3-JO3>0 OR YT7>0);if JWD1>0 then begin DRAWRECTREL(左右调整-46,QSYD1+JJCD1,左右调整-29,QSYD1,0),COLOR4535FF;DRAWRECTREL(左右调整-38,QSYD1-JJHD1,左右调整-37,QSYD1,0),COLOR5040FF;DRAWRECTREL(左右调整-38,QSYD1+JJCD1+JJLD1,左右调整-37,QSYD1+JJCD1,0),COLOR5040FF;end;{S前收阴}JJHD2:=JH3/JO3*2000-2000;JJLD2:=JC3/JL3*2000-2000;JWD2:=(JO3-JC3>0 OR YT8>0);if JWD2>0 then begin DRAWRECTREL(左右调整-46,QSYD1+JJCD1,左右调整-29,QSYD1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整-38,QSYD1+JJCD1-JJHD2,左右调整-37,QSYD1+JJCD1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整-38,QSYD1,左右调整-37,QSYD1+JJLD2,RGB(0,255,255)),COLORFFFF00;end;{SS前收阳}JJCE1:=IF(ABS(JC4-JO4)>0.015,JC4/JO4*2000-2000,5);JJHE1:=JH4/JC4*2000-2000;JJLE1:=JO4/JL4*2000-2000;JZKE1:=JO3/JC4*2000-2000;QSYE1:=QSYD1+JJCD1+JZKE1;JWE1:=(JC4-JO4>0 OR YT9>0);if JWE1>0 then begin DRAWRECTREL(左右调整-69,QSYE1+JJCE1,左右调整-52,QSYE1,0),COLOR4535FF;DRAWRECTREL(左右调整-61,QSYE1-JJHE1,左右调整-60,QSYE1,0),COLOR5040FF;DRAWRECTREL(左右调整-61,QSYE1+JJCE1+JJLE1,左右调整-60,QSYE1+JJCE1,0),COLOR5040FF;end;{SS前收阴}JJHE2:=JH4/JO4*2000-2000;JJLE2:=JC4/JL4*2000-2000;JWE2:=(JO4-JC4>0 OR YT10>0);if JWE2>0 then begin DRAWRECTREL(左右调整-69,QSYE1+JJCE1,左右调整-52,QSYE1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整-61,QSYE1+JJCE1-JJHE2,左右调整-60,QSYE1+JJCE1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整-61,QSYE1,左右调整-60,QSYE1+JJLE2,RGB(0,255,255)),COLORFFFF00;end;{今收阳}JJCC1:=IF(ABS(JC-JO)>0.015,JC/JO*2000-2000,5);JJHC1:=JH/JC*2000-2000;JJLC1:=JO/JL*2000-2000;JZKC1:=JO/JC1*2000-2000;QSYC1:=上下调整-JJCA1-JZKC1;JWC1:=(JC-JO>0 OR YT1>0);if JWC1>0 then begin DRAWRECTREL(左右调整+23,QSYC1-JJCC1,左右调整+40,QSYC1,0),COLOR4535FF;DRAWRECTREL(左右调整+31,QSYC1-JJCC1-JJHC1,左右调整+32,QSYC1-JJCC1,0),COLOR5040FF;DRAWRECTREL(左右调整+31,QSYC1,左右调整+32,QSYC1+JJLC1,0),COLOR5040FF;end;JZST4:=STRFIND(stkname,'S',1) AND JC/JC1>=1.048;JZTB4:=JC/JC1>=1.0994 OR JZST4;if JZTB4>0 then beginDRAWRECTREL(左右调整+25,QSYC1-JJCC1+2,左右调整+38,QSYC1-2,RGB(255,255,0)),COLORYELLOW;end;{今收阴}JJHC2:=JH/JO*2000-2000;JJLC2:=JC/JL*2000-2000;JWC2:=(JO-JC>0 OR YT2>0);if JWC2>0 then begin DRAWRECTREL(左右调整+23,QSYC1,左右调整+40,QSYC1-JJCC1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整+31,QSYC1-JJHC2,左右调整+32,QSYC1,RGB(0,255,255)),COLORFFFF00;DRAWRECTREL(左右调整+31,QSYC1-JJCC1,左右调整+32,QSYC1-JJCC1+JJLC2,RGB(0,255,255)),COLORFFFF00;end;JZST5:=STRFIND(stkname,'S',1) AND JC/JC12 then begin阻力:="引用日线.阻力#day";支撑:="引用日线.支撑#day";突破:="引用日线.突破#day";反转:="引用日线.反转#day";JZLC1:=阻力/JO*2000-2000;JZZC1:=支撑/JO*2000-2000;JTPC1:=突破/JO*2000-2000;JFZC1:=反转/JO*2000-2000;DRAWTEXTREL(左右调整+38,QSYC1-JZLC1,'ˉˉˉ'),Colorffa800;DRAWTEXTREL(左右调整+60,QSYC1-JZLC1,'阻力 '+NUMTOSTRN(阻力,2)),Colorffa800;DRAWTEXTREL(左右调整+38,QSYC1-JZZC1,'ˉˉˉ'),Colorffa800;DRAWTEXTREL(左右调整+60,QSYC1-JZZC1,'支撑 '+NUMTOSTRN(支撑,2)),Colorffa800;DRAWTEXTREL(左右调整+38,QSYC1-JTPC1,'ˉˉˉ'),Colorffa800;DRAWTEXTREL(左右调整+60,QSYC1-JTPC1,'突破 '+NUMTOSTRN(突破,2)),Colorffa800;DRAWTEXTREL(左右调整+38,QSYC1-JFZC1,'ˉˉˉ'),Colorffa800;DRAWTEXTREL(左右调整+60,QSYC1-JFZC1,'反转 '+NUMTOSTRN(反转,2)),Colorffa800;end;if 打开关闭>1 then beginJM1:="引用日线.JM1#day";JM2:="引用日线.JM2#day";JMAC1:=JM1/JO*2000-2000;JMAC2:=JM2/JO*2000-2000;DRAWTEXTREL(左右调整+20,QSYC1-JMAC1,'ˉˉˉˉˉˉˉ'),ColorFFFFFF;DRAWTEXTREL(左右调整+120,QSYC1-JMAC1,'MA5 '+NUMTOSTRN(JM1,2)),ColorFFFFFF;DRAWTEXTREL(左右调整+20,QSYC1-JMAC2,'ˉˉˉˉˉˉˉˉˉˉ'),COLORYELLOW;DRAWTEXTREL(左右调整+140,QSYC1-JMAC2,'MA10 '+NUMTOSTRN(JM2,2)),COLORYELLOW;end;end;
好股网(www.goodgupiao.com)提醒您:股市有风险,投资需谨慎。