Lookback feature for EMA and MACD

 
Hello All. I'm new here so I apologize if this question has asked but here it goes... I'm trying to figure out if I there is a way I can grab the past values of EMA or MACD using candlesticks as an increment. Or would it be easy to build an array and store the values real time?