当前位置:→ 公式网 > 飞狐公式 > 正文 ℃ 公式解密、改选股等业务 联系点击查看详情...
以下是飞狐个股叠加大盘K线公式源码(无源码的请下载附件导入)
飞狐个股叠加大盘K线公式源码
{大盘个股K线-飞狐版-理想论坛-超级实力}
{用法:请在A股下使用,指数和其它品种不显示数据。中小、创业、沪、深大盘分显,采取飞狐的源码取3组可调均线可调显示根数(N),默认N为0不显示可调均线}
{--【移动光标时】采用光标处到画面最后周期作为大盘个股叠加周期,否则参数P大于零时采用P的周期作为大盘个股叠加周期,P等于零时采用个股全部上市日期作为叠加周期}
INPUT:P1(5,0,300),P2(10,0,300),P3(60,0,300),N(0,0,3),P(0,0,99999);
创业板:=INBLOCK('深圳创业');
中小企业:=INBLOCK('中小企业');
上证A股:=INBLOCK('上海A股');
深证A股:=INBLOCK('深圳A股');
上海基金:=INBLOCK('上海基金');
深圳基金:=INBLOCK('深圳基金');
开A:=IF(上海基金=1,"SH000011$OPEN",IF(深圳基金=1,"399305$OPEN",IF(中小企业=1,"399101$OPEN",IF(创业板=1,"399102$OPEN",IF(上证A股=1,"SH000001$OPEN",IF(深证A股=1,"399001$OPEN",0)))))),LINETHICK;
高A:=IF(上海基金=1,"SH000011$HIGH",IF(深圳基金=1,"399305$HIGH",IF(中小企业=1,"399101$HIGH",IF(创业板=1,"399102$HIGH",IF(上证A股=1,"SH000001$HIGH",IF(深证A股=1,"399001$HIGH",0)))))),LINETHICK;
低A:=IF(上海基金=1,"SH000011$LOW",IF(深圳基金=1,"399305$LOW",IF(中小企业=1,"399101$LOW",IF(创业板=1,"399102$LOW",IF(上证A股=1,"SH000001$LOW",IF(深证A股=1,"399001$LOW",0)))))),LINETHICK;
收A:=IF(上海基金=1,"SH000011$CLOSE",IF(深圳基金=1,"399305$CLOSE",IF(中小企业=1,"399101$CLOSE",IF(创业板=1,"399102$CLOSE",IF(上证A股=1,"SH000001$CLOSE",IF(深证A股=1,"399001$CLOSE",0)))))),LINETHICK;
DZHZQ:=SYSPARAM(3)-BARPOS+1; ZHZQ:=SYSPARAM(3),LINETHICK; GBNZQ:=SYSPARAM(3)-SYSPARAM(1)+1; PP:=IF(SYSPARAM(3)=SYSPARAM(1),P,GBNZQ),LINETHICK;
DPJX:=(开A+高A+低A+收A)/4;{大盘均价} JX:=(O+H+L+C)/4;{个股均价}
YXZQ1:=IF(中小企业=1 AND REF(DATE,BARPOS-1)<=1050608,BARSLAST(DATE=1050608),IF(创业板=1 AND REF(DATE,BARPOS-1)<=1100820,BARSLAST(DATE=1100820),IF(深证A股=1 AND REF(DATE,BARPOS-1)<=910403,BARSLAST(DATE=910403),BARPOS-1)));
YXZQ:=IF(PP>0 AND PP<ZHZQ,IF(PP-DZHZQ>=0 AND GBNZQ<P OR BARPOS>SYSPARAM(1),PP-DZHZQ,0),YXZQ1),LINETHICK;
{大盘个股比例}
BLO:=开A/REF(DPJX,YXZQ)/(O/REF(JX,YXZQ)),LINETHICK;{大盘开盘比例}
BLH:=高A/REF(DPJX,YXZQ)/(H/REF(JX,YXZQ)),LINETHICK;{大盘最高比例}
BLL:=低A/REF(DPJX,YXZQ)/(L/REF(JX,YXZQ)),LINETHICK;{大盘最低比例}
BLC:=收A/REF(DPJX,YXZQ)/(C/REF(JX,YXZQ)),LINETHICK;{大盘收盘比例}
{模拟大盘数据}
开:BLO*O,LINETHICK;
高:BLH*H,LINETHICK;
低:BLL*L,LINETHICK;
收:BLC*C,LINETHICK;
{画背景图}{调节参数N确定背景高度}
DRAWGBK(1,COLORRGB(100,100,100),COLORRGB(50,50,50),1);
DRAWTEXT(BARPOS=SYSPARAM(2),L,'理想论坛の超级实力'),COLORFFFFCC,ALIGN5;
VERTLINE(P=DZHZQ),LINEDOT;{统计周期界限}
{画大盘K线}
STICKLINE(收>=开,高,低,0,0),COLORYELLOW;
STICKLINE(收<开,高,低,0,0),COLORFF55BB;
STICKLINE(收>=开,收,开,10.6,0),COLOR00AAFF;
STICKLINE(收>=开,收,开,8.8,0),COLOR00BBFF;
STICKLINE(收>=开,收,开,5.86,0),COLOR00CCFF;
STICKLINE(收>=开,收,开,4.4,0),COLOR00DDFF;
STICKLINE(收>=开,收,开,2.9,0),COLOR00EEFF;
STICKLINE(收>=开,收,开,1.46,0),COLOR00FFFF;
STICKLINE(收<开,收,开,10.6,0),COLORAA00BB;
STICKLINE(收<开,收,开,8.8,0),COLORBB11BB;
STICKLINE(收<开,收,开,5.86,0),COLORCC22BB;
STICKLINE(收<开,收,开,4.4,0),COLORDD33BB;
STICKLINE(收<开,收,开,2.9,0),COLOREE44BB;
STICKLINE(收<开,收,开,1.46,0),COLORFF55BB;
{画个股K线}
STICKLINE(C>=O,L,H,0,0),COLORRED;
STICKLINE(C<O,L,H,0,0),COLORFFFF00;
STICKLINE(1,C,O,8,0),COLOR353500;
STICKLINE(1,C,O,7.5,0),COLOR454500;
STICKLINE(1,C,O,5.4,0),COLOR555500;
STICKLINE(1,C,O,4,0),COLOR656500;
STICKLINE(1,C,O,2.6,0),COLOR757500;
STICKLINE(1,C,O,1.3,0),COLOR858500;
STICKLINE(C>=O,C,O,8,0),COLOR000045;
STICKLINE(C>=O,C,O,7.5,0),COLOR000065;
STICKLINE(C>=O,C,O,5.4,0),COLOR000085;
STICKLINE(C>=O,C,O,4,0),COLOR0000A5;
STICKLINE(C>=O,C,O,2.6,0),COLOR0000C5;
STICKLINE(C>=O,C,O,1.3,0),COLOR0000E5;
个股命:MA(C,21),COLORRED,LINETHICK2;
大盘命:MA(收,21),COLOR00FF80,LINETHICK2;
{3组可调均线}
WX:=MA(C,0);
M1:MA(C,P1)*IF(N<1,WX,1);
M2:MA(C,P2)*IF(N<2,WX,1);
M3:MA(C,P3)*IF(N<3,WX,1);
D1:MA(收,P1)*IF(N<1,WX,1);
D2:MA(收,P2)*IF(N<2,WX,1);
D3:MA(收,P3)*IF(N<3,WX,1);
===================================================
简化版
{叠加大盘-飞狐版-理想论坛-超级实力-只叠加收盘}
{用法:请在A股、基金下使用,指数和其它品种不显示数据。基金、中小、创业、沪、深大盘分显--【移动光标时】采用光标处到画面最后周期作为大盘个股叠加周期,否则参数P大于零时采用P的周期作为大盘个股叠加周期,P等于零时采用个股全部上市日期作为叠加周期}
INPUT:P(0,0,99999);
创业板:=INBLOCK('创业板');
中小企业:=INBLOCK('中小企业');
上证A股:=INBLOCK('上海A股');
深证A股:=INBLOCK('深圳A股');
上海基金:=INBLOCK('上海基金');
深圳基金:=INBLOCK('深圳基金');
开:=IF(上海基金=1,"SH000011$OPEN",IF(深圳基金=1,"399305$OPEN",IF(中小企业=1,"399101$OPEN",IF(创业板=1,"399102$OPEN",IF(上证A股=1,"SH000001$OPEN",IF(深证A股=1,"399001$OPEN",0)))))),LINETHICK;
高:=IF(上海基金=1,"SH000011$HIGH",IF(深圳基金=1,"399305$HIGH",IF(中小企业=1,"399101$HIGH",IF(创业板=1,"399102$HIGH",IF(上证A股=1,"SH000001$HIGH",IF(深证A股=1,"399001$HIGH",0)))))),LINETHICK;
低:=IF(上海基金=1,"SH000011$LOW",IF(深圳基金=1,"399305$LOW",IF(中小企业=1,"399101$LOW",IF(创业板=1,"399102$LOW",IF(上证A股=1,"SH000001$LOW",IF(深证A股=1,"399001$LOW",0)))))),LINETHICK;
收:=IF(上海基金=1,"SH000011$CLOSE",IF(深圳基金=1,"399305$CLOSE",IF(中小企业=1,"399101$CLOSE",IF(创业板=1,"399102$CLOSE",IF(上证A股=1,"SH000001$CLOSE",IF(深证A股=1,"399001$CLOSE",0)))))),LINETHICK;
DRAWTEXT(BARPOS=SYSPARAM(2),L,'理想论坛の超级实力'),COLORFFFFCC,ALIGN5;
DZHZQ:=SYSPARAM(3)-BARPOS+1; ZHZQ:=SYSPARAM(3),LINETHICK; GBNZQ:=SYSPARAM(3)-SYSPARAM(1)+1; PP:=IF(SYSPARAM(3)=SYSPARAM(1),P,GBNZQ),LINETHICK;
DPJX:=(开+高+低+收)/4;{大盘均价} JX:=(O+H+L+C)/4;{个股均价}
YXZQ1:=IF(中小企业=1 AND REF(DATE,BARPOS-1)<=1050608,BARSLAST(DATE=1050608),IF(创业板=1 AND REF(DATE,BARPOS-1)<=1100820,BARSLAST(DATE=1100820),IF(深证A股=1 AND REF(DATE,BARPOS-1)<=910403,BARSLAST(DATE=910403),BARPOS-1)));
YXZQ:=IF(PP>0 AND PP<ZHZQ,IF(PP-DZHZQ>=0 AND GBNZQ<P OR BARPOS>SYSPARAM(1),PP-DZHZQ,0),YXZQ1),LINETHICK;
BL:=收/REF(DPJX,YXZQ)/(C/REF(JX,YXZQ));{大盘个股比例}
叠加大盘:BL*C,LINETHICK2;
VERTLINE(P=DZHZQ),LINEDOT;{统计周期界限}
PARTLINE(PP-DZHZQ>=0,叠加大盘),LINETHICK2;