请高手来帮我翻译神奇指标的意思,实在是搞不定了

楼主  收藏   举报   帖子创建时间:  2019-05-05 15:20 回复:0 关注量:958
请高手来帮我翻译神奇指标的意思,我翻译到一半,实在是搞不定了,请高手帮帮忙,附代码
  1. #property copyright "Copyright ?2006, TrendLaboratory Ltd."
  2. #property link "http://finance.groups.yahoo.com/group/TrendLaboratory"


  3. #property indicator_separate_window
  4. #property indicator_minimum 0.0
  5. #property indicator_buffers 6
  6. #property indicator_color1 Black
  7. #property indicator_color2 Black
  8. #property indicator_color3 Black
  9. #property indicator_color4 Black
  10. #property indicator_color5 RoyalBlue
  11. #property indicator_color6 Red


  12. extern int Length = 20;
  13. extern int Deviation = 1;
  14. extern double MoneyRisk = 1.0;
  15. extern int Signal = 1;
  16. extern int Line = 1;
  17. extern int Nbars = 1000;
  18. double shuzu1[];
  19. double shuzu2[];
  20. double shuzu3[];
  21. double shuzu4[];
  22. double shuzu5[];
  23. double shuzu6[];
  24. extern bool SoundON = TRUE;
  25. bool gi_132 = FALSE;
  26. bool gi_136 = FALSE;


  27. int init() {
  28. SetIndexBuffer(0, shuzu1);
  29. SetIndexBuffer(1, shuzu2);
  30. SetIndexBuffer(2, shuzu3);
  31. SetIndexBuffer(3, shuzu4);
  32. SetIndexBuffer(4, shuzu5);
  33. SetIndexBuffer(5, shuzu6);
  34. SetIndexStyle(0, DRAW_NONE);
  35. SetIndexStyle(1, DRAW_NONE);
  36. SetIndexStyle(2, DRAW_NONE);
  37. SetIndexStyle(3, DRAW_NONE);
  38. SetIndexStyle(4, DRAW_HISTOGRAM);
  39. SetIndexStyle(5, DRAW_HISTOGRAM);
  40. IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
  41. string ls_0 = "波段之星";
  42. IndicatorShortName(ls_0);
  43. SetIndexLabel(0, "UpTrend Stop");
  44. SetIndexLabel(1, "DownTrend Stop");
  45. SetIndexLabel(2, "UpTrend Signal");
  46. SetIndexLabel(3, "DownTrend Signal");
  47. SetIndexLabel(4, "UpTrend Line");
  48. SetIndexLabel(5, "DownTrend Line");
  49. SetIndexDrawBegin(0, Length);
  50. SetIndexDrawBegin(1, Length);
  51. SetIndexDrawBegin(2, Length);
  52. SetIndexDrawBegin(3, Length);
  53. SetIndexDrawBegin(4, Length);
  54. SetIndexDrawBegin(5, Length);
  55. return (0);
  56. }


  57. int start() {
  58. int aa;
  59. double id1[25000];
  60. double id2[25000];
  61. double id3[25000];
  62. double id4[25000];
  63. for (int i = Nbars; i >= 0; i--) {
  64. shuzu1[i] = 0;
  65. shuzu2[i] = 0;
  66. shuzu3[i] = 0;
  67. shuzu4[i] = 0;
  68. shuzu5[i] = EMPTY_VALUE;
  69. shuzu6[i] = EMPTY_VALUE;
  70. }
  71. for (i = Nbars - Length - 1; i >= 0; i--) {
  72. id1[i] = iBands(NULL, 0, Length, Deviation, 0, PRICE_CLOSE, MODE_UPPER, i);
  73. id2[i] = iBands(NULL, 0, Length, Deviation, 0, PRICE_CLOSE, MODE_LOWER, i);
  74. if (Close[i] > id1[i + 1]) aa = 1; //close[i]大于上根的UPER价 aa =1
  75. if (Close[i] < id2[i + 1]) aa = -1; //close[i]小于上根的LOWER价 aa=-1


  76. if (aa < 0 && id1[i] > id1[i + 1]) id1[i] = id1[i + 1]; //close[i]小于上根的LOWER价 且本根uper价
  77. //大于上根uper价 则本根uper价=上根uper价
  78. if (aa > 0 && id2[i] < id2[i + 1]) id2[i] = id2[i + 1]; //如果aa>0且本根LOWER价小于上根LOWER价
  79. //则本根lower价==上根lower价
  80. id3[i] = id1[i] + (MoneyRisk - 1.0) / 2.0 * (id1[i] - id2[i]); //id3[i]=id1[i]
  81. id4[i] = id2[i] - (MoneyRisk - 1.0) / 2.0 * (id1[i] - id2[i]); //id4[i]=id2[i]
  82. if (aa < 0 && id3[i] > id3[i + 1]) id3[i] = id3[i + 1]; //如果close[i]<lower[i+1]且uper[i]>uper[i+1]
  83. // id1[i]=id1[i+1]
  84. if (aa > 0 && id4[i] < id4[i + 1]) id4[i] = id4[i + 1]; //
  85. if (aa > 0) {
  86. if (Signal > 0 && shuzu1[i + 1] == -1.0) { //这里我始终不明白,这个shuzu[]在定议之后没有赋值就可以直接调用吗?
  87. shuzu3[i] = id4[i];
  88. shuzu1[i] = id4[i];
  89. if (Line > 0) shuzu5[i] = id4[i];
  90. if (SoundON == TRUE && i == 0 && !gi_132) {
  91. alert("alert!!! BUY..Major on ", Symbol(), "-", Period());
  92. gi_132 = TRUE;
  93. gi_136 = FALSE;
  94. }
  95. } else {
  96. shuzu1[i] = id4[i];
  97. if (Line > 0) shuzu5[i] = id4[i];
  98. shuzu3[i] = -1;
  99. }
  100. if (Signal == 2) shuzu1[i] = 0;
  101. shuzu4[i] = -1;
  102. shuzu2[i] = -1.0;
  103. shuzu6[i] = EMPTY_VALUE;
  104. }
  105. if (aa < 0) {
  106. if (Signal > 0 && shuzu2[i + 1] == -1.0) {
  107. shuzu4[i] = id3[i];
  108. shuzu2[i] = id3[i];
  109. if (Line > 0) shuzu6[i] = id3[i];
  110. if (SoundON == TRUE && i == 0 && !gi_136) {
  111. alert("alert!!! SELL..Major on ", Symbol(), "-", Period());
  112. gi_136 = TRUE;
  113. gi_132 = FALSE;
  114. }
  115. } else {
  116. shuzu2[i] = id3[i];
  117. if (Line > 0) shuzu6[i] = id3[i];
  118. shuzu4[i] = -1;
  119. }
  120. if (Signal == 2) shuzu2[i] = 0;
  121. shuzu3[i] = -1;
  122. shuzu1[i] = -1.0;
  123. shuzu5[i] = EMPTY_VALUE;
  124. }
  125. }
  126. return (0);
  127. }


  128. 请高手帮我翻译翻译
打赏