谁能帮忙注释下这一段代码

 

这段代码看不懂,谁能帮忙注释下,自定义变量的含义及每行代码的目的,谢谢!

extern bool UseATRMode = TRUE;

extern int NonATRStopPips = 40;

extern int ATRPeriod = 9;

extern double ATRMultiplier = 3.0;

extern int ATRSmoothing = 0;

extern color UpArrowColor = OrangeRed;

extern color DnArrowColor = DodgerBlue;

extern int ArrowDistance = 500000000;

extern bool AlertSound = FALSE;

extern bool AlertMail = FALSE;

extern bool ShowComment = FALSE;

double g_ibuf_124[];

double gda_128[];

double gda_132[];

string gs_136;

int g_count_144 = 0;

int g_count_148;

int gi_152 = 0;

int g_time_156 = 0;

bool gi_160 = FALSE;

int g_time_164 = 0;

int g_time_168 = 0;


int init() {

   bool li_0 = FALSE;

   if (UseATRMode) li_0 = ATRPeriod;

   if (ATRSmoothing <= 0) ATRSmoothing = 1;

   IndicatorBuffers(1);

   SetIndexStyle(0, DRAW_LINE,STYLE_DOT);

   SetIndexBuffer(0, g_ibuf_124);

   SetIndexDrawBegin(0, li_0);

   gs_136 = "Spirit" + " " + "(";

   if (UseATRMode) gs_136 = StringConcatenate(gs_136, "Mode ", ATRPeriod, ", ", ATRMultiplier, ", ", ATRSmoothing, " )");

   else gs_136 = StringConcatenate(gs_136, "Manual Mode Stop = ", NonATRStopPips, " )");

   IndicatorShortName(gs_136);

   SetIndexLabel(0, gs_136);

   Print(gs_136);

   Print("Copyright (c) 2010 - Lee, olike@qq.com");

   MathSrand(TimeLocal());

   DeleteAllArrowObjects();

   g_count_148 = 0;

   g_count_144 = 0;

   return (0);

}


int deinit() {

   DeleteAllArrowObjects();

   return (0);

}


int start() {

   double ld_0;

   double ld_8;

   double ld_16;

   bool li_24;

   bool li_28;

   double l_price_32;

   string l_name_40;

   double l_price_48;

  

   

   int li_56 = IndicatorCounted();

   if (li_56 < 0) return (-1);

   if (li_56 > 0) li_56--;

   int li_60 = Bars - li_56;

   int li_64 = li_60 - 1;

   if (UseATRMode && Bars < ATRPeriod) return (0);

   int l_arr_size_68 = ArraySize(g_ibuf_124);

   if (ArraySize(gda_128) != l_arr_size_68) {

      ArraySetAsSeries(gda_128, FALSE);

      ArrayResize(gda_128, l_arr_size_68);

      ArraySetAsSeries(gda_128, TRUE);

      ArraySetAsSeries(gda_132, FALSE);

      ArrayResize(gda_132, l_arr_size_68);

      ArraySetAsSeries(gda_132, TRUE);

   }

   if (UseATRMode) {

      for (int li_72 = 0; li_72 < li_60; li_72++) gda_128[li_72] = iATR(NULL, 0, ATRPeriod, li_72);

      for (li_72 = 0; li_72 < li_60; li_72++) gda_132[li_72] = Wilders(gda_128, ATRSmoothing, li_72);

   }

   for (li_72 = li_64; li_72 >= 0; li_72--) {

      ld_0 = NonATRStopPips * Point;

      if (UseATRMode) ld_0 = NormalizeDouble(gda_132[li_72] * ATRMultiplier, 4);

      ld_16 = g_ibuf_124[li_72 + 1];

      li_24 = FALSE;

      li_28 = FALSE;

      if (Close[li_72] == ld_16) ld_8 = ld_16;

      else {

         if (Close[li_72 + 1] <= ld_16 && Close[li_72] < ld_16) ld_8 = MathMin(ld_16, Close[li_72] + ld_0);

         else {

            if (Close[li_72 + 1] >= ld_16 && Close[li_72] > ld_16) ld_8 = MathMax(ld_16, Close[li_72] - ld_0);

            else {

               if (Close[li_72] > ld_16) {

                  ld_8 = Close[li_72] - ld_0;

                  li_24 = TRUE;

               } else {

                  ld_8 = Close[li_72] + ld_0;

                  li_28 = TRUE;

               }

            }

         }

      }

      g_ibuf_124[li_72] = ld_8;

      if (li_72 > 0) {

         if (li_24) {

            if (Time[li_72] > g_time_156) {

               l_price_32 = g_ibuf_124[li_72] - ArrowDistance * Point;

               l_name_40 = GetNextObjectName();

               ObjectCreate(l_name_40, OBJ_ARROW, 0, Time[li_72], l_price_32);

               ObjectSet(l_name_40, OBJPROP_COLOR, UpArrowColor);

               ObjectSet(l_name_40, OBJPROP_ARROWCODE, 233);

               g_count_144++;

               g_time_156 = Time[li_72];

               gi_160 = TRUE;

            }

         }

         if (li_28) {

            if (Time[li_72] > g_time_156) {

               l_price_48 = g_ibuf_124[li_72] + 2.0 * Point + ArrowDistance * Point;

               l_name_40 = GetNextObjectName();

               ObjectCreate(l_name_40, OBJ_ARROW, 0, Time[li_72], l_price_48);

               ObjectSet(l_name_40, OBJPROP_COLOR, DnArrowColor);

               ObjectSet(l_name_40, OBJPROP_ARROWCODE, 234);

               g_count_144++;

               g_time_156 = Time[li_72];

               gi_160 = FALSE;

            }

         }

      }

      if (li_72 == 1)

         if (g_time_156 == Time[li_72]) DoAlerts();

      if (li_72 == 0) {

         if (Time[li_72] != g_time_168) {

            ObjectsRedraw();

            g_time_168 = Time[li_72];

         }

      }

   }

   if (g_count_144 != gi_152) {

      Print("Total Arrow Objects: ", g_count_144);

      gi_152 = g_count_144;

   }

   return (0);

}


