手机版
官方微信
扫描关注:理想财富微信公众号
理想论坛App
扫描下载理想论坛App
RSS

请老师帮助修改指标公式

[通达信]
设置
2412 5 华仔2888 Lv.5 发表于 · 2020-9-16 13:26 举报 显示全部楼层 复制 正序浏览 |
跳转到指定楼层
请老师修改指标公式谢谢辛苦老师
要求:在主图指标中六根划线的右边分别从上至下写字
上面三根线写:  高1   高2   高3
下面三根线写:  低1   低2   低3
源码
XA_1:=20;
XA_2:=10;
XA_3:=5;
XA_4:=(CLOSE+HIGH+LOW+OPEN)/4;
XA_5:=LOW+(XA_4-LOW)+(CLOSE-LOW);
XA_6:=LOW+(CLOSE-XA_4);
XA_7:=REF(XA_5,1);
XA_8:=REF(XA_6,1);
{支:STICKLINE(ISLASTBAR AND CLOSE>=XA_7,XA_7,XA_7,30,1),COLORRED;
压:STICKLINE(ISLASTBAR AND CLOSE<XA_7,XA_7,XA_7,30,1),COLORGREEN;
支1:STICKLINE(ISLASTBAR AND CLOSE>=XA_8,XA_8,XA_8,30,1),COLORMAGENTA;
压1:STICKLINE(ISLASTBAR AND CLOSE<XA_8,XA_8,XA_8,30,1),COLORFF8800;}
XA_9:=REF(HIGH,XA_1)=HHV(HIGH,2*XA_1+1);
XA_10:=BACKSET(XA_9,XA_1+1);
XA_11:=FILTER(XA_10,XA_1) AND HIGH=HHV(HIGH,XA_1+1);
XA_12:=BARSLAST(XA_11);
XA_13:=IF(XA_11,CURRBARSCOUNT,0);
XA_14:=IF(XA_12,REF(HIGH,XA_12),HIGH);
XA_15:=IF(XA_12,REF(XA_13,XA_12),XA_13);
XA_16:=REF(XA_14,XA_12+1);
XA_17:=CONST(XA_15);
XA_18:=REF(XA_15,XA_12+1);
XA_19:=CONST(XA_18);
XA_20:=REF(XA_16,XA_12+1);
XA_21:=IF(CURRBARSCOUNT>XA_19,0,1);
XA_22:=DRAWLINE(CURRBARSCOUNT=XA_19,HIGH,CURRBARSCOUNT=XA_17,HIGH,1);
XA_23:=REF(LOW,XA_1)=LLV(LOW,2*XA_1+1);
XA_24:=BACKSET(XA_23,XA_1+1);
XA_25:=FILTER(XA_24,XA_1) AND LOW=LLV(LOW,XA_1+1);
XA_26:=BARSLAST(XA_25);
XA_27:=IF(XA_25,CURRBARSCOUNT,0);
XA_28:=IF(XA_26,REF(LOW,XA_26),LOW);
XA_29:=IF(XA_26,REF(XA_27,XA_26),XA_27);
XA_30:=CONST(XA_29);
XA_31:=REF(XA_28,XA_26+1);
XA_32:=REF(XA_29,XA_26+1);
XA_33:=CONST(XA_32);
{低点支撑:DRAWLINE(CURRBARSCOUNT=XA_33,LOW,CURRBARSCOUNT=XA_30,LOW,1),COLORYELLOW;}
DRAWLINE(CURRBARSCOUNT=XA_33,LOW,ISLASTBAR,REF(LOW,XA_33-1),1),POINTDOT,COLORYELLOW,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=XA_30,LOW,ISLASTBAR,REF(LOW,XA_30-1),1),POINTDOT,COLORYELLOW,LINETHICK2;
XA_34:=REF(HIGH,XA_2)=HHV(HIGH,2*XA_2+1);
XA_35:=BACKSET(XA_34,XA_2+1);
XA_36:=FILTER(XA_35,XA_2) AND HIGH=HHV(HIGH,XA_2+1);
XA_37:=BARSLAST(XA_36);
XA_38:=IF(XA_36,CURRBARSCOUNT,0);
XA_39:=IF(XA_37,REF(HIGH,XA_37),HIGH);
XA_40:=IF(XA_37,REF(XA_38,XA_37),XA_38);
XA_41:=REF(XA_39,XA_37+1);
XA_42:=CONST(XA_40);
XA_43:=REF(XA_40,XA_37+1);
XA_44:=CONST(XA_43);
XA_45:=REF(XA_41,XA_37+1);
XA_46:=IF(CURRBARSCOUNT>XA_44,0,1);
{压力:DRAWLINE(CURRBARSCOUNT=XA_44,HIGH,CURRBARSCOUNT=XA_42,HIGH,1),COLORYELLOW;}
DRAWLINE(CURRBARSCOUNT=XA_44,HIGH,ISLASTBAR,REF(HIGH,XA_44-1),1),POINTDOT,COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=XA_42,HIGH,ISLASTBAR,REF(HIGH,XA_42-1),1),POINTDOT,COLORYELLOW;
XA_47:=REF(LOW,XA_2)=LLV(LOW,2*XA_2+1);
XA_48:=BACKSET(XA_47,XA_2+1);
XA_49:=FILTER(XA_48,XA_2) AND LOW=LLV(LOW,XA_2+1);
XA_50:=BARSLAST(XA_49);
XA_51:=IF(XA_49,CURRBARSCOUNT,0);
XA_52:=IF(XA_50,REF(LOW,XA_50),LOW);
XA_53:=IF(XA_50,REF(XA_51,XA_50),XA_51);
XA_54:=CONST(XA_53);
XA_55:=REF(XA_52,XA_50+1);
XA_56:=REF(XA_53,XA_26+1);
XA_57:=CONST(XA_56);
{支撑:DRAWLINE(CURRBARSCOUNT=XA_57,LOW,CURRBARSCOUNT=XA_54,LOW,1);
XA_58:=(压力+支撑)/2;
XA_59:=CONST((压力+支撑)/2);
XA_60:=IF(XA_33<XA_19,XA_33,XA_19);
中轨:DRAWLINE(CURRBARSCOUNT=XA_60,XA_58,ISLASTBAR,XA_59,1),COLORYELLOW;}
XA_61:=REF(HIGH,XA_3)=HHV(HIGH,2*XA_3+1);
XA_62:=BACKSET(XA_61,XA_3+1);
XA_63:=FILTER(XA_62,XA_3) AND HIGH=HHV(HIGH,XA_3+1);
XA_64:=BARSLAST(XA_63);
XA_65:=IF(XA_63,CURRBARSCOUNT,0);
XA_66:=IF(XA_64,REF(HIGH,XA_64),HIGH);
XA_67:=IF(XA_64,REF(XA_65,XA_64),XA_65);
XA_68:=REF(XA_66,XA_64+1);
XA_69:=CONST(XA_67);
XA_70:=REF(XA_67,XA_64+1);
XA_71:=CONST(XA_70);
XA_72:=REF(XA_68,XA_64+1);
XA_73:=IF(CURRBARSCOUNT>XA_44,0,1);
{L压力:DRAWLINE(CURRBARSCOUNT=XA_71,HIGH,CURRBARSCOUNT=XA_69,HIGH,1),COLORYELLOW;}
DRAWLINE(CURRBARSCOUNT=XA_71,HIGH,ISLASTBAR,REF(HIGH,XA_71-1),1),POINTDOT,COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=XA_69,HIGH,ISLASTBAR,REF(HIGH,XA_69-1),1),POINTDOT,COLORYELLOW;
XA_74:=REF(LOW,XA_3)=LLV(LOW,2*XA_3+1);
XA_75:=BACKSET(XA_74,XA_3+1);
XA_76:=FILTER(XA_75,XA_3) AND LOW=LLV(LOW,XA_3+1);
XA_77:=BARSLAST(XA_49);
XA_78:=IF(XA_76,CURRBARSCOUNT,0);
XA_79:=IF(XA_77,REF(LOW,XA_77),LOW);
XA_80:=IF(XA_77,REF(XA_78,XA_77),XA_51);
XA_81:=CONST(XA_80);
XA_82:=REF(XA_79,XA_77+1);
XA_83:=REF(XA_80,XA_26+1);
XA_84:=CONST(XA_83);


