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

Back to topics list To post a new topic, please log in or register
afterrage 2014.09.16 12:24

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()
//| 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,   
      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
   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
   //--- 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;



Back to topics list  

To add comments, please log in or register