通達信做自定義柱狀板塊(源碼)

把壓縮文件里的自定義板塊添加到工具——用戶板塊設置里——選導入,一個一個導入進去。功能——定製品種——組合品種管理——這裡面創建自定義指數,也就是把代碼和自定義板塊對應起來。需要添加的自建板塊對應指數代碼按下圖添加。393001 中盤股393002 小盤股393003 大盤股393004 生物醫藥393005太陽能393006手機支付393007三網合一393008風能393011信息網路393013新能源汽車393014智能電網393015核能柱狀板塊源碼VAR1:=MEMA(("399005$C"),3);VAR2:=MEMA(("399001$C"),3);VAR3:=MEMA(("999999$C"),3);VAR4:=MEMA(("393002$C"),3);VAR5:=MEMA(("393001$C"),3);VAR6:=MEMA(("393003$C"),3);VAR7:=MEMA(("393004$C"),3);VAR8:=MEMA(("393005$C"),3);VAR9:=MEMA(("393006$C"),3);VAR10:=MEMA(("393007$C"),3);VAR11:=MEMA(("393008$C"),3);VAR12:=MEMA(("393011$C"),3);VAR13:=MEMA(("393015$C"),3);VAR14:=MEMA(("393013$C"),3);VAR15:=MEMA(("393014$C"),3);中小板指:=SUM((VAR1/REF(VAR1,1)-1)*100,0),COLORRED;深圳成指:=SUM((VAR2/REF(VAR2,1)-1)*100,0),COLORMAGENTA;上證指數:=SUM((VAR3/REF(VAR3,1)-1)*100,0),COLORLIRED;小盤股:=SUM((VAR4/REF(VAR4,1)-1)*100,0),COLORLIMAGENTA;中盤股:=SUM((VAR5/REF(VAR5,1)-1)*100,0),COLORCYAN;大盤股:=SUM((VAR6/REF(VAR6,1)-1)*100,0),COLORGREEN;生物醫藥:=SUM((VAR7/REF(VAR7,1)-1)*100,0),COLORRED;太陽能:=SUM((VAR8/REF(VAR8,1)-1)*100,0),COLORMAGENTA;手機支付:=SUM((VAR9/REF(VAR9,1)-1)*100,0),COLORLIRED;三網合一:=SUM((VAR10/REF(VAR10,1)-1)*100,0),COLORWHITE;風能:=SUM((VAR11/REF(VAR11,1)-1)*100,0),COLORCYAN;信息網路:=SUM((VAR12/REF(VAR12,1)-1)*100,0),COLORGREEN;核能:=SUM((VAR13/REF(VAR13,1)-1)*100,0),COLORYELLOW;新能源汽車:=SUM((VAR14/REF(VAR14,1)-1)*100,0),COLORCYAN;智能電網:=SUM((VAR15/REF(VAR15,1)-1)*100,0),COLORGREEN;VAR16:=CONST(MA(中小板指,10));VAR17:=CONST(MA(深圳成指,10));VAR18:=CONST(MA(上證指數,10));VAR19:=CONST(MA(小盤股,10));VAR20:=CONST(MA(中盤股,10));VAR21:=CONST(MA(大盤股,10));VAR22:=CONST(MA(生物醫藥,10));VAR23:=CONST(MA(太陽能,10));VAR24:=CONST(MA(手機支付,10));VAR25:=CONST(MA(三網合一,10));VAR26:=CONST(MA(風能,10));VAR27:=CONST(MA(信息網路,10));VAR28:=CONST(MA(核能,10));VAR29:=CONST(MA(新能源汽車,10));VAR30:=CONST(MA(智能電網,10));PQ:=VAR30-40;P1:=IF(BARSLAST(CURRBARSCOUNT=8),10,0);P2:=IF(BARSLAST(CURRBARSCOUNT=16),10,0);P3:=IF(BARSLAST(CURRBARSCOUNT=24),10,0);P4:=IF(BARSLAST(CURRBARSCOUNT=32),10,0);P5:=IF(BARSLAST(CURRBARSCOUNT=40),10,0);P6:=IF(BARSLAST(CURRBARSCOUNT=48),10,0);P7:=IF(BARSLAST(CURRBARSCOUNT=54),10,0);P8:=IF(BARSLAST(CURRBARSCOUNT=62),10,0);P9:=IF(BARSLAST(CURRBARSCOUNT=70),10,0);P10:=IF(BARSLAST(CURRBARSCOUNT=78),10,0);P11:=IF(BARSLAST(CURRBARSCOUNT=86),10,0);P12:=IF(BARSLAST(CURRBARSCOUNT=94),10,0);P13:=IF(BARSLAST(CURRBARSCOUNT=102),10,0);P14:=IF(BARSLAST(CURRBARSCOUNT=110),10,0);P15:=IF(BARSLAST(CURRBARSCOUNT=118),10,0);P16:=IF(BARSLAST(CURRBARSCOUNT=126),10,0);STICKLINE(中小板指,PQ,IF(P2-P1,CONST(MA(中小板指,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(深圳成指,PQ,IF(P3-P2,CONST(MA(深圳成指,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(上證指數,PQ,IF(P4-P3,CONST(MA(上證指數,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(小盤股,PQ,IF(P5-P4,CONST(MA(小盤股,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(中盤股,PQ,IF(P6-P5,CONST(MA(中盤股,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(大盤股,PQ,IF(P7-P6,-CONST(MA(大盤股,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(生物醫藥,PQ,IF(P8-P7,CONST(MA(生物醫藥,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(太陽能,PQ,IF(P9-P8,CONST(MA(太陽能,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(手機支付,PQ,IF(P10-P9,CONST(MA(手機支付,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(三網合一,PQ,IF(P11-P10,CONST(MA(三網合一,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(風能,PQ,IF(P12-P11,CONST(MA(風能,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(信息網路,PQ,IF(P13-P12,CONST(MA(信息網路,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(核能,PQ,IF(P14-P13,CONST(MA(核能,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(新能源汽車,PQ,IF(P15-P14,CONST(MA(新能源汽車,3)),DRAWNULL),5,0),COLORYELLOW;STICKLINE(智能電網,PQ,IF(P16-P15,CONST(MA(智能電網,3)),DRAWNULL),5,0),COLORYELLOW;DRAWTEXT((P2>=10 AND REF(P2,1)<=0),中小板指,"中小板指"),COLORRED;DRAWTEXT((P3>=10 AND REF(P3,1)<=0),深圳成指,"深圳成指"),COLORMAGENTA;DRAWTEXT((P4>=10 AND REF(P4,1)<=0),上證指數,"上證指數"),COLORLIRED;DRAWTEXT((P5>=10 AND REF(P5,1)<=0),小盤股,"小盤股"),COLORWHITE;DRAWTEXT((P6>=10 AND REF(P6,1)<=0),中盤股,"中盤股"),COLORCYAN;DRAWTEXT((P7>=10 AND REF(P7,1)<=0),大盤股,"大盤股"),COLORGREEN;DRAWTEXT((P8>=10 AND REF(P8,1)<=0),生物醫藥,"生物醫藥"),COLORRED;DRAWTEXT((P9>=10 AND REF(P9,1)<=0),太陽能,"太陽能"),COLORMAGENTA;DRAWTEXT((P10>=10 AND REF(P10,1)<=0),手機支付,"手機支付"),COLORLIRED;DRAWTEXT((P11>=10 AND REF(P11,1)<=0),三網合一,"三網合一"),COLORWHITE;DRAWTEXT((P12>=10 AND REF(P12,1)<=0),風能,"風能"),COLORCYAN;DRAWTEXT((P13>=10 AND REF(P13,1)<=0),信息網路,"信息網路"),COLORGREEN;DRAWTEXT((P14>=10 AND REF(P14,1)<=0),核能,"核能"),COLORWHITE;DRAWTEXT((P15>=10 AND REF(P15,1)<=0),新能源汽車,"新能源汽車"),COLORCYAN;DRAWTEXT((P16>=10 AND REF(P16,1)<=0),智能電網,"智能電網"),COLORGREEN;

 


推薦閱讀:

C#編寫自定義控制項
[譯文]Vue: 強大的自定義指令
VBA讀取、增加自定義和修改文檔屬性
css之自定義列表符號

TAG:定義 | 源碼 | 自定義 |