举报

扔鸡蛋(0) 回复

常怡_28
Lv.5
发表于 2020-9-16 20:28 复制 查看全部楼层
把不必要的代码精简掉:
XA_1:=20;
XA_2:=10;
XA_3:=5;
XA_23:=REF(LOW,XA_1)=LLV(LOW,2*XA_1+1);
XA_24:=BACKSET(XA_23,XA_1+1);
XA_25:=FILTER(XA_24,XA_1) AND LOW=LLV(LOW,XA_1+1);
XA_26:=BARSLAST(XA_25);
XA_27:=IF(XA_25,CURRBARSCOUNT,0);
XA_29:=IF(XA_26,REF(XA_27,XA_26),XA_27);
XA_30:=CONST(XA_29);
XA_32:=REF(XA_29,XA_26+1);
XA_33:=CONST(XA_32);
DRAWLINE(CURRBARSCOUNT=XA_33,LOW,ISLASTBAR,REF(LOW,XA_33-1),1),POINTDOT,COLORYELLOW,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=XA_30,LOW,ISLASTBAR,REF(LOW,XA_30-1),1),POINTDOT,COLORYELLOW,LINETHICK2;
DRAWTEXT(ISLASTBAR,REF(L,XA_33-1),'低3'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,REF(L,XA_30-1),'低2'),COLORYELLOW;
XA_34:=REF(HIGH,XA_2)=HHV(HIGH,2*XA_2+1);
XA_35:=BACKSET(XA_34,XA_2+1);
XA_36:=FILTER(XA_35,XA_2) AND HIGH=HHV(HIGH,XA_2+1);
XA_37:=BARSLAST(XA_36);
XA_38:=IF(XA_36,CURRBARSCOUNT,0);
XA_40:=IF(XA_37,REF(XA_38,XA_37),XA_38);
XA_42:=CONST(XA_40);
XA_43:=REF(XA_40,XA_37+1);
XA_44:=CONST(XA_43);
DRAWLINE(CURRBARSCOUNT=XA_44,HIGH,ISLASTBAR,REF(HIGH,XA_44-1),1),POINTDOT,COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=XA_42,HIGH,ISLASTBAR,REF(HIGH,XA_42-1),1),POINTDOT,COLORYELLOW;
DRAWTEXT(ISLASTBAR,REF(HIGH,XA_44-1),'低1'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,REF(HIGH,XA_42-1),'高2'),COLORYELLOW;
XA_61:=REF(HIGH,XA_3)=HHV(HIGH,2*XA_3+1);
XA_62:=BACKSET(XA_61,XA_3+1);
XA_63:=FILTER(XA_62,XA_3) AND HIGH=HHV(HIGH,XA_3+1);
XA_64:=BARSLAST(XA_63);
XA_65:=IF(XA_63,CURRBARSCOUNT,0);
XA_67:=IF(XA_64,REF(XA_65,XA_64),XA_65);
XA_69:=CONST(XA_67);
XA_70:=REF(XA_67,XA_64+1);
XA_71:=CONST(XA_70);
DRAWLINE(CURRBARSCOUNT=XA_71,HIGH,ISLASTBAR,REF(HIGH,XA_71-1),1),POINTDOT,COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=XA_69,HIGH,ISLASTBAR,REF(HIGH,XA_69-1),1),POINTDOT,COLORYELLOW;
DRAWTEXT(ISLASTBAR,REF(HIGH,XA_71-1),'高3'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,REF(HIGH,XA_69-1),'高1'),COLORYELLOW;

