分享

大智慧K线重心趋势主图指标公式源码编程思路破译

 发现探索 2022-10-02 发表于天津

编程思路破译

DRAWGBKLAST(收盘价>0,STRIP(自定色,自定色,0))

输出HL8:(最高价的8日简单移动平均+最低价的8日简单移动平均)/2,COLOR00FF00,线宽为1

输出MC8:收盘价的8日指数移动平均,COLOR0000FF,线宽为1

FILLRGN(HL8,MC8,HL8<MC8,自定色,HL8>MC8,自定色),LAYER7

当满足条件收阳线时,在开盘价和最低价位置之间画柱状线,宽度为0.5,0不为0则画空心柱.,COLOR0000FF

当满足条件收阳线时,在收盘价和最高价位置之间画柱状线,宽度为0.5,0不为0则画空心柱.,COLOR0000FF

当满足条件收阳线时,在收盘价和开盘价位置之间画柱状线,宽度为8,0不为0则画空心柱. ,COLOR000077

当满足条件收阳线时,在收盘价和开盘价位置之间画柱状线,宽度为7,0不为0则画空心柱. ,COLOR000099

当满足条件收阳线时,在收盘价和开盘价位置之间画柱状线,宽度为6,0不为0则画空心柱. ,COLOR0000BB

当满足条件收阳线时,在收盘价和开盘价位置之间画柱状线,宽度为5,0不为0则画空心柱. ,COLOR0000CC

当满足条件收阳线时,在收盘价和开盘价位置之间画柱状线,宽度为4,0不为0则画空心柱. ,COLOR0000DD

当满足条件收阳线时,在收盘价和开盘价位置之间画柱状线,宽度为3,0不为0则画空心柱. ,COLOR0000EE

当满足条件收阳线时,在收盘价和开盘价位置之间画柱状线,宽度为2,0不为0则画空心柱. ,COLOR0000FF

当满足条件开盘价>=收盘价时,在收盘价和最低价位置之间画柱状线,宽度为0.5,0不为0则画空心柱.,COLORFFFF00

当满足条件开盘价>=收盘价时,在开盘价和最高价位置之间画柱状线,宽度为0.5,0不为0则画空心柱.,COLORFFFF00

当满足条件开盘价>=收盘价时,在收盘价和开盘价位置之间画柱状线,宽度为8,0不为0则画空心柱.,COLORFF7700

当满足条件开盘价>=收盘价时,在收盘价和开盘价位置之间画柱状线,宽度为7,0不为0则画空心柱.,COLORFF9900

当满足条件开盘价>=收盘价时,在收盘价和开盘价位置之间画柱状线,宽度为6,0不为0则画空心柱.,COLORFFBB00

当满足条件开盘价>=收盘价时,在收盘价和开盘价位置之间画柱状线,宽度为5,0不为0则画空心柱.,COLORFFCC00

当满足条件开盘价>=收盘价时,在收盘价和开盘价位置之间画柱状线,宽度为4,0不为0则画空心柱.,COLORFFDD00

当满足条件开盘价>=收盘价时,在收盘价和开盘价位置之间画柱状线,宽度为3,0不为0则画空心柱.,COLORFFEE00

当满足条件开盘价>=收盘价时,在收盘价和开盘价位置之间画柱状线,宽度为2,0不为0则画空心柱.,COLORFFFF00

输出中:收盘价的55日指数移动平均,COLOR999999,线宽为0

输出顶:中*1.1,POINTDOT,COLORFF9900,线宽为3

当满足条件(收盘价>=顶)时,在最高价和最高价*1.003位置之间画柱状线,宽度为4,0不为0则画空心柱.,COLOR00FFFF

买赋值:收盘价的3日指数移动平均

卖赋值:收盘价的21日线性回归斜率*21+收盘价的43日指数移动平均

当满足条件买<卖时,在最低价和最低价*0.997位置之间画柱状线,宽度为4,0不为0则画空心柱.,COLOR00FF00

当满足条件买上穿卖时,在收盘价和开盘价位置之间画柱状线,宽度为6,0不为0则画空心柱.,COLOR0099FF,LAYER0

