Help with a for loop

 

Hi, guys. Can someone help me to understand why this for loop doesn't work?

int counter=0;
int counter1=0;
int endvalue=49;
int v=0;


 for (counter;counter<endvalue;counter=counter+1)

        {
               
               counter1=counter+1;
               v = a[counter1];
               a[counter] = v;
               
               
             

               
            }   
               a[50]=secxpip;
           
              Print (a[48]+","+a[49]+","+a[50]); 

I want to move all the value in the array a from the higher to the lower and after that update the a[50] variable in order to sum the last current 50 value. The last variable is updated but it doesn't move to the lower values.

 
  1. You are moving all values down, except for moving 50 to 49.
  2. Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
              Code debugging - Developing programs - MetaEditor Help
              Error Handling and Logging in MQL5 - MQL5 Articles (2015)
              Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
              Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)

 
Off course! Sorry to bother. Thanks for the explanation