MBFX Timing

楼主  收藏   举报   帖子创建时间:  2019-05-05 05:06 回复:0 关注量:359
GBPUSDH1.png


  1. #property copyright "MBFX Timing"
  2. #property link      "finger"

  3. #property indicator_separate_window
  4. #property indicator_minimum 0.0
  5. #property indicator_maximum 100.0
  6. #property indicator_buffers 3
  7. #property indicator_color1 Yellow
  8. #property indicator_color2 Green
  9. #property indicator_color3 Orange
  10. #property indicator_width1 2
  11. #property indicator_level1 70.0
  12. #property indicator_width2 2
  13. #property indicator_level2 30.0
  14. #property indicator_width3 2
  15. #property indicator_level3 50.0

  16. extern int Len = 7;
  17. extern double Filter = 0.0;
  18. double g_ibuf_88[];
  19. double g_ibuf_92[];
  20. double g_ibuf_96[];

  21. int init() {
  22.    IndicatorShortName("MBFX Timing Indicator");
  23.    SetIndexStyle(0, DRAW_LINE);
  24.    SetIndexBuffer(0, g_ibuf_88);
  25.    SetIndexStyle(1, DRAW_LINE);
  26.    SetIndexBuffer(1, g_ibuf_92);
  27.    SetIndexStyle(2, DRAW_LINE);
  28.    SetIndexBuffer(2, g_ibuf_96);
  29.    return (0);
  30. }

  31. int deinit() {
  32.    return (0);
  33. }

  34. int start() {
  35.    double ld_0;
  36.    double ld_8;
  37.    double ld_16;
  38.    double ld_24;
  39.    double ld_32;
  40.    double ld_40;
  41.    double ld_48;
  42.    double ld_56;
  43.    double ld_64;
  44.    double ld_72;
  45.    double ld_80;
  46.    double ld_88;
  47.    double ld_96;
  48.    double ld_104;
  49.    double ld_112;
  50.    double ld_120;
  51.    double ld_128;
  52.    double ld_136;
  53.    double ld_144;
  54.    double ld_152;
  55.    double ld_160;
  56.    double ld_168;
  57.    double ld_176;
  58.    double ld_184;
  59.    double ld_192;
  60.    double ld_200;
  61.    double ld_208;
  62.    double ld_216 = Bars - Len - 1;
  63.    for (int li_224 = ld_216; li_224 >= 0; li_224--) {
  64.       if (ld_8 == 0.0) {
  65.          ld_8 = 1.0;
  66.          ld_16 = 0.0;
  67.          if (Len - 1 >= 5) ld_0 = Len - 1.0;
  68.          else ld_0 = 5.0;
  69.          ld_80 = 100.0 * ((High[li_224] + Low[li_224] + Close[li_224]) / 3.0);
  70.          ld_96 = 3.0 / (Len + 2.0);
  71.          ld_104 = 1.0 - ld_96;
  72.       } else {
  73.          if (ld_0 <= ld_8) ld_8 = ld_0 + 1.0;
  74.          else ld_8 += 1.0;
  75.          ld_88 = ld_80;
  76.          ld_80 = 100.0 * ((High[li_224] + Low[li_224] + Close[li_224]) / 3.0);
  77.          ld_32 = ld_80 - ld_88;
  78.          ld_112 = ld_104 * ld_112 + ld_96 * ld_32;
  79.          ld_120 = ld_96 * ld_112 + ld_104 * ld_120;
  80.          ld_40 = 1.5 * ld_112 - ld_120 / 2.0;
  81.          ld_128 = ld_104 * ld_128 + ld_96 * ld_40;
  82.          ld_208 = ld_96 * ld_128 + ld_104 * ld_208;
  83.          ld_48 = 1.5 * ld_128 - ld_208 / 2.0;
  84.          ld_136 = ld_104 * ld_136 + ld_96 * ld_48;
  85.          ld_152 = ld_96 * ld_136 + ld_104 * ld_152;
  86.          ld_56 = 1.5 * ld_136 - ld_152 / 2.0;
  87.          ld_160 = ld_104 * ld_160 + ld_96 * MathAbs(ld_32);
  88.          ld_168 = ld_96 * ld_160 + ld_104 * ld_168;
  89.          ld_64 = 1.5 * ld_160 - ld_168 / 2.0;
  90.          ld_176 = ld_104 * ld_176 + ld_96 * ld_64;
  91.          ld_184 = ld_96 * ld_176 + ld_104 * ld_184;
  92.          ld_144 = 1.5 * ld_176 - ld_184 / 2.0;
  93.          ld_192 = ld_104 * ld_192 + ld_96 * ld_144;
  94.          ld_200 = ld_96 * ld_192 + ld_104 * ld_200;
  95.          ld_72 = 1.5 * ld_192 - ld_200 / 2.0;
  96.          if (ld_0 >= ld_8 && ld_80 != ld_88) ld_16 = 1.0;
  97.          if (ld_0 == ld_8 && ld_16 == 0.0) ld_8 = 0.0;
  98.       }
  99.       if (ld_0 < ld_8 && ld_72 > 0.0000000001) {
  100.          ld_24 = 50.0 * (ld_56 / ld_72 + 1.0);
  101.          if (ld_24 > 100.0) ld_24 = 100.0;
  102.          if (ld_24 < 0.0) ld_24 = 0.0;
  103.       } else ld_24 = 50.0;
  104.       g_ibuf_88[li_224] = ld_24;
  105.       g_ibuf_92[li_224] = ld_24;
  106.       g_ibuf_96[li_224] = ld_24;
  107.       if (g_ibuf_88[li_224] > g_ibuf_88[li_224 + 1] - Filter) g_ibuf_96[li_224] = EMPTY_VALUE;
  108.       else {
  109.          if (g_ibuf_88[li_224] < g_ibuf_88[li_224 + 1] + Filter) g_ibuf_92[li_224] = EMPTY_VALUE;
  110.          else {
  111.             if (g_ibuf_88[li_224] == g_ibuf_88[li_224 + 1] + Filter) {
  112.                g_ibuf_92[li_224] = EMPTY_VALUE;
  113.                g_ibuf_96[li_224] = EMPTY_VALUE;
  114.             }
  115.          }
  116.       }
  117.    }
  118.    return (0);
  119. }
打赏