当满足条件买上穿卖时,在最低价和最高价位置之间画柱状线,宽度为2,0不为0则画空心柱.,COLOR0099FF

当满足条件卖上穿买时,在收盘价和开盘价位置之间画柱状线,宽度为6,0不为0则画空心柱.,COLORFFFFFF,LAYER0

当满足条件卖上穿买时,在最低价和最高价位置之间画柱状线,宽度为2,0不为0则画空心柱.,COLOR00FFFF

DRAWTEXTABS(0,5,'【1】头顶带帽已见顶'),COLOR00FFFF,线宽为2

DRAWTEXTABS(140,5,'【2】脚底穿鞋跌势'),COLOR00FF00,线宽为2

DRAWTEXTABS(0,25,'【3】金黄K线转向升'),COLOR0099FF,线宽为2

DRAWTEXTABS(140,25,'【4】白色K线转向跌'),COLORFFFFFF,线宽为2

X赋值:上次DISPSTATUS=1距今天数+1

P赋值:若DISPSTATUS=2则将最近X/2+1周期置为1

K赋值:上次P上穿0.5距今天数+1

KJ赋值:HHVALL(最高价)-LLVALL(最低价)

平衡赋值:如果K>=0,返回LLVALL(最低价)+KJ/2,否则返回0

压力赋值:如果K>=0,返回HHVALL(最高价)-KJ*0.191,否则返回平衡

支撑赋值:如果K>=0,返回LLVALL(最低价)+KJ*0.191,否则返回平衡

DRAWRECTABS(280,1,300+(HHVALL(最高价))*300/收盘价 ,80 ,自定色),COLOR0000FF,线宽为2,LAYER3

DRAWRECTABS(285,4,300+(压力)*300/收盘价 ,70 ,自定色),COLOR99FF99,LAYER2

DRAWRECTABS(290,7,300+(平衡)*300/收盘价 ,60 ,自定色),COLORFF00FF,LAYER1

DRAWRECTABS(295,10,300+(支撑)*300/收盘价 ,50 ,自定色),COLOR00FFFF,LAYER0

DRAWRECTABS(300,21,300+(收盘价)*300/收盘价 ,39 ,自定色),COLOR0077FF,线宽为1,LAYER0

DRAWTEXTABS(270,90,'【支撑 '+NUMTOSTRN(支撑,2)+' 元】'),COLOR00FFFF,线宽为2,LAYER0

DRAWTEXTABS(405,90,'【平衡 '+NUMTOSTRN(平衡,2)+' 元】'),COLOR44FF99,线宽为2,LAYER0

DRAWTEXTABS(540,90,'【压力 '+NUMTOSTRN(压力,2)+' 元】'),COLOR0044FF,线宽为2,LAYER0

输出DRAWTEXTABS(320,23,'【四区周期:--→ '+K+'天】'),COLOR00FFFF,线宽为2,LAYER0

程序源码

DRAWGBKLAST(C>0,STRIP(RGB(0,0,0),RGB(60,0,80),0));

{1.K线重心}

HL8:(MA(H,8)+MA(L,8))/2,COLOR00FF00,LINETHICK1;

MC8:EMA(C,8),COLOR0000FF,LINETHICK1;

FILLRGN(HL8,MC8,HL8<MC8,RGB(150,0,0),HL8>MC8,RGB(0,150,0)),LAYER7;

{2.K线.正常上涨}

STICKLINE(CLOSE>OPEN,OPEN,LOW,0.5,0 ),COLOR0000FF;

STICKLINE(CLOSE>OPEN,CLOSE,HIGH,0.5,0 ),COLOR0000FF;

STICKLINE(CLOSE>OPEN,CLOSE,OPEN,8,0) ,COLOR000077;

STICKLINE(CLOSE>OPEN,CLOSE,OPEN,7,0) ,COLOR000099;

STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLOR0000BB;

STICKLINE(CLOSE>OPEN,CLOSE,OPEN,5,0) ,COLOR0000CC;

STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLOR0000DD;

STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLOR0000EE;

STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLOR0000FF;

{3.K线.正常下跌}

STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0.5,0 ),COLORFFFF00;

STICKLINE(OPEN>=CLOSE,OPEN,HIGH,0.5,0 ),COLORFFFF00;

STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,8,0 ),COLORFF7700;

STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLORFF9900;

STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLORFFBB00;

STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLORFFCC00;

STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLORFFDD00;

STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLORFFEE00;

STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLORFFFF00;

{4.K线带帽已见顶}

中:EMA(CLOSE,55),COLOR999999,LINETHICK0;

顶:中*1.1,POINTDOT,COLORFF9900,LINETHICK3;

STICKLINE((CLOSE >= 顶),H ,H*1.003,4,0),COLOR00FFFF;

{5.脚底穿鞋正在跌}

买:=EMA(C,3);

卖:=EMA(SLOPE(C,21)*21+C,43);

STICKLINE(买<卖,L ,L*0.997,4,0),COLOR00FF00;

{6.金黄K线转向升}

STICKLINE(CROSS(买,卖) ,CLOSE ,OPEN,6,0),COLOR0099FF,LAYER0;

STICKLINE(CROSS(买,卖),LOW,HIGH,2,0 ),COLOR0099FF;

{7.白色K线转向跌}

STICKLINE(CROSS(卖,买),CLOSE ,OPEN,6,0),COLORFFFFFF,LAYER0;

STICKLINE(CROSS(卖,买),LOW,HIGH,2,0 ),COLOR00FFFF;

DRAWTEXTABS(0,5,'【1】头顶带帽已见顶'),COLOR00FFFF,LINETHICK2;

DRAWTEXTABS(140,5,'【2】脚底穿鞋跌势'),COLOR00FF00,LINETHICK2;

DRAWTEXTABS(0,25,'【3】金黄K线转向升'),COLOR0099FF,LINETHICK2;

DRAWTEXTABS(140,25,'【4】白色K线转向跌'),COLORFFFFFF,LINETHICK2;

X:=BARSLAST(DISPSTATUS=1)+1;

P:=BACKSET(DISPSTATUS=2,X/2+1);

K:=BARSLAST(CROSS(P,0.5))+1;

KJ:=HHVALL(HIGH)-LLVALL(LOW);

平衡:=IF(K>=0,LLVALL(LOW)+KJ/2,0);

压力:=IF(K>=0,HHVALL(HIGH)-KJ*0.191,平衡);

支撑:=IF(K>=0,LLVALL(LOW)+KJ*0.191,平衡);

DRAWRECTABS(280,1,300+(HHVALL(HIGH))*300/C ,80 ,RGB(0,0,255)),COLOR0000FF,LINETHICK2,LAYER3;

DRAWRECTABS(285,4,300+(压力)*300/C ,70 ,RGB(140,0,60)),COLOR99FF99,LAYER2;

DRAWRECTABS(290,7,300+(平衡)*300/C ,60 ,RGB(0,120,0)),COLORFF00FF,LAYER1;

DRAWRECTABS(295,10,300+(支撑)*300/C ,50 ,RGB(80,0,80)),COLOR00FFFF,LAYER0;

DRAWRECTABS(300,21,300+(C)*300/C ,39 ,RGB(10,10,10)),COLOR0077FF,LINETHICK1,LAYER0;

DRAWTEXTABS(270,90,'【支撑 '+NUMTOSTRN(支撑,2)+' 元】'),COLOR00FFFF,LINETHICK2,LAYER0;

DRAWTEXTABS(405,90,'【平衡 '+NUMTOSTRN(平衡,2)+' 元】'),COLOR44FF99,LINETHICK2,LAYER0;

DRAWTEXTABS(540,90,'【压力 '+NUMTOSTRN(压力,2)+' 元】'),COLOR0044FF,LINETHICK2,LAYER0;

DRAWTEXTABS(320,23,'【四区周期:--→ '+K+'天】'),COLOR00FFFF,LINETHICK2,LAYER0;

该公式包含未来函数:BACKSET

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章