Need some help creating an array to store the history of an indicator.

 
I want to make a function that will store the past 100 candle values of the ATR(14 period) and then save the lowest value to a variable which can be used by other functions. 

Can anyone help me or provide me a sample snippet of code? I went through the official literature but it just does not want to work for me. 

 
  1. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
  2. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
 
I just want the "lowest" variable to be the lowest iATR readout from the past 100 candles.

    double atrhist;
     double lowest;
     
void atrcheck()
{     
     for(int i=0; i<100; i++) 
     {
     atrhist=iATR(Symbol(),0,14,i);
     if (atrhist<lowest)
     lowest=atrhist;
     Print(atrhist);
     }}
  My EA places orders based on weather the current iATR is above or below lowest*2.
 
void atrcheck()
{    
     lowest=iATR(Symbol(),0,14,0); 
     for(int i=1; i<100; i++) 
     {
     atrhist=iATR(Symbol(),0,14,i);
     if (atrhist<lowest)
     lowest=atrhist;
     Print(atrhist);
     }}

Do you really want to include the incomplete ATR value for bar 0 in your calculations?

 
GumRai:

Do you really want to include the incomplete ATR value for bar 0 in your calculations?

no.... but im guessing i just change the iATR setting for that at lowest.  thank you very much for your assistance. 
 
    double atrhist;
     double lowest;
     
void atrcheck()
{     
     for(int i=0; i<100; i++) 
     {
     atrhist=iATR(Symbol(),0,14,i);
     if (atrhist<lowest)  << what is the value of lowest at the start of the loop?
     lowest=atrhist;
     Print(atrhist);
     }}
Reason: