文华、博易大师、盘立方、同花顺通达信期货通指标请关注

编写思路

缠论高低点画线,以高低点起笔点进行黄金分割0.382 0.5 0.618,红色线上涨笔,绿色线下跌笔,最后一笔是红绿虚线。

指标源码

N:=10;

高:=H>HV(H,N),NODRAW;

高N:=BARSLAST(高)+1;

低:=L<LV(L,N),NODRAW;

低N:=BARSLAST(低)+1;

高A:=BACKSET(COUNT(低,高N)&&低,高N);

低A:=BACKSET(COUNT(高,低N)&&高,低N);

DRAWLINE1(CROSS(高A=1,0.5),H,CROSS(低A=1,0.5),L,0),LINETHICK1,COLORGREEN;

DRAWLINE1(CROSS(低A=1,0.5),L,CROSS(高A=1,0.5),H,0),LINETHICK1,COLORRED;

DRAWLINE3(ISLASTBAR&&BARSLAST(CROSS(高A=1,0.5))<BARSLAST(CROSS(低A=1,0.5)),L,0,1,REF(H,BARSLAST(CROSS(高A=1,0.5))),BARSLAST(CROSS(高A=1,0.5)),0),COLORGREEN,DOT;

DRAWLINE3(ISLASTBAR&&BARSLAST(CROSS(高A=1,0.5))>BARSLAST(CROSS(低A=1,0.5)),H,0,1,REF(L,BARSLAST(CROSS(低A=1,0.5))),BARSLAST(CROSS(低A=1,0.5)),0),COLORRED,DOT;

SH:=VALUEWHEN(CROSS(高A=1,0.5),H);

SL:=VALUEWHEN(CROSS(低A=1,0.5),L);

DRAWSL(CROSS(高A=1,0.5),SH,0,0.5,0,COLORWHITE);

DRAWSL(CROSS(高A=1,0.5),SH-(SH-SL)*0.618,0,0.5,0,COLORWHITE);

DRAWSL(CROSS(高A=1,0.5),SH-(SH-SL)*0.382,0,0.5,0,COLORWHITE);

DRAWSL(CROSS(高A=1,0.5),SH-(SH-SL)*0.5,0,0.5,0,COLORWHITE);

DRAWLINE(CROSS(高A=1,0.5),SH,1,SH-(SH-SL)*0.618,COLORWHITE);

DRAWSL(CROSS(高A=1,0.5),SH,0,-0.5,0,COLORWHITE);

DRAWSL(CROSS(高A=1,0.5),SH-(SH-SL)*0.618,0,-0.5,0,COLORWHITE);

DRAWSL(CROSS(高A=1,0.5),SH-(SH-SL)*0.382,0,-0.5,0,COLORWHITE);

DRAWSL(CROSS(高A=1,0.5),SH-(SH-SL)*0.5,0,-0.5,0,COLORWHITE);

DRAWSL(CROSS(低A=1,0.5),SL,0,0.5,0,COLORWHITE);

DRAWSL(CROSS(低A=1,0.5),SL+(SH-SL)*0.618,0,0.5,0,COLORWHITE);

DRAWSL(CROSS(低A=1,0.5),SL+(SH-SL)*0.382,0,0.5,0,COLORWHITE);

DRAWSL(CROSS(低A=1,0.5),SL+(SH-SL)*0.5,0,0.5,0,COLORWHITE);

DRAWLINE(CROSS(低A=1,0.5),SL,1,SL+(SH-SL)*0.618,COLORWHITE);

DRAWSL(CROSS(低A=1,0.5),SL,0,-0.5,0,COLORWHITE);

DRAWSL(CROSS(低A=1,0.5),SL+(SH-SL)*0.618,0,-0.5,0,COLORWHITE);

DRAWSL(CROSS(低A=1,0.5),SL+(SH-SL)*0.382,0,-0.5,0,COLORWHITE);

DRAWSL(CROSS(低A=1,0.5),SL+(SH-SL)*0.5,0,-0.5,0,COLORWHITE);

 

源码解析

N赋值:10

高赋值:最高价>HV(最高价,N),NODRAW

高N赋值:上次高距今天数+1

低赋值:最低价<LV(最低价,N),NODRAW

低N赋值:上次低距今天数+1

