calculate the maximum value of an indicator at current candle not for previous candles

 
hi I am kind of beginner in coding , i try to code my first serious EA , i try to calculate the maximum value of an indicator at current candle not for previous candles i want to calculate maximum cci value on the current candle and keeps the value of maximum i tried to make a dynamic array which populated by the all ongoing cci values of current candle which fluctuate so i can get the maximum value for it by ArrayMaximum but i can' t populate that array , it always get the current cci value only not all cci values in the present candle i tried many solutions but it doesn't work at first is it possible to calculate maximum indicator value on running unfinished candle ? how the idea of doing that could be ? thanks
 
  1. Do or do not, there is no "try." There is no calculate.
  2. Each tick, get the value. Store the maximum in a global or static variable. Reset on a new bar.
  3. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help 2017.04.21
 
William Roeder:
  1. Do or do not, there is no "try." There is no calculate.
  2. Each tick, get the value. Store the maximum in a global or static variable. Reset on a new bar.
  3. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help 2017.04.21
Thanks for your reply. It seems promising ,  will  update. My attempt