请选择 进入手机版 | 继续访问电脑版
返回顶部
开启左侧

[通达信] 线性回归主图指标

[复制链接]
龙生九子Lv.9 显示全部楼层 发表于 2019-9-3 13:27:28 |阅读模式 打印 上一主题 下一主题
QQ图片20190903132724.png
  1. EM01:=EMA(C,10);
  2. EM:=EMA(C,21);
  3. UP:=EMA(EM,13);
  4. DOWN:=EMA(EM,17);
  5. MIDD:(UP+DOWN)/2,POINTDOT;
  6. STICKLINE(MIDD>REF(MIDD,1),UP,DOWN,1,0),COLORMAGENTA;
  7. STICKLINE(MIDD<REF(MIDD,1),UP,DOWN,1,0),COLORGREEN;
  8. STICKLINE(MIDD=REF(MIDD,1),UP,DOWN,1,0),COLORGRAY;
  9. 止盈线:EMA(EMA(C,10),10),COLORYELLOW,LINETHICK1;
  10. 空止盈:=止盈线>REF(止盈线,1);
  11. IF(空止盈-1,止盈线,DRAWNULL),COLORCYAN,LINETHICK1;
  12. DRAWICON(REF(MIDD,1)<=REF(MIDD,2) AND MIDD>REF(MIDD,1),DOWN,7);
  13. DRAWICON(REF(MIDD,1)>=REF(MIDD,2) AND MIDD<REF(MIDD,1),UP,8);
  14. {线性回归画线}
  15. UR:=15;LR:=15;{可调}
  16. TC1:=IF(C=HHV(C,5*UR),C,DRAWNULL);
  17. TC2:=CONST(BARSLAST(TC1=C))+1;
  18. BC1:=IF(L=LLV(L,5*LR),L,DRAWNULL);
  19. BC2:=CONST(BARSLAST(BC1=L))+1;
  20. NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));
  21. LR1:=FORCAST(C,NOD+1);
  22. NP:=IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MIN(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLOR93BDA8;
  23. LR2:=SLOPE(C,NOD+1);
  24. LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));
  25. FP:=NP-LR3*(NOD),POINTDOT,COLOR93BDA8;
  26. AD:=ABS(NP-FP);
  27. DBL:=BARSLAST(BC1!=DRAWNULL)+1;
  28. DBH:=BARSLAST(TC1!=DRAWNULL)+1;
  29. BSP:=IF(BC2>TC2,DBL,DBH)-1;
  30. LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);
  31. AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND C>LRL,C,LRL);
  32. AT2:=HHV(AT1-LRL,MAX(BC2,TC2));
  33. AT3:=CONST(BARSLAST(AT1-LRL=AT2));
  34. AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));
  35. ATL:=LRL+AT5;
  36. UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L<LRL,L,LRL);
  37. UT2:=HHV(LRL-UT1,MAX(BC2,TC2));
  38. UT3:=CONST(BARSLAST(LRL-UT1=UT2));
  39. UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));
  40. UTL:=LRL-UT5;
  41. RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,ATL,CONST(REF(ATL,MIN(BC2,TC2)-11)));
  42. RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,UTL,CONST(REF(UTL,MIN(BC2,TC2)-11)));
  43. 中轨:=IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),COLORLICYAN;
  44. 上轨12:IF(NP>FP,IF(ATL<=RH,ATL,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),COLORLICYAN;
  45. 下轨12:IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL>=RL,UTL,DRAWNULL)),COLORLICYAN;
  46. IF(NP>FP,IF(LRL-UTL<ATL-LRL,LRL*2-UTL,IF(ATL-LRL<LRL-UTL,LRL-(ATL-LRL),DRAWNULL)),IF(LRL-UTL<ATL-LRL,LRL*2-UTL,IF(ATL-LRL<LRL-UTL,LRL-(ATL-LRL),DRAWNULL))),DOTLINE,COLORLICYAN;
  47. URA:=5;LRA:=5;{可调}
  48. TC1A:=IF(C=HHV(C,5*URA),C,DRAWNULL);
  49. TC2A:=CONST(BARSLAST(TC1A=C))+1;
  50. BC1A:=IF(L=LLV(L,5*LRA),L,DRAWNULL);
  51. BC2A:=CONST(BARSLAST(BC1A=L))+1;
  52. NODA:=(IF(TC2A>BC2A,TC2A,BC2A)-IF(TC2A>BC2A,BC2A,TC2A));
  53. LR1A:=FORCAST(C,NODA+1);
  54. NPA:=IF(CURRBARSCOUNT<=MAX(BC2A,TC2A),CONST(IF(MIN(TC2A,BC2A)=1,LR1A,REF(LR1A,MIN(TC2A,BC2A)-1))),DRAWNULL),POINTDOT,COLOR93BDA8;
  55. LR2A:=SLOPE(C,NODA+1);
  56. LR3A:=CONST(IF(MIN(TC2A,BC2A)=1,LR2A,REF(LR2A,MIN(TC2A,BC2A)-1)));
  57. FPA:=NPA-LR3A*(NODA),POINTDOT,COLOR93BDA8;
  58. ADA:=ABS(NPA-FPA);
  59. DBLA:=BARSLAST(BC1A!=DRAWNULL)+1;
  60. DBHA:=BARSLAST(TC1A!=DRAWNULL)+1;
  61. BSPA:=IF(BC2A>TC2A,DBLA,DBHA)-1;
  62. LRLA:=IF(NPA>FPA,FPA+ADA/NODA*BSPA,FPA-ADA/NODA*BSPA);
  63. AT1A:=IF(BETWEEN(CURRBARSCOUNT,BC2A,TC2A) AND C>LRLA,C,LRLA);
  64. AT2A:=HHV(AT1A-LRLA,MAX(BC2A,TC2A));
  65. AT3A:=CONST(BARSLAST(AT1A-LRLA=AT2A));
  66. AT5A:=CONST(IF(AT3A=0,AT1A-LRLA,REF(AT1A-LRLA,AT3A)));
  67. ATLA:=LRLA+AT5A;
  68. UT1A:=IF(BETWEEN(CURRBARSCOUNT,BC2A,TC2A) AND L<LRLA,L,LRLA);
  69. UT2A:=HHV(LRLA-UT1A,MAX(BC2A,TC2A));
  70. UT3A:=CONST(BARSLAST(LRLA-UT1A=UT2A));
  71. UT5A:=CONST(IF(UT3A=0,LRLA-UT1A,REF(LRLA-UT1A,UT3A)));
  72. UTLA:=LRLA-UT5A;
  73. RHA:=IF(CURRBARSCOUNT>=MIN(BC2A,TC2A)-10,ATLA,CONST(REF(ATLA,MIN(BC2A,TC2A)-11)));
  74. RLA:=IF(CURRBARSCOUNT>=MIN(BC2A,TC2A)-10,UTLA,CONST(REF(UTLA,MIN(BC2A,TC2)-11)));
  75. 中轨A:=IF(NPA>FPA,IF(LRLA<=RHA,LRLA,DRAWNULL),IF(LRLA>=RLA,LRLA,DRAWNULL)),COLOR628962;
  76. 上轨12A:IF(NPA>FPA,IF(ATLA<=RHA,ATLA,DRAWNULL),IF(ATLA>=RLA,ATLA,DRAWNULL)),COLORWHITE;
  77. 下轨12A:IF(NPA>FPA,IF(UTLA<=RHA,UTLA,DRAWNULL),IF(UTLA>=RLA,UTLA,DRAWNULL)),COLORWHITE;
  78. IF(NPA>FPA,IF(LRLA-UTLA<ATLA-LRLA,LRLA*2-UTLA,IF(ATLA-LRLA<LRLA-UTLA,LRLA-(ATLA-LRLA),DRAWNULL)),IF(LRLA-UTLA<ATLA-LRLA,LRLA*2-UTLA,IF(ATLA-LRLA<LRLA-UTLA,LRLA-(ATLA-LRLA),DRAWNULL))),DOTLINE,COLORWHITE;
复制代码


在投机里最难的任务不是预测,而是自我控制。成功的交易是艰难和令人烦恼的交易。在成功的等式里,你是最重要的因素。
回复

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

高手社区 成立于2018年8月,是目前国内优秀的金融交易技术社区,拥有众多优秀分析师专家,形成了由期货分析软件、期货指标、外汇指标、股票指标、金融行情讨论区等几大频道内容,为交易者提供了一个发现、使用、并交流交易平台。
  • 官方手机版

  • 微信公众号

  • 商务合作

  • Powered by Discuz! X3.4 | Copyright © 2001-2020, Tencent Cloud. | 高手社区
  • 鲁ICP备20004638号-9 | |高手社区|鲁ICP备19001237号-21|鲁公网安备 4236902302000354号 QQ