Saludos Hermano.
No se, a mi me va de lujo...
Te dejo el codigo...
Código: Seleccionar todo
//+------------------------------------------------------------------+
//|                                                     YsNewton.mq4 |
//|                      Copyright © 2008, Yseku. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "YsEkU"
#property link      "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 White
#property indicator_color4 White
//---- indicator buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
int nodos=10;
int x[],pase;
double fx[],buff[],pre;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0,Buffer1);
   SetIndexStyle(0,DRAW_HISTOGRAM,2,3);
   SetIndexLabel(0,"Prediccion Open");
   //SetIndexShift(0,1);
   SetIndexBuffer(1,Buffer2);
   SetIndexStyle(1,DRAW_HISTOGRAM,2,3);
   SetIndexLabel(1,"Prediccion Close");
   //SetIndexShift(1,1);
   SetIndexBuffer(2,Buffer3);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexLabel(2,"Prediccion Max");
   //SetIndexShift(2,1);
   SetIndexBuffer(3,Buffer4);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexLabel(3,"Prediccion Min");
   //SetIndexShift(3,1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
  int cb=IndicatorCounted();
  int b=Bars;
  if(cb==0)
  {
  for(int h=(b-1)-nodos;h>=0;h--)
   {
   Buffer1[h]=Proceso(1,h);
   Buffer2[h]=Proceso(2,h);
   Buffer3[h]=Proceso(3,h);
   Buffer4[h]=Proceso(4,h);
   }
  }
   Buffer1[0]=Proceso(1,0);
   Buffer2[0]=Proceso(2,0);
   Buffer3[0]=Proceso(3,0);
   Buffer4[0]=Proceso(4,0);
   
//----
   Info();
   return(0);
  }
  
//+------------------------------------------------------------------+
void Info()
{
//Print("------------------------------------------------------------");
//Print("********************  Prediccion: ",Buffer1[0]);
}
//+------------------------------------------------------------------+
double Proceso(int serie,int pos)
{
ArrayResize(x,nodos);
ArrayResize(fx,nodos);
ArrayResize(buff,nodos);
pase=0;
   while(pase<nodos)
   {
   if(pase==0)
      {
      for(int i=0;i<nodos-pase;i++)
         {
         x[i]=i+1;
            if(serie==1)buff[i]=Open[i+pos]*10000000000000000000000000000000;
            else if(serie==2)buff[i]=Close[i+pos]*10000000000000000000000000000000;
            else if(serie==3)buff[i]=High[i+pos]*10000000000000000000000000000000;
            else if(serie==4)buff[i]=Low[i+pos]*10000000000000000000000000000000;
         }
      fx[pase]=buff[0];
      }
   else
      {
      for(i=0;i<nodos-pase;i++)
         {
         buff[i]=(buff[i]-buff[i+1])/pase;
         }
      fx[pase]=buff[0];
      }
   pase++;
   }
   int h=-1;
   for(i=0;i<nodos;i++)
      {
      int j=i/2;
      if(h==j)fx[i]=-fx[i];
      if(h!=j)h=j;
      pre=pre+fx[i];
      }
   pre=pre/10000000000000000000000000000000;
return(pre);
}
 
Un saludo hermanos.