举报

扔鸡蛋(0) 回复

华仔2888
Lv.5
发表于 2020-9-16 14:12 复制 查看全部楼层
许昌舍得 发表于 2020-9-16 13:51
线的位置会发生变化,引起排序变化。

是的这个知道谢谢老师提醒很给力,祝您投资愉快,理想因您而精彩;

举报

点亮(1) 扔鸡蛋(0) 回复

许昌舍得
Lv.6
发表于 2020-9-16 13:51 复制 查看全部楼层
线的位置会发生变化,引起排序变化。

举报

扔鸡蛋(0) 回复

许昌舍得
Lv.6
发表于 2020-9-16 13:50 复制 查看全部楼层
华仔2888 发表于 2020-9-16 13:28
上一张图给老师参考看一下  (六根划线图)

供参考

XA_1:=20;
XA_2:=10;
XA_3:=5;
XA_4:=(CLOSE+HIGH+LOW+OPEN)/4;
XA_5:=LOW+(XA_4-LOW)+(CLOSE-LOW);
XA_6:=LOW+(CLOSE-XA_4);
XA_7:=REF(XA_5,1);
XA_8:=REF(XA_6,1);
{支:STICKLINE(ISLASTBAR AND CLOSE>=XA_7,XA_7,XA_7,30,1),COLORRED;
压:STICKLINE(ISLASTBAR AND CLOSE<XA_7,XA_7,XA_7,30,1),COLORGREEN;
支1:STICKLINE(ISLASTBAR AND CLOSE>=XA_8,XA_8,XA_8,30,1),COLORMAGENTA;
压1:STICKLINE(ISLASTBAR AND CLOSE<XA_8,XA_8,XA_8,30,1),COLORFF8800;}
XA_9:=REF(HIGH,XA_1)=HHV(HIGH,2*XA_1+1);
XA_10:=BACKSET(XA_9,XA_1+1);
XA_11:=FILTER(XA_10,XA_1) AND HIGH=HHV(HIGH,XA_1+1);
XA_12:=BARSLAST(XA_11);
XA_13:=IF(XA_11,CURRBARSCOUNT,0);
XA_14:=IF(XA_12,REF(HIGH,XA_12),HIGH);
XA_15:=IF(XA_12,REF(XA_13,XA_12),XA_13);
XA_16:=REF(XA_14,XA_12+1);
XA_17:=CONST(XA_15);
XA_18:=REF(XA_15,XA_12+1);
XA_19:=CONST(XA_18);
XA_20:=REF(XA_16,XA_12+1);
XA_21:=IF(CURRBARSCOUNT>XA_19,0,1);
XA_22:=DRAWLINE(CURRBARSCOUNT=XA_19,HIGH,CURRBARSCOUNT=XA_17,HIGH,1);
XA_23:=REF(LOW,XA_1)=LLV(LOW,2*XA_1+1);
XA_24:=BACKSET(XA_23,XA_1+1);
XA_25:=FILTER(XA_24,XA_1) AND LOW=LLV(LOW,XA_1+1);
XA_26:=BARSLAST(XA_25);
XA_27:=IF(XA_25,CURRBARSCOUNT,0);
XA_28:=IF(XA_26,REF(LOW,XA_26),LOW);
XA_29:=IF(XA_26,REF(XA_27,XA_26),XA_27);
XA_30:=CONST(XA_29);
XA_31:=REF(XA_28,XA_26+1);
XA_32:=REF(XA_29,XA_26+1);
XA_33:=CONST(XA_32);
{低点支撑:DRAWLINE(CURRBARSCOUNT=XA_33,LOW,CURRBARSCOUNT=XA_30,LOW,1),COLORYELLOW;}
DRAWLINE(CURRBARSCOUNT=XA_33,LOW,ISLASTBAR,REF(LOW,XA_33-1),1),POINTDOT,COLORYELLOW,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=XA_30,LOW,ISLASTBAR,REF(LOW,XA_30-1),1),POINTDOT,COLORYELLOW,LINETHICK2;
DRAWTEXT(ISLASTBAR,REF(L,XA_33-1),'低3'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,REF(L,XA_30-1),'低2'),COLORYELLOW;