string GetNextObjectName() {

   g_count_148++;

   string ls_ret_0 = "Spirit" + g_count_148;

   return (ls_ret_0);

}


double Wilders(double ada_0[], int ai_4, int ai_8) {

   double l_ima_on_arr_12 = 0.0;

   l_ima_on_arr_12 = iMAOnArray(ada_0, 0, ai_4 * 2 - 1, 0, MODE_EMA, ai_8);

   return (l_ima_on_arr_12);

}


void DeleteAllArrowObjects() {

   string l_name_0;

   int l_count_8 = 0;

   for (int li_12 = 1; li_12 <= g_count_148; li_12++) {

      l_name_0 = "Spirit" + ((li_12 + 1));

      if (ObjectDelete(l_name_0)) l_count_8++;

   }

   Print("Objects deleted: ", l_count_8);

}


void DoAlerts() {

   int l_timeframe_0;

   string ls_4;

   int l_datetime_12;

   string ls_16;

   string ls_24;

   if (g_time_156 > g_time_164) {

      if (AlertSound) PlaySound("alert.wav");

      if (AlertMail) {

         l_timeframe_0 = Period();

         ls_4 = "";

         switch (l_timeframe_0) {

         case PERIOD_M1:

            ls_4 = "M1";

            break;

         case PERIOD_M5:

            ls_4 = "M5";

            break;

         case PERIOD_M15:

            ls_4 = "M15";

            break;

         case PERIOD_M30:

            ls_4 = "M30";

            break;

         case PERIOD_H1:

            ls_4 = "H1";

            break;

         case PERIOD_H4:

            ls_4 = "H4";

            break;

         case PERIOD_D1:

            ls_4 = "D1";

            break;

         case PERIOD_W1:

            ls_4 = "W1";

            break;

         case PERIOD_MN1:

            ls_4 = "MN1";

            break;

         default:

            ls_4 = "" + l_timeframe_0 + " Min";

         }

         l_datetime_12 = TimeCurrent();

         ls_16 = "LONG";

         if (!gi_160) ls_16 = "SHORT";

         ls_24 = "Spirit " + TimeToStr(l_datetime_12, TIME_DATE|TIME_SECONDS);

         SendMail(ls_24, "Spirit has given a " + ls_16 + " signal for pair " + Symbol() + " " + ls_4 + ".");

      }

      g_time_164 = g_time_156;

   }

}

 
ncljf:

