: | : | :期货量化学习 | :期货量化 |
返回列表 发帖

{优化整合指标公式}【主图指标公式 公式、源码 演示图】[大智慧公式]

{优化整合指标公式}【主图指标公式 公式、源码 演示图】[大智慧公式]

  1. INPUT:K1(2011,1990,3000),K2(1,1,12),K3(1,1,31),DX(0,0,2),FA(0,0,5),P1(5,0,255),P2(10,0,255),P3(20,0,255),P4(0,0,255),P5(0,0,255);
  2. AS:=(o+h+l+c)/4;
  3. MMA5:EMA(AS,P1);
  4. SYAA:EMA(AS,P2);
  5. SYAB:EMA(AS,P3);{
  6. SYAC:EMA(AS,P4);
  7. SYAD:EMA(AS,P5);}

  8. RQD:=(K1-1900)*10000+K2*100+K3;
  9. DJ:REF(L,BARSLAST(DATE<=RQD )),LINETHICK0,COLOR55BB55;
  10. 上涨:=BARSSINCE(BACKSET(BARSTATUS=2,BARSLAST(L=DJ)+1));
  11. STICKLINE(C>=O,C,O,8,0),COLOR0000FF,LAYER4;
  12. STICKLINE(C>=O,H,L,0,0),COLOR0000FF,LAYER4;
  13. STICKLINE(C<=O,C,O,8,0),COLORFFFF00,LAYER4;
  14. STICKLINE(C<=O,H,L,0,0),COLORFFFF00,LAYER4;
  15. DRAWTEXT(上涨=0 AND FA>=1,DJ,'1'),COLORFFFFFF,VALIGN1;
  16. DRAWTEXT(上涨=1 AND FA>=1,DJ,'2'),COLORFFFFFF,VALIGN1;
  17. DRAWTEXT(上涨=2 AND FA>=1,DJ,'3'),COLORFFFFFF,VALIGN1;
  18. DRAWTEXT(上涨=3 AND FA>=1,DJ,'4'),COLORFFFFFF,VALIGN1;
  19. DRAWTEXT(上涨=4 AND FA>=1,DJ,'5'),COLORFFFFFF,VALIGN1;
  20. DRAWTEXT(上涨=5 AND FA>=1,DJ,'6'),COLORFFFFFF,VALIGN1;
  21. DRAWTEXT(上涨=6 AND FA>=1,DJ,'7'),COLORFFFFFF,VALIGN1;
  22. DRAWTEXT(上涨=7 AND FA>=1,DJ,'8'),COLORFFFFFF,VALIGN1;
  23. DRAWTEXT(上涨=8 AND FA>=1,DJ,'9'),COLORFFFFFF,VALIGN1;
  24. DRAWTEXT(上涨=9 AND FA>=1,DJ,'10'),COLORFFFFFF,VALIGN1;

  25. 阳涨幅:=3.5;
  26. 阳倍量:=1.9;
  27. 单阳收:=C;
  28. 单阳开:=O;
  29. 单阳:=单阳收>=REF(C,1)*(1+阳涨幅/100)AND VOL>REF(VOL,1)*阳倍量;
  30. DRAWTEXT(BARSTATUS=0 AND 单阳,L,'阳'),COLOR00FFFF,VALIGN1;
  31. 高不破价:=REF(C,BARSLAST(单阳));
  32. 低不破价:=REF(L,BARSLAST(单阳));
  33. 单阳不破:=BARSTATUS=0 AND BARSLAST(单阳)<11 AND (LLV(L,BARSLAST(单阳))>低不破价 OR LLV(L,BARSLAST(单阳))=低不破价);
  34. STICKLINE(单阳不破,低不破价-低不破价*0.0005,低不破价,11,0),COLORGREEN;
  35. STICKLINE(单阳不破,高不破价,高不破价,11,0),COLORRED;
  36. STICKLINE(单阳,单阳开,单阳收,6,0),COLORYELLOW;
  37. QKB:=IF(C>O,O,C);
  38. QKAB:=IF(C>O,O+(C-O)*0.75,O+(C-O)*0.75);
  39. STICKLINE(BARSTATUS=0 AND 单阳,QKB,QKAB,6,0),COLORFF2693;
  40. 实体幅度2:=REF((O+(C-O)*0.667),BARSLAST(单阳));{//当日实体幅度的2/3}
  41. 实体幅度1:=REF((O+(C-O)*0.333),BARSLAST(单阳));{//当日实体幅度的1/3}
  42. 幅度的1二:=REF((L+(H-L)/2),BARSLAST(单阳));{//当日幅度的1/2}
  43. STICKLINE(单阳不破,幅度的1二,幅度的1二,8,1),COLOR209FFF,DOTLINE;
  44. STICKLINE(单阳不破,实体幅度2,实体幅度2,11,1),COLORFFFF00,DOTLINE;
  45. STICKLINE(单阳不破,实体幅度1,实体幅度1,11,1),COLORFFFF00,DOTLINE;
  46. DRAWTEXT(BARSLAST(单阳)=1 AND 单阳不破,低不破价,'1'),COLORGREEN;
  47. DRAWTEXT(BARSLAST(单阳)=2 AND 单阳不破,低不破价,'2'),COLORGREEN;
  48. DRAWTEXT(BARSLAST(单阳)=3 AND 单阳不破,低不破价,'3'),COLORGREEN;
  49. DRAWTEXT(BARSLAST(单阳)=4 AND 单阳不破,低不破价,'4'),COLORGREEN;
  50. DRAWTEXT(BARSLAST(单阳)=5 AND 单阳不破,低不破价,'5'),COLORGREEN;
  51. DRAWTEXT(BARSLAST(单阳)=6 AND 单阳不破,低不破价,'6'),COLORGREEN;
  52. DRAWTEXT(BARSLAST(单阳)=7 AND 单阳不破,低不破价,'7'),COLORGREEN;
  53. DRAWTEXT(BARSLAST(单阳)=8 AND 单阳不破,低不破价,'8'),COLORGREEN;
  54. DRAWTEXT(BARSLAST(单阳)=9 AND 单阳不破,低不破价,'9'),COLORGREEN;
  55. DRAWTEXT(BARSLAST(单阳)=10 AND 单阳不破,低不破价,'10'),COLORGREEN;
  56. {一阳穿三线}
  57. MA2:=EMA(C,2);
  58. MA5:=EMA(C,5);
  59. MA13:=EMA(C,13);
  60. MA34:=EMA(C,34);
  61. MA55:=EMA(C,55);
  62. YCX:=MA5>=REF(MA5,1);
  63. H1:=MAX(MAX(MA5,MA13),MA34);
  64. L1:=MIN(MIN(MA5,MA13),MA34);
  65. QK:=IF(C>O,O,C);
  66. QKA:=IF(C>O,O+(C-O)*0.35,O+(C-O)*0.25);
  67. 一阳穿三线:= H1<C AND O<L1 AND YCX AND MA2>REF(MA2,1);
  68. STICKLINE(一阳穿三线,QK,QKA,6,0),COLORYELLOW;
  69. STICKLINE(C=C AND fa>=1,O+((C-O)*0.667),(O+(C-O)*0.667),4,0),COLORFF0000,LINETHICK1;{//当日实体幅度的2/3}
  70. STICKLINE(C=C AND fa>=1,O+((C-O)*0.333),(O+(C-O)*0.333),4,0),COLORFF0000,LINETHICK1;{//当日实体幅度的1/3}
  71. STICKLINE(C=C AND fa>=1,O+((C-O)/2),(O+(C-O)/2),5,0),COLOR00FFFF,LINETHICK1;{//当日实体幅度的1/2}
  72. STICKLINE(C=C AND fa>=1,L+((H-L)/2),(L+(H-L)/2),6,0),COLOR208FFF,LINETHICK1;{//当日幅度的1/2}
  73. STICKLINE(C=C AND fa>=1,IF(C>O,H-((H-C)/2),H-((H-O)/2)),IF(C>O,H-((H-C)/2),H-((H-O)/2)),1.3,0),COLORYELLOW,LINETHICK1;{//当日上影线幅度的1/2}
  74. STICKLINE(C=C AND fa>=1,IF(C<O,L+((C-L)/2),L+((O-L)/2)),IF(C<O,L+((C-L)/2),L+((O-L)/2)),1.3,0),COLORYELLOW,LINETHICK1;{//当日下影线幅度的1/2};
  75. AJ:=AMOUNT/(VOL*100);
  76. DRAWTEXT(C=C AND fa=3,AJ,'←'),COLORFF5f00;
  77. z3:=C=HHV(C,6);
  78. Z9:=C=LLV(C,6);
  79. Z4:=BARSLAST(Z3);
  80. Z5:=BARSLAST(Z9);
  81. STICKLINE(C>0 AND fa=2,REF(C,Z4)*1.005,REF(C,Z4)*1.005,7,0),COLORFFFF00,DOTLINE;
  82. STICKLINE(C>0 AND fa=2,REF(C,Z5)*0.995,REF(C,Z5)*0.995,7,0),COLORFF00FF,DOTLINE;
  83. LC := REF(CLOSE,1);
  84. RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
  85. DRAWICON(RSI1>76,H,12),VALIGN1,ALIGN1;
  86. DRAWICON(RSI1>80,H,13),VALIGN0,ALIGN1;
  87. BL:=EMA(AS,17);
  88. BLS:=BL+2.58*STDP(C,20);
  89. BL2:=BL+1.96*STDP(C,20);
  90. DRAWICON(CROSS(H,BLS),H,8),VALIGN1,ALIGN1;
  91. DRAWICON(CROSS(H,BL2),H,6),VALIGN2,ALIGN1;
  92. Q1:=DJ * 1.03;
  93. Q2:=DJ * 1.05;
  94. Q3:=DJ * 1.08;
  95. Q4:=DJ * 1.13;
  96. Q5:=DJ * 1.18;
  97. Q6:=DJ * 1.25;
  98. Q7:=DJ * 1.33;
  99. I1:=0;
  100. flag1:=0;
  101. while I1<BARSLAST(DISPSTATUS=1)-BARSLAST(DISPSTATUS=2)
  102. DO
  103. IF REF(Q1,I1)<REF(Q1,I1+1) AND REF(Q1,I1+1)>Q1
  104. THEN BEGIN FLAG1:=1;
  105. S1:=I1;
  106. I1:=BARSLAST(DISPSTATUS=1);
  107. END
  108. ELSE I1:=I1+1;
  109. STICKLINE(FLAG1 AND DX>=1,REF(Q1,S1),DJ,(s1+1)*20,0),Color551155,ALIGN1,LAYER5;
  110. STICKLINE(FLAG1 AND DX>=1,REF(Q1,S1),Q2,(s1+1)*20,0),Color444444,ALIGN1,LAYER5;
  111. STICKLINE(FLAG1 AND DX>=1,REF(Q2,S1),Q3,(s1+1)*20,0),Color666666,ALIGN1,LAYER5;
  112. STICKLINE(FLAG1 AND DX>=1,REF(Q3,S1),Q4,(s1+1)*20,0),Color777777,ALIGN1,LAYER5;
  113. STICKLINE(FLAG1 AND DX>=1,REF(Q4,S1),Q5,(s1+1)*20,0),Color665506,ALIGN1,LAYER5;
  114. STICKLINE(FLAG1 AND DX>=2,REF(Q5,S1),Q6,(s1+1)*20,0),Color777000,ALIGN1,LAYER5;
  115. DRAWTEXT(上涨=0 AND DX>=1,DJ*1.003,''+''+NUMTOSTRN(DJ,2)),COLORYELLOW,align2;
  116. DRAWTEXT(上涨=0 AND DX>=1,Q1,'3%'+'-'+NUMTOSTRN(Q1,2)),COLORYELLOW,align2;
  117. DRAWTEXT(上涨=0 AND DX>=1,Q2,'5%'+'-'+NUMTOSTRN(Q2,2)),COLORYELLOW,align2;
  118. DRAWTEXT(上涨=0 AND DX>=1,Q3,'8%'+'-'+NUMTOSTRN(Q3,2)),COLORYELLOW,align2;
  119. DRAWTEXT(上涨=0 AND DX>=1,Q4,'13%'+'-'+NUMTOSTRN(Q4,2)),COLORYELLOW,align2;
  120. DRAWTEXT(上涨=0 AND DX>=1,Q5,'18%'+'-'+NUMTOSTRN(Q5,2)),COLORYELLOW,align2;
  121. DRAWTEXT(上涨=0 AND DX>=2,Q6,'25%'+'-'+NUMTOSTRN(Q6,2)),COLORYELLOW,align2;
  122. {添加参数精灵
  123. {--------显示年月日低点日期--------}
  124. 调整年 Param#1 显示年度
  125. 调整月 Param#2 显示月份
  126. 调整日 Param#3 显示日期
  127. --------参数=1显示低点水平线------
  128. 参数=2--4 Param#4 显示涨幅幅度线
  129. 参数=0--2 Param#5 显示K线幅度线
  130. --------显示均价线--------
  131. P1计算 Param#6 任意均价线;
  132. P2计算 Param#7 任意均价线;
  133. P3计算 Param#8 任意均价线;
  134. P4计算 Param#9 任意均价线;
  135. P5计算 Param#10 任意均价线;
复制代码

论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
 
期货论坛 - 版权/免责声明   1.本站发布源码(包括函数、指标、策略等)均属开放源码,用意在于让使用者学习程序化语法撰写,使用者可以任意修改语法內容并调整参数。仅限用于个人学习使用,请勿转载、滥用,严禁私自连接实盘账户交易
  2.本站发布资讯(包括文章、视频、历史记录、教材、评论、资讯、交易方案等)均系转载自网络主流媒体,内容仅为作者当日个人观点,本网转载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。本网不对该类信息或数据做任何保证。不对您构成任何投资建议,不能依靠信息而取代自身独立判断,不对因使用本篇文章所诉信息或观点等导致的损失承担任何责任。
  3.本站发布资源(包括书籍、杂志、文档、软件等)均从互联网搜索而来,仅供个人免费交流学习,不可用作商业用途,本站不对显示的内容承担任何责任。请在下载后24小时内删除。如果喜欢,请购买正版,谢谢合作!
  4.龙听期货论坛原创文章属本网版权作品,转载须注明来源“龙听期货论坛”,违者本网将保留追究其相关法律责任的权力。本论坛除发布原创文章外,亦致力于优秀财经文章的交流分享,部分文章推送时若未能及时与原作者取得联系并涉及版权问题时,请及时联系删除。联系方式:http://www.qhlt.cn/thread-262-1-1.html
如何访问权限为100/255贴子:/thread-37840-1-1.html;注册后仍无法回复:/thread-23-1-1.html;微信/QQ群:/thread-262-1-1.html;网盘链接失效解决办法:/thread-93307-1-1.html

微信截图_20190103142155.png
如何访问权限为100/255贴子:/thread-37840-1-1.html;注册后仍无法回复:/thread-23-1-1.html;微信/QQ群:/thread-262-1-1.html;网盘链接失效解决办法:/thread-93307-1-1.html

TOP

返回列表