XA_34:=REF(HIGH,XA_2)=HHV(HIGH,2*XA_2+1);
XA_35:=BACKSET(XA_34,XA_2+1);
XA_36:=FILTER(XA_35,XA_2) AND HIGH=HHV(HIGH,XA_2+1);
XA_37:=BARSLAST(XA_36);
XA_38:=IF(XA_36,CURRBARSCOUNT,0);
XA_39:=IF(XA_37,REF(HIGH,XA_37),HIGH);
XA_40:=IF(XA_37,REF(XA_38,XA_37),XA_38);
XA_41:=REF(XA_39,XA_37+1);
XA_42:=CONST(XA_40);
XA_43:=REF(XA_40,XA_37+1);
XA_44:=CONST(XA_43);
XA_45:=REF(XA_41,XA_37+1);
XA_46:=IF(CURRBARSCOUNT>XA_44,0,1);
{压力:DRAWLINE(CURRBARSCOUNT=XA_44,HIGH,CURRBARSCOUNT=XA_42,HIGH,1),COLORYELLOW;}
DRAWLINE(CURRBARSCOUNT=XA_44,HIGH,ISLASTBAR,REF(HIGH,XA_44-1),1),POINTDOT,COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=XA_42,HIGH,ISLASTBAR,REF(HIGH,XA_42-1),1),POINTDOT,COLORYELLOW;