这段代码看不懂,谁能帮忙注释下,自定义变量的含义及每行代码的目的,谢谢!

extern bool UseATRMode = TRUE;

extern int NonATRStopPips = 40;

extern int ATRPeriod = 9;

extern double ATRMultiplier = 3.0;

extern int ATRSmoothing = 0;

extern color UpArrowColor = OrangeRed;

extern color DnArrowColor = DodgerBlue;

extern int ArrowDistance = 500000000;

extern bool AlertSound = FALSE;

extern bool AlertMail = FALSE;

extern bool ShowComment = FALSE;

double g_ibuf_124[];

double gda_128[];

double gda_132[];

string gs_136;

int g_count_144 = 0;

int g_count_148;

int gi_152 = 0;

int g_time_156 = 0;

bool gi_160 = FALSE;

int g_time_164 = 0;

int g_time_168 = 0;


int init() {

   bool li_0 = FALSE;

   if (UseATRMode) li_0 = ATRPeriod;

   if (ATRSmoothing <= 0) ATRSmoothing = 1;

   IndicatorBuffers(1);

   SetIndexStyle(0, DRAW_LINE,STYLE_DOT);

   SetIndexBuffer(0, g_ibuf_124);

   SetIndexDrawBegin(0, li_0);

   gs_136 = "Spirit" + " " + "(";

   if (UseATRMode) gs_136 = StringConcatenate(gs_136, "Mode ", ATRPeriod, ", ", ATRMultiplier, ", ", ATRSmoothing, " )");

   else gs_136 = StringConcatenate(gs_136, "Manual Mode Stop = ", NonATRStopPips, " )");

   IndicatorShortName(gs_136);

   SetIndexLabel(0, gs_136);

   Print(gs_136);

   Print("Copyright (c) 2010 - Lee, olike@qq.com");

   MathSrand(TimeLocal());

   DeleteAllArrowObjects();

   g_count_148 = 0;

   g_count_144 = 0;

   return (0);

}


int deinit() {

   DeleteAllArrowObjects();

   return (0);

}


int start() {

   double ld_0;

   double ld_8;

   double ld_16;

   bool li_24;

   bool li_28;

   double l_price_32;

   string l_name_40;

   double l_price_48;

  

   

   int li_56 = IndicatorCounted();

   if (li_56 < 0) return (-1);

   if (li_56 > 0) li_56--;

   int li_60 = Bars - li_56;

   int li_64 = li_60 - 1;

   if (UseATRMode && Bars < ATRPeriod) return (0);

   int l_arr_size_68 = ArraySize(g_ibuf_124);

   if (ArraySize(gda_128) != l_arr_size_68) {

      ArraySetAsSeries(gda_128, FALSE);

      ArrayResize(gda_128, l_arr_size_68);

      ArraySetAsSeries(gda_128, TRUE);

      ArraySetAsSeries(gda_132, FALSE);

      ArrayResize(gda_132, l_arr_size_68);

      ArraySetAsSeries(gda_132, TRUE);

   }

   if (UseATRMode) {

      for (int li_72 = 0; li_72 < li_60; li_72++) gda_128[li_72] = iATR(NULL, 0, ATRPeriod, li_72);

      for (li_72 = 0; li_72 < li_60; li_72++) gda_132[li_72] = Wilders(gda_128, ATRSmoothing, li_72);

   }

   for (li_72 = li_64; li_72 >= 0; li_72--) {

      ld_0 = NonATRStopPips * Point;

      if (UseATRMode) ld_0 = NormalizeDouble(gda_132[li_72] * ATRMultiplier, 4);

      ld_16 = g_ibuf_124[li_72 + 1];

      li_24 = FALSE;

      li_28 = FALSE;

      if (Close[li_72] == ld_16) ld_8 = ld_16;

      else {

         if (Close[li_72 + 1] <= ld_16 && Close[li_72] < ld_16) ld_8 = MathMin(ld_16, Close[li_72] + ld_0);

         else {

            if (Close[li_72 + 1] >= ld_16 && Close[li_72] > ld_16) ld_8 = MathMax(ld_16, Close[li_72] - ld_0);

            else {

               if (Close[li_72] > ld_16) {

                  ld_8 = Close[li_72] - ld_0;

                  li_24 = TRUE;

               } else {

                  ld_8 = Close[li_72] + ld_0;

                  li_28 = TRUE;

               }

            }

         }

      }

      g_ibuf_124[li_72] = ld_8;

      if (li_72 > 0) {

         if (li_24) {

            if (Time[li_72] > g_time_156) {

               l_price_32 = g_ibuf_124[li_72] - ArrowDistance * Point;

               l_name_40 = GetNextObjectName();

               ObjectCreate(l_name_40, OBJ_ARROW, 0, Time[li_72], l_price_32);

               ObjectSet(l_name_40, OBJPROP_COLOR, UpArrowColor);

               ObjectSet(l_name_40, OBJPROP_ARROWCODE, 233);

               g_count_144++;

               g_time_156 = Time[li_72];

               gi_160 = TRUE;

            }

         }

         if (li_28) {

            if (Time[li_72] > g_time_156) {

               l_price_48 = g_ibuf_124[li_72] + 2.0 * Point + ArrowDistance * Point;

               l_name_40 = GetNextObjectName();

               ObjectCreate(l_name_40, OBJ_ARROW, 0, Time[li_72], l_price_48);

               ObjectSet(l_name_40, OBJPROP_COLOR, DnArrowColor);

               ObjectSet(l_name_40, OBJPROP_ARROWCODE, 234);

               g_count_144++;

               g_time_156 = Time[li_72];

               gi_160 = FALSE;

            }

         }

      }

      if (li_72 == 1)

         if (g_time_156 == Time[li_72]) DoAlerts();

      if (li_72 == 0) {

         if (Time[li_72] != g_time_168) {

            ObjectsRedraw();

            g_time_168 = Time[li_72];

         }

      }

   }

   if (g_count_144 != gi_152) {

      Print("Total Arrow Objects: ", g_count_144);

      gi_152 = g_count_144;

   }

   return (0);

}


