admin 发表于 2018-1-22 14:48:21

[iC2R]LuckyStarV2



//

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

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 10.0
#property indicator_buffers 8
#property indicator_color1 Yellow
#property indicator_color2 LimeGreen
#property indicator_color3 Red
#property indicator_color4 LimeGreen
#property indicator_color5 Red
#property indicator_color6 LimeGreen
#property indicator_color7 Red
#property indicator_color8 Black

extern int LOWSign = 4;
extern int HIGHSign = 12;
extern int CCIPeriod = 5;
extern int ADXPeriod = 14;
extern bool Sound = TRUE;
extern string Separator = "===================================";
extern string IndicatorName = "LuckyStar";
extern string Version = "V2: CCI+ChannelSignal";
extern string TrendStrength = "ADX";
extern string IndiRecommendedBy = "Mr. Unggul";
extern string LasUpdate = "May 25, 2012";
extern string OriginalAuthor = "Asep Saepudin - Indonesia";
extern string Visit = "http://choices2rich.com";
string gs_160 = "WAITING FOR SINYAL";
int gi_168 = 65535;
bool gi_172 = FALSE;
double g_ibuf_176[];
double g_ibuf_180[];
double g_ibuf_184[];
double g_ibuf_188[];
double g_ibuf_192[];
double g_ibuf_196[];
double g_ibuf_200[];
double g_ibuf_204[];

int init() {
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   SetIndexArrow(0, 212);
   SetIndexBuffer(0, g_ibuf_176);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   SetIndexArrow(1, 212);
   SetIndexBuffer(1, g_ibuf_180);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   SetIndexArrow(2, 212);
   SetIndexBuffer(2, g_ibuf_184);
   SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 0);
   SetIndexArrow(3, 234);
   SetIndexBuffer(3, g_ibuf_188);
   SetIndexStyle(4, DRAW_HISTOGRAM, STYLE_SOLID, 0);
   SetIndexArrow(4, 234);
   SetIndexBuffer(4, g_ibuf_192);
   SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexArrow(5, 171);
   SetIndexBuffer(5, g_ibuf_196);
   SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexArrow(6, 171);
   SetIndexBuffer(6, g_ibuf_200);
   SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, 1);
   SetIndexArrow(7, 108);
   SetIndexBuffer(7, g_ibuf_204);
   IndicatorShortName("LuckyStarV2 ");
   f0_1();
   return (0);
}

int start() {


   int highest_12;
   int lowest_16;
   int highest_20;
   int lowest_24;
   double icci_28;
   double icci_36;
   double iadx_44;
   double iadx_52;
   double iadx_60;
   double iadx_68;
   bool li_76;
   bool li_80;
   int li_0 = IndicatorCounted();
   if (li_0 < 0) return (-1);
   if (li_0 > 0) li_0--;
   int li_8 = Bars - li_0;
   li_8 = MathMax(li_8, HIGHSign);
   li_8 = MathMax(li_8, LOWSign);
   for (int li_4 = li_8; li_4 >= 0; li_4--) {
      icci_28 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, li_4 + 0);
      icci_36 = iCCI(NULL, 0, CCIPeriod, PRICE_CLOSE, li_4 + 1);
      highest_20 = iHighest(NULL, 0, MODE_HIGH, HIGHSign, li_4 - HIGHSign / 2);
      lowest_24 = iLowest(NULL, 0, MODE_LOW, HIGHSign, li_4 - HIGHSign / 2);
      highest_12 = iHighest(NULL, 0, MODE_HIGH, LOWSign, li_4 - LOWSign / 2);
      lowest_16 = iLowest(NULL, 0, MODE_LOW, LOWSign, li_4 - LOWSign / 2);
      if (li_4 + 0 == lowest_24 || li_4 + 1 == lowest_24 || li_4 + 2 == lowest_24 || li_4 + 3 == lowest_24) g_ibuf_180 = 4;
      else {
         if (li_4 + 0 == highest_20 || li_4 + 1 == highest_20 || li_4 + 2 == highest_20 || li_4 + 3 == highest_20) g_ibuf_184 = 4;
         else g_ibuf_176 = 2;
      }
      iadx_44 = iADX(NULL, 0, ADXPeriod, PRICE_HIGH, MODE_PLUSDI, li_4 + 0);
      iadx_52 = iADX(NULL, 0, ADXPeriod, PRICE_HIGH, MODE_MINUSDI, li_4 + 0);
      iadx_60 = iADX(NULL, 0, ADXPeriod, PRICE_HIGH, MODE_PLUSDI, li_4 + 1);
      iadx_68 = iADX(NULL, 0, ADXPeriod, PRICE_HIGH, MODE_MINUSDI, li_4 + 1);
      li_76 = iadx_44 > iadx_60 && iadx_52 < iadx_68 && g_ibuf_180 == 4.0;
      li_80 = iadx_52 > iadx_68 && iadx_44 < iadx_60 && g_ibuf_184 == 4.0;
      if (li_76 && icci_28 > 0.0) g_ibuf_188 = 6;
      if (li_80 && icci_28 < 0.0) g_ibuf_192 = 6;
      if (li_76) g_ibuf_196 = 7;
      if (li_80) g_ibuf_200 = 7;
      if (g_ibuf_180 == 4.0 && g_ibuf_188 == 6.0 && g_ibuf_196 == 7.0) {
         gs_160 = "BUY SIGNAL";
         gi_168 = 3329330;
         gi_172 = TRUE;
      } else {
         if (g_ibuf_184 == 4.0 && g_ibuf_192 == 6.0 && g_ibuf_200 == 7.0) {
            gs_160 = "SELL SIGNAL";
            gi_168 = 255;
            gi_172 = TRUE;
         } else {
            if (g_ibuf_180 == 4.0) {
               gs_160 = "BUY TREND";
               gi_168 = 3329330;
               gi_172 = FALSE;
            } else {
               if (g_ibuf_184 == 4.0) {
                  gs_160 = "SELL TREND";
                  gi_168 = 255;
                  gi_172 = FALSE;
               } else {
                  gs_160 = "WAITING FOR SIGNAL";
                  gi_168 = 65535;
                  gi_172 = FALSE;
               }
            }
         }
      }
   }
   if (Sound == TRUE)
      if (gi_172) PlaySound("entry.wav");
   f0_1();
   RefreshRates();
   return (0);
}

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

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) {
   ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0);
   ObjectSet(a_name_0, OBJPROP_CORNER, 3);
   ObjectSet(a_name_0, OBJPROP_COLOR, a_color_36);
   ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_8);
   ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_12);
   ObjectSetText(a_name_0, a_text_16, a_fontsize_24, a_fontname_28, a_color_36);
}


213213216 发表于 2018-5-3 12:43:43

111111111111111111111111

kylonsn 发表于 2019-10-24 20:31:40

未来函数,无敌了。

nihaoya44 发表于 2020-8-12 13:37:09

学习了,不错

ゞ__染_指 发表于 2020-9-4 17:39:19

谢谢楼主分享
页: [1]
查看完整版本: [iC2R]LuckyStarV2