DRAWTEXT(ISLASTBAR,REF(HIGH,XA_44-1),'低1'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,REF(HIGH,XA_42-1),'高2'),COLORYELLOW;
XA_47:=REF(LOW,XA_2)=LLV(LOW,2*XA_2+1);
XA_48:=BACKSET(XA_47,XA_2+1);
XA_49:=FILTER(XA_48,XA_2) AND LOW=LLV(LOW,XA_2+1);
XA_50:=BARSLAST(XA_49);
XA_51:=IF(XA_49,CURRBARSCOUNT,0);
XA_52:=IF(XA_50,REF(LOW,XA_50),LOW);
XA_53:=IF(XA_50,REF(XA_51,XA_50),XA_51);
XA_54:=CONST(XA_53);
XA_55:=REF(XA_52,XA_50+1);
XA_56:=REF(XA_53,XA_26+1);
XA_57:=CONST(XA_56);
{支撑:DRAWLINE(CURRBARSCOUNT=XA_57,LOW,CURRBARSCOUNT=XA_54,LOW,1);
XA_58:=(压力+支撑)/2;
XA_59:=CONST((压力+支撑)/2);
XA_60:=IF(XA_33<XA_19,XA_33,XA_19);
中轨:DRAWLINE(CURRBARSCOUNT=XA_60,XA_58,ISLASTBAR,XA_59,1),COLORYELLOW;}
XA_61:=REF(HIGH,XA_3)=HHV(HIGH,2*XA_3+1);
XA_62:=BACKSET(XA_61,XA_3+1);
XA_63:=FILTER(XA_62,XA_3) AND HIGH=HHV(HIGH,XA_3+1);
XA_64:=BARSLAST(XA_63);
XA_65:=IF(XA_63,CURRBARSCOUNT,0);
XA_66:=IF(XA_64,REF(HIGH,XA_64),HIGH);
XA_67:=IF(XA_64,REF(XA_65,XA_64),XA_65);
XA_68:=REF(XA_66,XA_64+1);
XA_69:=CONST(XA_67);
XA_70:=REF(XA_67,XA_64+1);
XA_71:=CONST(XA_70);
XA_72:=REF(XA_68,XA_64+1);
XA_73:=IF(CURRBARSCOUNT>XA_44,0,1);
{L压力:DRAWLINE(CURRBARSCOUNT=XA_71,HIGH,CURRBARSCOUNT=XA_69,HIGH,1),COLORYELLOW;}
DRAWLINE(CURRBARSCOUNT=XA_71,HIGH,ISLASTBAR,REF(HIGH,XA_71-1),1),POINTDOT,COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=XA_69,HIGH,ISLASTBAR,REF(HIGH,XA_69-1),1),POINTDOT,COLORYELLOW;

DRAWTEXT(ISLASTBAR,REF(HIGH,XA_71-1),'高3'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,REF(HIGH,XA_69-1),'高1'),COLORYELLOW;


XA_74:=REF(LOW,XA_3)=LLV(LOW,2*XA_3+1);
XA_75:=BACKSET(XA_74,XA_3+1);
XA_76:=FILTER(XA_75,XA_3) AND LOW=LLV(LOW,XA_3+1);
XA_77:=BARSLAST(XA_49);
XA_78:=IF(XA_76,CURRBARSCOUNT,0);
XA_79:=IF(XA_77,REF(LOW,XA_77),LOW);
XA_80:=IF(XA_77,REF(XA_78,XA_77),XA_51);
XA_81:=CONST(XA_80);
XA_82:=REF(XA_79,XA_77+1);
XA_83:=REF(XA_80,XA_26+1);
XA_84:=CONST(XA_83);

附件

tdxjietu1.JPG
查看全部打赏
  • 福阿德+8理想币 +7共享币 : 理想精神:分享,互助,友善,传递正能量!
  • 华仔2888+20理想币 +2共享币 : 谢谢许昌老师解答非常感谢点赞,知识的价值在于分享,谢谢!

举报

点亮(1) 扔鸡蛋(0) 回复

华仔2888
Lv.5
发表于 2020-9-16 13:28 复制 查看全部楼层
本帖最后由 华仔2888 于 2020-9-16 14:07 编辑

谢谢许昌老师解答非常感谢

举报

点亮(1) 扔鸡蛋(0) 回复

您需要登录后才可以回帖 登录

本版积分规则 《理想财富服务协议》《免责声明》

论坛问题
微信扫一扫,添加好友咨询
驿站问题
微信扫一扫,添加好友咨询
广告投放
微信扫一扫,添加好友咨询
回顶部 到页底
快速回复 返回顶部 返回列表