最近迷上了飞狐,用心在学习,组合了一些自己认为好的源码,有顶底提示,主力建仓出货,估算成本,仓位等,并美化了3D柱线,源码来于,回报于,感觉好的,加点分哟,最近学飞狐函数,用了太多的下载币,谢谢大家,指标为参考,决策靠人脑,祝各位投资顺利。
DRAWGBK(1,COLORRGB(20,50,50),COLORRGB(30,30,140),1);
NDDX:=10;金額:amount/100000000,linethick0;
JJDDX:=(HIGH+LOW+CLOSE)/3;
QJ0DDX:=VOL/IF(HIGH=LOW,4,HIGH-LOW);
QJ1DDX:=IF(CAPITAL=0,QJ0DDX*(JJDDX-MIN(CLOSE,OPEN)),QJ0DDX*IF(HIGH=LOW,1,(MIN(OPEN,CLOSE)-LOW)));
QJ2DDX:=IF(CAPITAL=0,QJ0DDX*(MIN(OPEN,CLOSE)-LOW),QJ0DDX*IF(HIGH=LOW,1,(JJDDX-MIN(CLOSE,OPEN))));
QJ3DDX:=IF(CAPITAL=0,QJ0DDX*(HIGH-MAX(OPEN,CLOSE)),QJ0DDX*IF(HIGH=LOW,1,(HIGH-MAX(OPEN,CLOSE))));
QJ4DDX:=IF(CAPITAL=0,QJ0DDX*(MAX(CLOSE,OPEN)-JJDDX),QJ0DDX*IF(HIGH=LOW,1,(MAX(CLOSE,OPEN)-JJDDX)));
大单: ((QJ1DDX+QJ2DDX)-(QJ3DDX+QJ4DDX))/IF(CAPITAL=0,1000000,10000),COLORRED;
交易分钟数:=if(CURRENTTIME>93000 and CURRENTTIME<150000,
if(CURRENTTIME<113000,(TIMETOT0(CURRENTTIME)-34200)/60,
if(CURRENTTIME>130000,(TIMETOT0(CURRENTTIME)-39600)/60,120)),240);
日期差:=DATEDIFF(DATE,CURRENTDATE);
预量:IF(BARSTATUS=2 and 日期差=0,VOL/交易分钟数*240,VOL),COLOR00FFFF,LINETHICK0;
{预测量2:IF(BARSTATUS=2,VOL*240/OPENMINUTES(CURRENTTIME),VOL),COLOR00FF00,LINETHICK0;}
STICKLINE(BARSTATUS=2,vol,预量,8,0),COLOR00FFFF,LINEDOT;
JJ:=(HIGH+LOW+CLOSE)/3;
QJ9:=AMOUNT/IF(HIGH=LOW,4,HIGH-LOW);
TD1:=QJ9*(MIN(OPEN,CLOSE)-LOW);
XD1:=QJ9*(JJ-MIN(CLOSE,OPEN));
XD2:=QJ9*(HIGH-MAX(OPEN,CLOSE));
TD2:=QJ9*(MAX(CLOSE,OPEN)-JJ);
日净:((TD1+XD1)-(TD2+XD2))/10000,LINETHICK0;
量_价:=1;CTKG:=1;
W:=量_价;
EPSL:=0.0001;
ZZ:=(C+H+L)/3;
TJA:=ZZ>=MAX(C,O) AND CTKG=1;{倒锤头};
TJB:=ZZ<=MIN(C,O) AND CTKG=1;{正锤头};
Z,:=IF(TJA,1,IF(TJB,-1,0));{正负数};
TJ0:=TJA OR TJB;
TJ1:=H=L AND C>REF(C,1);{一字涨停};
TJ2:=H=L AND C<REF(C,1);{一字跌停};
TJ3:=H=L AND C=REF(C,1);{连续一字涨、跌停};
量_价:=IF(W=1,VOL,AMOUNT),STICK,COLOREEFFEE;{平盘量,白色}
EE:=IF(TJ1,EPSL,IF(TJ2,-EPSL,0));
ZL:=2*(H-L)+ABS(C-O)+3*IF(TJ3,EPSL,ABS(EE));
JGL_DX:=(IF(TJ0,2/3*(2*C-H-L)+Z,*ABS(C-O),(C-O))+EE)/ZL;
差:(JGL_DX*量_价)/20000,COLOR13AADD,LINETHICK0;
DX:=JGL_DX*100,LINETHICK0;
买:量_价*(1+JGL_DX)/20000,COLOR1133AA,LINETHICK0;
卖:量_价*(1-JGL_DX)/20000,COLORFFFF00,LINETHICK0;
量差:买-卖,LINETHICK0,COLORYELLOW;
VAR2:=HIGH-LOW;
VAR3:=ABS(OPEN-CLOSE);
VAR4:=HIGH-(IF(CLOSE>OPEN,CLOSE,OPEN));
VAR5:=(IF(CLOSE>OPEN,OPEN,CLOSE))-LOW;
VAR6:=VAR3/VAR2*VOL;
VAR7:=VAR4/VAR2*VOL;
VAR8:=VAR5/VAR2*VOL;
VAR9:=IF(VOL/CAPITAL>0.001,1,EXP(ABS(LOG(VOL/CAPITAL*100))));
VARA:=(CLOSE-MA(CLOSE,5))/MA(CLOSE,5)*100;
VARB:=MA(CLOSE,5)>MA(CLOSE,10) AND MA(CLOSE,10)>MA(CLOSE,30) AND MA(CLOSE,30)>MA(CLOSE,60);
VARC:=MA(CLOSE,5)<MA(CLOSE,10) AND MA(CLOSE,10)<MA(CLOSE,30);
{红柱}
STICKLINE(量差>0,0,v,8,0) ,COLORFF00FF;
STICKLINE(量差>0,0,v,7,0) ,COLORFF22FF;
STICKLINE(量差>0,0,v,6,0) ,COLORFF44FF;
STICKLINE(量差>0,0,v,5,0) ,COLORFF66FF;
STICKLINE(量差>0,0,v,4,0) ,COLORFF88FF;
STICKLINE(量差>0,0,v,3,0) ,COLORFF99FF;
STICKLINE(量差>0,0,v,2,0) ,COLORFFAAFF;
STICKLINE(量差>0,0,v,1,0) ,COLORFFBBFF;
STICKLINE(0>=量差 ,0 ,v,8,0 ),COLOR008800;
STICKLINE(0>=量差 ,0 ,v,7,0 ),COLOR009900;
STICKLINE(0>=量差 ,0 ,v,6,0 ),COLOR00AA00;
STICKLINE(0>=量差 ,0 ,v,5,0 ),COLOR00BB00;
STICKLINE(0>=量差 ,0 ,v,4,0 ),COLOR00CC00;
STICKLINE(0>=量差 ,0 ,v,3,0 ),COLOR00DD00;
STICKLINE(0>=量差 ,0 ,v,2,0 ),COLOR00EE00;
STICKLINE(0>=量差 ,0 ,v,1,0 ),COLOR00FF00;
STICKLINE(VOL>MA(VOL,5)*2.5,0,VOL,0.2,0),colorFFFFFF;
DRAWTEXT(VAR9>2 AND VOL<MA(VOL,5)/2,VOL+10000,'地量'),colorFFFF;
DRAWTEXT(VAR7>VAR6 AND VARA>2 AND VAR7>VAR8 AND CLOSE>MA(CLOSE,5) AND CLOSE>MA(CLOSE,30) AND HIGH>MA(CLOSE,60) AND VOL>MA(VOL,5) AND VAR7>=MA(VOL,5),VOL,'逢高出货'),colorFF00;
DRAWTEXT(VAR8>VAR6 AND VAR8>VAR7 AND VARA<-2 AND CLOSE<MA(CLOSE,30) AND VAR8<MA(VOL,5)/2 AND MA(VOL,5)<MA(VOL,10),VOL+15000,'逢低跟进'),colorFF00FF;
DRAWTEXT(VAR6>MA(VOL,5)*2 AND VAR6>=VAR7 AND VAR6>=VAR8 AND CLOSE>OPEN OR VOL>MA(VOL,5)*3 AND VARB,VOL,'强势参与'),colorCC99CC;
DRAWTEXT(VAR6>=VAR7 AND VAR6>=VAR8 AND CLOSE<OPEN AND VAR6/VOL>0.7 AND VARC AND VAR6>MA(VOL,5),v+15000,'空头释放'),colorFF00;
BB:=VOL/((HIGH-LOW)*2-ABS(CLOSE-OPEN));
主动买:=IF(CLOSE>OPEN,BB*(HIGH-LOW),IF(CLOSE<OPEN,BB*((HIGH-OPEN)+(CLOSE-LOW)),VOL/2));
主买:主动买/10000,COLORRED,LINETHICK0;
主动卖:=IF(CLOSE>OPEN,0-BB*((HIGH-CLOSE)+(OPEN-LOW)),IF(CLOSE<OPEN,0-BB*(HIGH-LOW),0-VOL/2));
主卖:-主动卖/10000,COLORFFCC00,LINETHICK0;
差额:主买-主卖,COLORGREEN,LINETHICK0;
MA5:MA(VOL,5),colorFF;
MA10:MA(VOL,10),colorFF00;
MA60:MA(VOL,60),colorFFFF;
F:=100*(CLOSE-REF(CLOSE,1))/REF(CLOSE,1);
今小昨:=IF(CLOSE<REF(OPEN,1) AND F<0,1,0);
Sa1:=今小昨;
今小前:=IF(CLOSE<REF(OPEN,2) AND F<0,1,0),LINETHICK0;
Sa2:=今小前;
svol:=INTPART(SUM(VOL,0)/CAPITAL);
tj0:=svol>REF(svol,1) or BARSSINCE(CLOSE)=0;
S1:=BARSLAST(tj0)+1,PRECISION,COLORWHITE;//时间1
tj2:=S1<REF(S1,1);//取点
S2:=IF(tj2,REF(S1,1)+1,S1),PRECISION,COLORMAGENTA;//时间2
S3:=SUM(tj2,0),COLORMAGENTA;
阶段总额(万元):=SUM(AMOUNT/10000,S2)*100,PRECISION,LINETHICK,Color008BFA;//换手99.99%AMOUNT
阶段总量(手):=SUM(VOL,S2)*100,PRECISION,LINETHICK,COLORCYAN;//换手99.99%VOL
阶段成本(元):=(阶段总额(万元)/(阶段总量(手)/100)),LINETHICK,PRECISION2,COLORRED;
A:=SUMBARS(V ,CAPITAL*1);{累计换手=99.99%的周期}
A2:=ma(COST(20),A);{在A周期里获利20%的平均价}
A1:=ma(COST(10),A);{在A周期里获利10%的平均价}
A3:=ma(COST(30),A);{在A周期里获利30%的平均价}
A4:=ma(COST(40),A);{在A周期里获利40%的平均价}
A5:=ma(COST(50),A);{在A周期里获利50%的平均价}
E:=LLV(L,250)=L;{一年中最低价的位置}
E1:=BARSLAST(E);{求得一年中最低价的位置到现在的周期}
主力成本:=(5*A1+4*A2+3*A3+2*A4+A5)/15, COLORRED,linethick0;
DRAWTEXT(BARPOS=SYSPARAM(2),HIGH,'■阶段平均成本:'+NUMTOSTR(阶段成本(元)[SYSPARAM(1)],2)+'(元)'),align4,ColorFFE0FF,pxdn30,shift;
{取点}
Zk1:=STKINDI('' ,'kdj.k',0,7);
Zd2:=STKINDI('' ,'kdj.d',0,7);
Z,1:=STKINDI('' ,'macd.diff',0,7);
ZA2:=STKINDI('' ,'macd.dea',0,7);
{建仓统计}
JCD:=FILTER(CROSS(Zk1,Zd2) and Zd2<30,13);{周KD金叉位置}
取点:=BARSLAST(JCD);
吸筹区:=IF(取点>0 and 取点<61,取点,0);
换手率:=VOL/CAPITAL*100,ColorD19857;
ZS1:= 吸筹区;
ZS2:= 吸筹区+1;
ZS3:= 换手率/5;{庄家筹码估算}
ZSA:=IF(ZS1>0,SUM((ZS3),吸筹区+1),0);{统计庄家筹码}
{控制画线高度}
n1:=SYSPARAM(3);
nn:=n1-SYSPARAM(2)+1;
hh:=HHV(VOL,nn);
ll:=LLV(VOL,nn);
最高:=hh[n1];
最低:=ll[n1];
中:=最低+(最高-最低)*0.5;
PARTLINE(RANGE(BARPOS,SYSPARAM(2),SYSPARAM(1)+1)&&ZS1>0,中),COLORCYAN;//建仓横线
VERTLINE(JCD),LINEDOT,COLORGREEN;//建仓点竖线
{可移动变化数字}
DRAWTEXT(BARSCOUNT(CLOSE)=SYSPARAM(1)&&SYSPARAM(1)>ZS1,中*2.2,' ■主力建仓天数:'+NUMTOSTR(ZS1[SYSPARAM(1)],0)+'(天)'),PXDN1,align2,COLORYELLOW;
DRAWTEXT(BARSCOUNT(CLOSE)=SYSPARAM(1)&&SYSPARAM(1)>ZS1,中*2.2,' \n■估算主力筹码:'+NUMTOSTR(ZSA[SYSPARAM(1)],2)+'%'),PXDN10,align2,COLORMAGENTA;
dRAWTEXT(BARSCOUNT(CLOSE)=SYSPARAM(1)&a |