Problem with ICustom

 
Hi, I'm having problems with the icustom, no matter what I wrote to him,

but actually everything seems ok to me


Code on EA:

//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+

void OnTimer()
  {
TechnicalAnalysis2x11();
}

void TechnicalAnalysis2x11()
  {
   static datetime lastBar = 0;
   if (lastBar!=iTime(NULL,PERIOD_CURRENT,0))
   {
      for (int i=0; i<200; i++)
      {
         customvendi = iCustom(NULL, PERIOD_CURRENT, "Didi_Index",Curta_Length,0,CurtaMethod,CurtaAppliedPrice, 0, i);
         customcompra = iCustom(NULL, PERIOD_CURRENT, "Didi_Index",Longa_Length,0,LongaMethod,LongaAppliedPrice, 2, i);
      
         if(((customvendi !=EMPTY_VALUE) && (customvendi !=0)) )
            Print("Bar = ", i, ", Time = ", TimeToStr(iTime(NULL,PERIOD_CURRENT,i),TIME_MINUTES), ", Venda = ", customvendi);

         if(((customcompra !=EMPTY_VALUE) && (customcompra !=0)) )
            Print("Bar = ", i, ", Time = ", TimeToStr(iTime(NULL,PERIOD_CURRENT,i),TIME_MINUTES), ",  Compra = ", customcompra);
      }
      lastBar = iTime(NULL,PERIOD_CURRENT,0);
   }
  }
  


Code on Indicator:

#property copyright ""
#property link      ""
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots   3

//--- plot Curta
#property indicator_label1 "Curta"
#property indicator_type1  DRAW_LINE
#property indicator_color1 clrLime
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- plot Media
#property indicator_label2 "Media"
#property indicator_type2  DRAW_LINE
#property indicator_color2 clrWhite
#property indicator_style2 STYLE_SOLID
#property indicator_width2 1
//--- plot Longa
#property indicator_label3 "Longa"
#property indicator_type3  DRAW_LINE
#property indicator_color3 clrYellow
#property indicator_style3 STYLE_SOLID
#property indicator_width3 1
//--- input parameters
extern int                Curta_Length      = 3;
extern ENUM_APPLIED_PRICE CurtaAppliedPrice = PRICE_CLOSE;
extern ENUM_MA_METHOD     CurtaMethod       = MODE_SMA;
extern int                Media_Length      = 8;
extern ENUM_APPLIED_PRICE MediaAppliedPrice = PRICE_CLOSE;
extern ENUM_MA_METHOD     MediaMethod       = MODE_SMA;
extern int                Longa_Length      = 20;
extern ENUM_APPLIED_PRICE LongaAppliedPrice = PRICE_CLOSE;
extern ENUM_MA_METHOD     LongaMethod       = MODE_SMA;

//--- indicator buffers
double Curta[];
double Media[];
double Longa[];

int init()
{
   SetIndexBuffer(0,Curta,INDICATOR_DATA);
   SetIndexBuffer(1,Media,INDICATOR_DATA);
   SetIndexBuffer(2,Longa,INDICATOR_DATA);
   
   return(0);
}

int start()
{
   int counted_bars=IndicatorCounted();
      if(counted_bars<0) return(-1);
      if(counted_bars>0) counted_bars--;
           int limit=MathMin(Bars-counted_bars,Bars-1);
   
   //
   //
   //
   
   for (int i=limit; i>=0; i--)
   {
       double M_MA = iMA(NULL,0,Media_Length,0,MediaMethod,MediaAppliedPrice,i);
       if (M_MA>0)
       {
          Curta[i] = iMA(NULL,0,Curta_Length,0,CurtaMethod,CurtaAppliedPrice,i)/M_MA;
          Media[i] = 1;
          Longa[i] = iMA(NULL,0,Longa_Length,0,LongaMethod,LongaAppliedPrice, i)/M_MA;
       } 
 } 
 return(0);
}



screenshot result:

that should come out:


 
Comandantf: Hi, I'm having problems with the icustom, no matter what I wrote to him,
  1. If you are having problems with iCustom, state the problem.

  2. Your images are about your indicator. Make up your mind.

  3. customvendi = iCustom(NULL, PERIOD_CURRENT, "Didi_Index",
       Curta_Length,
       0,
       CurtaMethod,
       CurtaAppliedPrice,                                  0, i);
    extern int                Curta_Length      = 3;
    extern ENUM_APPLIED_PRICE CurtaAppliedPrice = PRICE_CLOSE;
    extern ENUM_MA_METHOD     CurtaMethod       = MODE_SMA;
    extern int                Media_Length      = 8;
    ⋮
    Always post all relevant code (using Code button) or attach the file.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

    We don't know what those three variables are (value and type).

  4. Don't hard code constants. If your zero meant PRICE_CLOSE, then specify PRICE_CLOSE.
  5. You pass CurtaAppliedPrice where the indicator has Media_Length.