Need some help to convert a PRT code into MQL4 (i give a banana as a thanks)

 

Hi everybody !

 

As u can see in the title, i need some help to convert a PRT code into MQL4 (indicator). It would be amazing if someone could help me !

 

The question is : Does this code is correct ? And secondly, why i couldn't display MemTop1[] variable ? I tried a lot of thing.... Thank you very much !

 

//--- indicator buffers
double MemTop1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
 
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MemTop1);
 
 
 
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
  
  int start()
  {
   //--- some calculations require no less than N bars (e.g. 100)      
   if (Bars<100) // if less bars are available on a chart (for example on MN timeframe)    
     return(-1); // stop calculation and exit

   //--- the number of bars that have not changed since the last indicator call
   int counted_bars=IndicatorCounted();
   //--- exit if an error has occurred
   if(counted_bars<0) return(-1);
      
   //--- position of the bar from which calculation in the loop starts
   int limit=Bars-counted_bars;

   //--- if counted_bars=0, reduce the starting position in the loop by 1,   
   if(counted_bars==0) 
     {
      limit--;  // to avoid the array out of range problem when counted_bars==0
      //--- we use a shift of 10 bars back in history, so add this shift during the first calculation
      limit-=10;
     }
   else //--- the indicator has been already calculated, counted_bars>0
     {     
      //--- for repeated calls increase limit by 1 to update the indicator values for the last bar
      limit++;
     } 
   //--- the main calculation loop
   for (int i=limit; i>0; i--)
   {
   
   
   
   
   
      if (Condition) 
{
double MemTop1[i] = High[i+4];
double MemTop2 = MemTop1;
double MemTop3 =  MemTop2;
double MemTop4 =  MemTop3;
double MemTop5 =  MemTop4;


double BarMemTop1 = iBarShift(0,0, iTime(0,0,i+4));
double BarMemTop2 = BarMemTop1;
double BarMemTop3 = BarMemTop2;
double BarMemTop4 = BarMemTop3;
double BarMemTop5 = BarMemTop4;
}
   
   
  

}
   return(0);
 }