飞狐软件的周期划线指标源码
1.中短期
//中短期DELTA(ITD):
//叠加K线--如果用于主图,以下五行可以不要
STICKLINE(OPEN>CLOSE, LOW,HIGH, 0,0),COLORWHITE;
STICKLINE(OPEN>CLOSE, CLOSE,OPEN, 8,0),COLORWHITE;
STICKLINE(OPEN<=CLOSE,OPEN, CLOSE,8,1),COLORRED;
STICKLINE(OPEN<=CLOSE,CLOSE,HIGH, 0,0),COLORRED;
STICKLINE(OPEN<=CLOSE,LOW,OPEN, 0,0),COLORRED;
//光标所在画面的最高价和最低价
HH:=SYSPARAM(4);
LL:=SYSPARAM(5);
//判断是否绘制彩线的位置
农历:LDay,LineThick0;
isFirst:=if(农历>Ref(农历,1) and ref(农历,1)<15 and 农历>15,1,0);
isColor:=iif(lday=15 or isFirst,1,0); //农历15,或者农历15后的第一个交易日,就是绘制彩线的位置
Num:=count(isColor,0); //计算彩线个数
//绘制彩线
STICKLINE(isColor and mod(Num,4)=0,ll,hh,1,0),colorred ;
STICKLINE(isColor and mod(Num,4)=1,ll,hh,1,0),coloryellow ;
STICKLINE(isColor and mod(Num,4)=2,ll,hh,1,0),colorblue ;
STICKLINE(isColor and mod(Num,4)=3,ll,hh,1,0),colorwhite ;
//适用于日线,周线好像亦可,推荐用于日线。
2.中期
//中期DELTA(MTD):
//叠加K线--如果用于主图,以下五行可以不要
STICKLINE(OPEN>CLOSE, LOW,HIGH, 0,0),COLORWHITE;
STICKLINE(OPEN>CLOSE, CLOSE,OPEN, 8,0),COLORWHITE;
STICKLINE(OPEN<=CLOSE,OPEN, CLOSE,8,1),COLORRED;
STICKLINE(OPEN<=CLOSE,CLOSE,HIGH, 0,0),COLORRED;
STICKLINE(OPEN<=CLOSE,LOW,OPEN, 0,0),COLORRED;
//光标所在画面的最高价和最低价
HH:=SYSPARAM(4);
LL:=sysparam(5);
//判断是否绘制彩线的位置
农历:LDay,LineThick0;
isFirst:=if(lday=15 or (农历>Ref(农历,1) and ref(农历,1)<15 and 农历>15),1,0); //农历15,或者农历15后的第一个交易日
isColor:=if(mod(count(isFirst,0),3)=1 and isFirst,1,0),linethick0; //每三个农历满月的位置绘制彩线
Num:=count(isColor,0); //计算彩线个数
//绘制彩线
STICKLINE(isColor and mod(Num,4)=0,ll,hh,1,0),colorred ;
STICKLINE(isColor and mod(Num,4)=1,ll,hh,1,0),coloryellow ;
STICKLINE(isColor and mod(Num,4)=2,ll,hh,1,0),colorblue ;
STICKLINE(isColor and mod(Num,4)=3,ll,hh,1,0),colorwhite ;
//适用于日线、周线。
3.长期
//长期DELTA(LTD):
//叠加K线--如果用于主图,以下五行可以不要
STICKLINE(OPEN>CLOSE, LOW,HIGH, 0,0),COLORWHITE;
STICKLINE(OPEN>CLOSE, CLOSE,OPEN, 8,0),COLORWHITE;
STICKLINE(OPEN<=CLOSE,OPEN, CLOSE,8,1),COLORRED;
STICKLINE(OPEN<=CLOSE,CLOSE,HIGH, 0,0),COLORRED;
STICKLINE(OPEN<=CLOSE,LOW,OPEN, 0,0),COLORRED;
//光标所在画面的最高价和最低价
HH:=SYSPARAM(4);
LL:=sysparam(5);
//判断是否绘制彩线的位置
年:=year;
isColor:=if(年>ref(年,1),1,0); //当K线的年份发生变化,就是绘制彩线的位置
Num:=count(isColor,0); //计算彩线个数
//绘制彩线
STICKLINE(isColor and mod(Num,4)=0,ll,hh,1,0),colorred ;
STICKLINE(isColor and mod(Num,4)=1,ll,hh,1,0),coloryellow ;
STICKLINE(isColor and mod(Num,4)=2,ll,hh,1,0),colorblue ;
STICKLINE(isColor and mod(Num,4)=3,ll,hh,1,0),colorwhite ;
//适用于日线、周线、月线,推荐用于周线、月线。
4.超长期
//超长期DELTA(SLTD):
//叠加K线--如果用于主图,以下五行可以不要
STICKLINE(OPEN>CLOSE, LOW,HIGH, 0,0),COLORWHITE;
STICKLINE(OPEN>CLOSE, CLOSE,OPEN, 8,0),COLORWHITE;
STICKLINE(OPEN<=CLOSE,OPEN, CLOSE,8,1),COLORRED;
STICKLINE(OPEN<=CLOSE,CLOSE,HIGH, 0,0),COLORRED;
STICKLINE(OPEN<=CLOSE,LOW,OPEN, 0,0),COLORRED;
//光标所在画面的最高价和最低价
HH:=SYSPARAM(4);
LL:=SYSPARAM(5);
//判断是否绘制彩线的位置
月:=month;
isFirst:=if(月>ref(月,1) or 月<ref(月,1),1,0); //K线月份发生变化的位置
isColor:=if(mod(count(isFirst,0),57)=1 and isFirst,1,0); //每57个月绘制一次彩线;
Num:=count(isColor,0); //计算彩线个数
//绘制彩线
STICKLINE(isColor and mod(Num,4)=0,ll,hh,1,0),colorred ;
STICKLINE(isColor and mod(Num,4)=1,ll,hh,1,0),coloryellow ;
STICKLINE(isColor and mod(Num,4)=2,ll,hh,1,0),colorblue ;
STICKLINE(isColor and mod(Num,4)=3,ll,hh,1,0),colorwhite ;
//适用于日线、周线、月线,推荐用于周线、月线。 |