You are missing trading opportunities:
        - Free trading apps
 - Over 8,000 signals for copying
 - Economic news for exploring financial markets
 
          Registration
          Log in
        
        You agree to website policy and terms of use
    If you do not have an account, please register
  
This indicator plots days range, with a 10 day average.
The code that misbehaves
The code that the average does not give incorrect last two bars on the (lime) average line
very weird, My computer has plenty of grunt.
//AtrBuffer[i]=TempBuffer2[i]; //I take these two arrays out and iMAOnArray works ok
//AtrBufferSPIKE[i]=TempBuffer3[i];
Reducing demans on the loop when iMAOnArray is calculated sems to fix the average, but limits what I want the inidcator to do, I tried separating them into two loops loading the final buffers, this made no difference.
Any ideas . Thanks in Advance...