Download MetaTrader 5

Problem with roc.mq4 in the Book

To add comments, please log in or register
Pierre Pomeroy
15
Pierre Pomeroy  
I copied roc.mq4 from https://book.mql4.com/samples/iroc exactly the way it is then attached it to a chart and I don't see any lines there at all. Why?
Ubzen
5394
Ubzen  
Pierre1701: I copied roc.mq4 from https://book.mql4.com/samples/iroc exactly the way it is then attached it to a chart and I don't see any lines there at all. Why?
The examples from the book usually have small errors it needs you to fix in-order to get it working. Think of it as home-work.
Pierre Pomeroy
15
Pierre Pomeroy  
Okay I will give it a try.
muller
559
muller  
I also have tried to fix/workaround the drawing issue, but without real success. Still hope that very good indi be updated/fixed by a skilled coder.
ffoorr
1076
ffoorr  
 if (Aver_Bars>0)  Aver_Bars=0;  

 if (Aver_Bars<0)  Aver_Bars=0;  

 the way it is  : 

 if (Aver_Bars>0)              // If wrong set smoothing
         Aver_Bars=0;               // .. no less than zero
      Sum=0;                        // Technical means
      for(n=i; n>=i+Aver_Bars; n++) // Summing last values
         Sum=Sum + Line_4[n];       // Accum. sum of last values
      Line_5[i]= Sum/(Aver_Bars+1); /

    this way it work  :

     if( Smooth<0 )  Smooth = 1;               // .. no less than zero
      Sum=0;                      
      for(n=i+Smooth; n>=i; n--) Sum=Sum + Line_4[n];       
      Line_5[i]= Sum/(Smooth+1); 
To add comments, please log in or register