[iC2R]LuckyStarV2

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

  1. //

  2. #property copyright "Copyright ?2012, Choices2Rich.Com"
  3. #property link      "choices2rich@gmail.com"

  4. #property indicator_separate_window
  5. #property indicator_minimum 0.0
  6. #property indicator_maximum 10.0
  7. #property indicator_buffers 8
  8. #property indicator_color1 Yellow
  9. #property indicator_color2 LimeGreen
  10. #property indicator_color3 Red
  11. #property indicator_color4 LimeGreen
  12. #property indicator_color5 Red
  13. #property indicator_color6 LimeGreen
  14. #property indicator_color7 Red
  15. #property indicator_color8 Black

  16. extern int LOWSign = 4;
  17. extern int HIGHSign = 12;
  18. extern int CCIPeriod = 5;
  19. extern int ADXPeriod = 14;
  20. extern bool Sound = TRUE;
  21. extern string Separator = "===================================";
  22. extern string IndicatorName = "LuckyStar";
  23. extern string Version = "V2: CCI+ChannelSignal";
  24. extern string TrendStrength = "ADX";
  25. extern string IndiRecommendedBy = "Mr. Unggul";
  26. extern string LasUpdate = "May 25, 2012";
  27. extern string OriginalAuthor = "Asep Saepudin - Indonesia";
  28. extern string Visit = "http://choices2rich.com";
  29. string gs_160 = "WAITING FOR SINYAL";
  30. int gi_168 = 65535;
  31. bool gi_172 = FALSE;
  32. double g_ibuf_176[];
  33. double g_ibuf_180[];
  34. double g_ibuf_184[];
  35. double g_ibuf_188[];
  36. double g_ibuf_192[];
  37. double g_ibuf_196[];
  38. double g_ibuf_200[];
  39. double g_ibuf_204[];

  40. int init() {
  41.    SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 4);
  42.    SetIndexArrow(0, 212);
  43.    SetIndexBuffer(0, g_ibuf_176);
  44.    SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 4);
  45.    SetIndexArrow(1, 212);
  46.    SetIndexBuffer(1, g_ibuf_180);
  47.    SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 4);
  48.    SetIndexArrow(2, 212);
  49.    SetIndexBuffer(2, g_ibuf_184);
  50.    SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 0);
  51.    SetIndexArrow(3, 234);
  52.    SetIndexBuffer(3, g_ibuf_188);
  53.    SetIndexStyle(4, DRAW_HISTOGRAM, STYLE_SOLID, 0);
  54.    SetIndexArrow(4, 234);
  55.    SetIndexBuffer(4, g_ibuf_192);
  56.    SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, 1);
  57.    SetIndexArrow(5, 171);
  58.    SetIndexBuffer(5, g_ibuf_196);
  59.    SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, 1);
  60.    SetIndexArrow(6, 171);
  61.    SetIndexBuffer(6, g_ibuf_200);
  62.    SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, 1);
  63.    SetIndexArrow(7, 108);
  64.    SetIndexBuffer(7, g_ibuf_204);
  65.    IndicatorShortName("[iC2R]LuckyStarV2 ");
  66.    f0_1();
  67.    return (0);
  68. }

  69. int start() {


  70.    int highest_12;
  71.    int lowest_16;
  72.    int highest_20;
  73.    int lowest_24;
  74.    double icci_28;
  75.    double icci_36;
  76.    double iadx_44;
  77.    double iadx_52;
  78.    double iadx_60;
  79.    double iadx_68;
  80.    bool li_76;
  81.    bool li_80;
  82.    int li_0 = IndicatorCounted();
  83.    if (li_0 < 0) return (-1);
  84.    if (li_0 > 0) li_0--;
  85.    int li_8 = Bars - li_0;
  86.    li_8 = MathMax(li_8, HIGHSign);
  87.    li_8 = MathMax(li_8, LOWSign);
  88.    for (int li_4 = li_8; li_4 >= 0; li_4--) {
  89.       icci_28 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, li_4 + 0);
  90.       icci_36 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, li_4 + 1);
  91.       highest_20 = iHighest(NULL, 0, MODE_HIGH, HIGHSign, li_4 - HIGHSign / 2);
  92.       lowest_24 = iLowest(NULL, 0, MODE_LOW, HIGHSign, li_4 - HIGHSign / 2);
  93.       highest_12 = iHighest(NULL, 0, MODE_HIGH, LOWSign, li_4 - LOWSign / 2);
  94.       lowest_16 = iLowest(NULL, 0, MODE_LOW, LOWSign, li_4 - LOWSign / 2);
  95.       if (li_4 + 0 == lowest_24 || li_4 + 1 == lowest_24 || li_4 + 2 == lowest_24 || li_4 + 3 == lowest_24) g_ibuf_180[li_4] = 4;
  96.       else {
  97.          if (li_4 + 0 == highest_20 || li_4 + 1 == highest_20 || li_4 + 2 == highest_20 || li_4 + 3 == highest_20) g_ibuf_184[li_4] = 4;
  98.          else g_ibuf_176[li_4] = 2;
  99.       }
  100.       iadx_44 = iADX(NULL, 0, ADXPeriod, PRICE_HIGH, MODE_PLUSDI, li_4 + 0);
  101.       iadx_52 = iADX(NULL, 0, ADXPeriod, PRICE_HIGH, MODE_MINUSDI, li_4 + 0);
  102.       iadx_60 = iADX(NULL, 0, ADXPeriod, PRICE_HIGH, MODE_PLUSDI, li_4 + 1);
  103.       iadx_68 = iADX(NULL, 0, ADXPeriod, PRICE_HIGH, MODE_MINUSDI, li_4 + 1);
  104.       li_76 = iadx_44 > iadx_60 && iadx_52 < iadx_68 && g_ibuf_180[li_4] == 4.0;
  105.       li_80 = iadx_52 > iadx_68 && iadx_44 < iadx_60 && g_ibuf_184[li_4] == 4.0;
  106.       if (li_76 && icci_28 > 0.0) g_ibuf_188[li_4] = 6;
  107.       if (li_80 && icci_28 < 0.0) g_ibuf_192[li_4] = 6;
  108.       if (li_76) g_ibuf_196[li_4] = 7;
  109.       if (li_80) g_ibuf_200[li_4] = 7;
  110.       if (g_ibuf_180[li_4] == 4.0 && g_ibuf_188[li_4] == 6.0 && g_ibuf_196[li_4] == 7.0) {
  111.          gs_160 = "BUY SIGNAL";
  112.          gi_168 = 3329330;
  113.          gi_172 = TRUE;
  114.       } else {
  115.          if (g_ibuf_184[li_4] == 4.0 && g_ibuf_192[li_4] == 6.0 && g_ibuf_200[li_4] == 7.0) {
  116.             gs_160 = "SELL SIGNAL";
  117.             gi_168 = 255;
  118.             gi_172 = TRUE;
  119.          } else {
  120.             if (g_ibuf_180[li_4] == 4.0) {
  121.                gs_160 = "BUY TREND";
  122.                gi_168 = 3329330;
  123.                gi_172 = FALSE;
  124.             } else {
  125.                if (g_ibuf_184[li_4] == 4.0) {
  126.                   gs_160 = "SELL TREND";
  127.                   gi_168 = 255;
  128.                   gi_172 = FALSE;
  129.                } else {
  130.                   gs_160 = "WAITING FOR SIGNAL";
  131.                   gi_168 = 65535;
  132.                   gi_172 = FALSE;
  133.                }
  134.             }
  135.          }
  136.       }
  137.    }
  138.    if (Sound == TRUE)
  139.       if (gi_172) PlaySound("entry.wav");
  140.    f0_1();
  141.    RefreshRates();
  142.    return (0);
  143. }

  144. void f0_1() {
  145.    ObjectsDeleteAll(0, OBJ_LABEL);
  146.    f0_0("signc", 5, 5, gs_160, 10, "Arial Bold", gi_168);
  147. }

  148. void f0_0(string a_name_0, int a_x_8, int a_y_12, string a_text_16 = "", int a_fontsize_24 = 42, string a_fontname_28 = "Arial", color a_color_36 = -1) {
  149.    ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0);
  150.    ObjectSet(a_name_0, OBJPROP_CORNER, 3);
  151.    ObjectSet(a_name_0, OBJPROP_COLOR, a_color_36);
  152.    ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_8);
  153.    ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_12);
  154.    ObjectSetText(a_name_0, a_text_16, a_fontsize_24, a_fontname_28, a_color_36);
  155. }
打赏