As the title suggests, I've got indicators which are made from consolidated bars. They were created in a "for" loop as shown below. I need to be able to access the previous value of each indicator (I don't need a window full of them but that may be handy in the future).

In an example in the documentation you can assign a event handler to the consolidator, and inside the event I could modify the value of a dictionary called _prev5min, _prev10min, _prev30min etc etc.Thing is, I don't know how I can attach an event handler to work like this somehow inside the loop (I'd have to pass the value of 'minute' along with it I'm assuming).

The final goal is to do something like check if, between the previous x minute bar and the current one if the values of two indicators crossed. Checking the slope of the lines is also important (is it sloping up, or down) which is just using the previous value vs the current value.

I'm still fairly new to C# and trading algo's so excuse me if this idea isn't explained very well. Any help would be much apprecaited :)

foreach(var minute in new int[]{ 5, 10, 30, 60 })
// Create Consolidator
var consolidator = new QuoteBarConsolidator(TimeSpan.FromMinutes(minute));

// Create indicators
var adx = new AverageDirectionalIndex(thisTicker,14);
var rsi = new RelativeStrengthIndex(14);
var sma5 = new SimpleMovingAverage(10);
var sma20 = new SimpleMovingAverage(20);

// Register indicators to the consolidator to be updated at its frequency
RegisterIndicator(thisTicker, adx, consolidator);
RegisterIndicator(thisTicker, rsi, consolidator);
RegisterIndicator(thisTicker, sma5, consolidator);
RegisterIndicator(thisTicker, sma20, consolidator);

// Add the consolidator to the subscription manager to get updated with data from security
SubscriptionManager.AddConsolidator(thisTicker, consolidator);

// Add ADX, RSI, SMA5, SMA20 to Dictionaries
_adx.Add(minute, adx);
_rsi.Add(minute, rsi);
_sma5.Add(minute, sma5);
_sma20.Add(minute, sma20);;