string GetNextObjectName() {

   g_count_148++;

   string ls_ret_0 = "Spirit" + g_count_148;

   return (ls_ret_0);

}


double Wilders(double ada_0[], int ai_4, int ai_8) {

   double l_ima_on_arr_12 = 0.0;

   l_ima_on_arr_12 = iMAOnArray(ada_0, 0, ai_4 * 2 - 1, 0, MODE_EMA, ai_8);

   return (l_ima_on_arr_12);

}


void DeleteAllArrowObjects() {

   string l_name_0;

   int l_count_8 = 0;

   for (int li_12 = 1; li_12 <= g_count_148; li_12++) {

      l_name_0 = "Spirit" + ((li_12 + 1));

      if (ObjectDelete(l_name_0)) l_count_8++;

   }

   Print("Objects deleted: ", l_count_8);

}


void DoAlerts() {

   int l_timeframe_0;

   string ls_4;

   int l_datetime_12;

   string ls_16;

   string ls_24;

   if (g_time_156 > g_time_164) {

      if (AlertSound) PlaySound("alert.wav");

      if (AlertMail) {

         l_timeframe_0 = Period();

         ls_4 = "";

         switch (l_timeframe_0) {

         case PERIOD_M1:

            ls_4 = "M1";

            break;

         case PERIOD_M5:

            ls_4 = "M5";

            break;

         case PERIOD_M15:

            ls_4 = "M15";

            break;

         case PERIOD_M30:

            ls_4 = "M30";

            break;

         case PERIOD_H1:

            ls_4 = "H1";

            break;

         case PERIOD_H4:

            ls_4 = "H4";

            break;

         case PERIOD_D1:

            ls_4 = "D1";

            break;

         case PERIOD_W1:

            ls_4 = "W1";

            break;

         case PERIOD_MN1:

            ls_4 = "MN1";

            break;

         default:

            ls_4 = "" + l_timeframe_0 + " Min";

         }

         l_datetime_12 = TimeCurrent();

         ls_16 = "LONG";

         if (!gi_160) ls_16 = "SHORT";

         ls_24 = "Spirit " + TimeToStr(l_datetime_12, TIME_DATE|TIME_SECONDS);

         SendMail(ls_24, "Spirit has given a " + ls_16 + " signal for pair " + Symbol() + " " + ls_4 + ".");

      }

      g_time_164 = g_time_156;

   }

}

建议去自由职业者版块发布您的需求

 
你這是破解碼的 已經沒有什麼好討論
原因: