主成交量(均量、交易量)-指标公式源码
{M1,5,1,10,1;
M2,10,5,30,1;
M3,20,10,60,1;}
{VOL,VOLSTICK;}
M1:=5;
M2:=10;
M3:=20;
成交量:VOL,LINETHICK0;
五日均量:MA(VOL,M1);
十日均量:MA(VOL,M2);
廿日均量:MA(VOL,M3);
预估今日成交量:IF((DYNAINFO(7)=CLOSE), DYNAINFO(38)*DYNAINFO(17),成交量),Color0000FF,LINETHICK0;
{如果最新价=收盘价,选五日均量*量比,否则就选成交量}
FILLRGN(五日均量,十日均量,五日均量>=十日均量,RGB(255,0,0),五日均量<=十日均量,RGB(0,255,0));
{当五日均量>=十日均量时为红色飘带,反之为绿色飘带}
AAA:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));{系数=成交量/((最高价-最低价)*2-绝对值(收盘价-开盘价))}
主买:=IF(CLOSE>OPEN,AAA*(HIGH-LOW),IF(CLOSE<OPEN,AAA*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2));
主卖:=-IF(CLOSE>OPEN,0-AAA*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-AAA*(HIGH-LOW),0-成交量/2));
STICKLINE(主买>=主卖,成交量,0,7.5,0),Color0E96A9;{黄s柱表示主力的净买量}
STICKLINE(主买>=主卖,成交量,0,7,0),Color10A7BC;{黄s框2}
STICKLINE(主买>=主卖,成交量,0,6,0),Color11B5CC;{黄s框3}
STICKLINE(主买>=主卖,成交量,0,5,0),Color13C6DF;{黄s框4}
STICKLINE(主买>=主卖,成交量,0,4,0),Color1CD2EC;{黄s框5}
STICKLINE(主买>=主卖,成交量,0,2,0),Color39D8EE;{黄s框6}
STICKLINE(主买>=主卖,成交量,0,0.5,0),ColorFFFFFF;{黄s框7}
STICKLINE(主买<主卖,成交量,0,7.5,0),ColorCA6500;{蓝色柱主力的净卖量}
STICKLINE(主买<主卖,成交量,0,7,0),ColorE17100;{蓝色框2}
STICKLINE(主买<主卖,成交量,0,6,0),ColorF27900;{蓝色框3}
STICKLINE(主买<主卖,成交量,0,5,0),ColorFF850B;{蓝色框4}
STICKLINE(主买<主卖,成交量,0,4,0),ColorFF9326;{蓝色框5}
STICKLINE(主买<主卖,成交量,0,2,0),ColorFFA042;{蓝色框6}
STICKLINE(主买<主卖,成交量,0,0.5,0),colorFFFF00;{蓝色框7}
STICKLINE(1>0,0,主买,7.5,0),ColorA200A2;{玫红柱1}
STICKLINE(1>0,0,主买,7,0),ColorB700B7;{玫红柱2}
STICKLINE(1>0,0,主买,6,0),ColorCE00CE;{玫红柱3}
STICKLINE(1>0,0,主买,5,0),ColorE800E8;{玫红柱4}
STICKLINE(1>0,0,主买,4,0),ColorFF00FF;{玫红柱5}
STICKLINE(1>0,0,主买,2,0),ColorFF60FF;{玫红柱6}
STICKLINE(1>0,0,主买,0.5,0),ColorFFD2FF;{玫红柱7}
BBB:=LONGCROSS(成交量,五日均量,4);{全红柱表示今天的成交量超过五日均量}
STICKLINE(BBB,0,成交量,7.5,0),color070084;{全红柱1}
STICKLINE(BBB,0,成交量,7,0),color0000A3;{全红柱2}
STICKLINE(BBB,0,成交量,6,0),color0000B7;{全红柱3}
STICKLINE(BBB,0,成交量,5,0),color0000CD;{全红柱4}
STICKLINE(BBB,0,成交量,4,0),color0000E9;{全红柱5}
STICKLINE(BBB,0,成交量,2,0),color0754E9;{全红柱6}
STICKLINE(BBB,0,成交量,0.5,0),Color68B8FF;{全红柱7}
DL:=FILTER(成交量=LLV(成交量,20),5);{全绿柱表示今天是最近5天的成交量中是20日均量的最低量}
STICKLINE(DL,0,成交量,7.5,0),Color006400;{全绿柱1}
STICKLINE(DL,0,成交量,7,0),Color007500;{全绿柱2}
STICKLINE(DL,0,成交量,6,0),Color008400;{全绿柱3}
STICKLINE(DL,0,成交量,5,0),Color009900;{全绿柱4}
STICKLINE(DL,0,成交量,4,0),Color00AE00;{全绿柱5}
STICKLINE(DL,0,成交量,2,0),Color00BD00;{全绿柱6}
STICKLINE(DL,0,成交量,0.5,0),Color8EFF8E;{全绿柱7}
DRAWTEXTREL(0,0,'成交量'),COLORYELLOW;
{DRAWTEXTREL(600,900,'证券代码: '+STKLABEL+' 证券名称: '+STKNAME+''),ColorFFAA00;}
DRAWTEXTABS(35,0,'《若水》'),COLOR0000FF;
{预计今天成交量}
今天成交额:=AMOUNT/10000;
昨天成交额:=REF(今天成交额,1);
交易分钟数:=if(CURRENTTIME>93000 and CURRENTTIME<150000 and DYNAINFO(7)=CLOSE AND DYNAINFO(10)=AMOUNT,
if(CURRENTTIME<113000,(TIMETOT0(CURRENTTIME)-34200)/60,
if(CURRENTTIME>130000,(TIMETOT0(CURRENTTIME)-39600)/60,120)),240);
预测今天:=今天成交额/交易分钟数*240;
交易分时:=FRACPART( 交易分钟数/60);
剩余分时:=交易分时*60;
剩余秒:=FRACPART( 剩余分时);
剩余秒时:=剩余秒*60;
交易小时:=交易分钟数/60 ;
{显示文字}
DRAWTEXTABS(125,0,'昨天金額:'+NUMTOSTRN(昨天成交额/10000,2)+'亿'),ColorF5FF00,LINETHICK1;
DRAWTEXTABS(125,13,'预计今天:'+NUMTOSTRN(预测今天/10000,2)+'亿'),COLOR00FFFF,LINETHICK1;
DRAWTEXTABS(450,2,'交易时间:'+INTPART(交易小时)+'小时'+NUMTOSTRN(剩余分时,0)+'分'+NUMTOSTRN(剩余秒时,0)+'秒'+' 已成交金額'+':'+NUMTOSTRN(今天成交额/10000,2)+'亿元'),ColorF5FF00,LINETHICK2,PRECIS2;
{柱图}
图长度像素:=230*0.5;
昨天图长度:=230+图长度像素;
预测今天图:=(预测今天/昨天成交额)*图长度像素+230;
目前成交图:=(今天成交额/昨天成交额)*图长度像素+230;
DRAWRECTABS(230,1,昨天图长度,9 ,RGB(0,255,150));
DRAWRECTABS(230,13,目前成交图, 23 ,RGB(255,73,20));
DRAWRECTABS(230,16,预测今天图,20 ,RGB(255,255,0));
{立柱说明}
DRAWRECTREL( 0,140,115,860,RGB(20,20,20));
DRAWRECTREL( 0,140,15,280,RGB(255,255,0));
DRAWTEXTREL(20,140,'主力的净买量'),COLORYELLOW;
DRAWRECTREL( 0,280,15,420,RGB(0,255,255));
DRAWTEXTREL(20,280,'主力的净卖量'),COLORFFFF00;
DRAWRECTREL( 0,420,15,560,RGB(255,25,0));
DRAWTEXTREL(20,420,'超过五日均量'),COLOR0025FF;
DRAWRECTREL( 0,560,15,700,RGB(0,255,0));
DRAWTEXTREL(20,560,'低于廿日均量'),COLOR00FF00;
DRAWRECTREL( 0,700,15,840,RGB(200,0,200));
DRAWTEXTREL(20,700,'主力外成交量'),COLORFF00FF; |