高A赋值:若统计高N日中满足低的天数并且低则将最近高N周期置为1

低A赋值:若统计低N日中满足高的天数并且高则将最近低N周期置为1

DRAWLINE1(高A=1上穿0.5,最高价,低A=1上穿0.5,最低价,0),线宽为1,画绿色

DRAWLINE1(低A=1上穿0.5,最低价,高A=1上穿0.5,最高价,0),线宽为1,画红色

DRAWLINE3(是否最后一个周期并且上次高A=1上穿0.5距今天数<上次低A=1上穿0.5距今天数,最低价,0,1,上次高A=1上穿0.5距今天数日前的最高价,上次高A=1上穿0.5距今天数,0),画绿色,DOT

DRAWLINE3(是否最后一个周期并且上次高A=1上穿0.5距今天数>上次低A=1上穿0.5距今天数,最高价,0,1,上次低A=1上穿0.5距今天数日前的最低价,上次低A=1上穿0.5距今天数,0),画红色,DOT

SH赋值:如果高A=1上穿0.5,返回最高价,否则返回上个输出值

SL赋值:如果低A=1上穿0.5,返回最低价,否则返回上个输出值

当满足条件高A=1上穿0.5时,在SH位置画斜线0斜率0.5长度,0方向.

当满足条件高A=1上穿0.5时,在SH-(SH-SL)*0.618位置画斜线0斜率0.5长度,0方向.

当满足条件高A=1上穿0.5时,在SH-(SH-SL)*0.382位置画斜线0斜率0.5长度,0方向.

当满足条件高A=1上穿0.5时,在SH-(SH-SL)*0.5位置画斜线0斜率0.5长度,0方向.

当满足条件高A=1上穿0.5时,在SH位置画直线起点,当满足条件1时,在SH-(SH-SL)*0.618位置画直线终点,画白色表示是否延长.

当满足条件高A=1上穿0.5时,在SH位置画斜线0斜率-0.5长度,0方向.

当满足条件高A=1上穿0.5时,在SH-(SH-SL)*0.618位置画斜线0斜率-0.5长度,0方向.

当满足条件高A=1上穿0.5时,在SH-(SH-SL)*0.382位置画斜线0斜率-0.5长度,0方向.

当满足条件高A=1上穿0.5时,在SH-(SH-SL)*0.5位置画斜线0斜率-0.5长度,0方向.

当满足条件低A=1上穿0.5时,在SL位置画斜线0斜率0.5长度,0方向.

当满足条件低A=1上穿0.5时,在SL+(SH-SL)*0.618位置画斜线0斜率0.5长度,0方向.

当满足条件低A=1上穿0.5时,在SL+(SH-SL)*0.382位置画斜线0斜率0.5长度,0方向.

当满足条件低A=1上穿0.5时,在SL+(SH-SL)*0.5位置画斜线0斜率0.5长度,0方向.

当满足条件低A=1上穿0.5时,在SL位置画直线起点,当满足条件1时,在SL+(SH-SL)*0.618位置画直线终点,画白色表示是否延长.

当满足条件低A=1上穿0.5时,在SL位置画斜线0斜率-0.5长度,0方向.

当满足条件低A=1上穿0.5时,在SL+(SH-SL)*0.618位置画斜线0斜率-0.5长度,0方向.

当满足条件低A=1上穿0.5时,在SL+(SH-SL)*0.382位置画斜线0斜率-0.5长度,0方向.

当满足条件低A=1上穿0.5时,在SL+(SH-SL)*0.5位置画斜线0斜率-0.5长度,0方向.

文华财经缠论自动画笔 黄金分割画线指标公式源码

指标下载声明:1、指标下载前请认真阅读详情内容,不提供具体使用方法,自行学习研究;2、您已下载代表对本指标认可,虚拟物品不予退款和调换;3、下载后如需修改或者定制编写指标,另收取费用;4、指标仅是分析辅助工具,不可依赖,理性使用,盈亏自负! 转载文章声明:本网站转载文章仅为传播更多期货行业信息,并不代表本网站赞同其观点,本网站也不保证文章内容的真实性、准确性和可靠性、完整性。 文章解释权归原作者所有,依次操作,所有后果自行承担,与本站无任何关系。如该文章涉及作品内容、版权或禁止转载的,请及时联系,我们将在第一时间处理。