Help need for iCustom() function in EA

 

Hello, I would be grateful if someone could add the iCustom() function to this EA so I no longer get the 'SetIndexBuffer function must be called from custom indicator only.' error message when running on strategy tester.

the indicator is called Launcher Insight Indicator



#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 White
#property indicator_color3 Red

double g_ibuf_76[];
double g_ibuf_80[];
double g_ibuf_84[];
int g_period_88 = 20;

int init() {
   SetIndexStyle(0, DRAW_LINE);
   SetIndexShift(0, 0);
   SetIndexDrawBegin(0, 0);
   SetIndexBuffer(0, g_ibuf_76);
   SetIndexStyle(1, DRAW_NONE);
   SetIndexShift(1, 0);
   SetIndexDrawBegin(1, 0);
   SetIndexBuffer(1, g_ibuf_80);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexShift(2, 0);
   SetIndexDrawBegin(2, 0);
   SetIndexBuffer(2, g_ibuf_84);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double ld_8;
   if (ObjectType("TRX") != 23) ObjectDelete("TRX");
   if (ObjectFind("TRX") == -1) ObjectCreate("TRX", OBJ_LABEL, 0, Time[5], Close[5]);
   ObjectSetText("TRX", "Launcher TRX Indicator (R)");
   ObjectSet("TRX", OBJPROP_CORNER, 4);
   ObjectSet("TRX", OBJPROP_FONTSIZE, 12);
   ObjectSet("TRX", OBJPROP_XDISTANCE, 5);
   ObjectSet("TRX", OBJPROP_YDISTANCE, 20);
   int li_4 = IndicatorCounted();
   if (li_4 < 0) return (-1);
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4;
   for (int li_16 = 0; li_16 < li_0; li_16++) {
      g_ibuf_80[li_16] = iMA(NULL, 0, g_period_88, 0, MODE_SMA, PRICE_TYPICAL, li_16);
      ld_8 = findAvg(g_period_88, li_16);
      g_ibuf_76[li_16] = g_ibuf_80[li_16] + 1.5 * ld_8;
      g_ibuf_84[li_16] = g_ibuf_80[li_16] - 1.5 * ld_8;
   }
   double l_iatr_20 = iATR(Symbol(), 0, 50, 1);
   if (High[0] == Low[0] && High[0] == Close[0] && High[0] == Open[0]) {
      if (MathAbs(High[1] - g_ibuf_76[1]) < l_iatr_20 && g_ibuf_76[1] < g_ibuf_76[2]) Alert("[" + Symbol() + "] Possible Short on TRX Final, Please Confirm with Directional.");
      if (MathAbs(Low[1] - g_ibuf_84[1]) < l_iatr_20 && g_ibuf_84[1] > g_ibuf_84[2]) Alert("[" + Symbol() + "] Possible Long on TRX Final, Please Confirm with Directional.");
   }
   return (0);
}

double findAvg(int ai_0, int ai_4) {
   double ld_ret_8 = 0;
   for (int li_16 = ai_4; li_16 < ai_4 + ai_0; li_16++) ld_ret_8 += High[li_16] - Low[li_16];
   ld_ret_8 /= ai_0;
   return (ld_ret_8);
}
 

decompile much?

 
Phillip,

How do you know the EA is decompiled? I am real curious. And how can an EA be decompiled?
 
No programmer would name their variables g_ibuf_76[], li_16, ai_4, etc... Only a machine would do that - a decompiler.

http://lmgtfy.com/?q=decompile+mql4+online
 

Never mind that, how do I add iCustom() function, I've never used that function before.

 
We mind.
Reason: