Hi,

I would like to use the change value of the current day in my Indicator.
My custom Data class derives from TradeBar and I added the Change decimal property.

So lets say I would like to use it in an indicator instead of the default Value(Close price).
How can I do it? I get Errors when Casting it.

Here you can see the Fun<IBaseData, decimal> selector

public SimpleMovingAverage SMA(Symbol symbol, int period, Resolution? resolution = null, Func<IBaseData, decimal> selector = null)
{
var name = CreateIndicatorName(symbol, $"SMA({period})", resolution);
var simpleMovingAverage = new SimpleMovingAverage(name, period);
RegisterIndicator(symbol, simpleMovingAverage, resolution, selector);

if (EnableAutomaticIndicatorWarmUp)
{
WarmUpIndicator(symbol, simpleMovingAverage, resolution);
}

return simpleMovingAverage;
}

I have this class (with some reader and more stuff which I don't mention here)

public class LocalData : TradeBar
{
public decimal Change;
}

I did something like this in the algorithm which didn't work

sma = SMA(Ticker, 10, Resolution.Daily, selector: TestMethod);

decimal GetEntry(IBaseData data)
{
return ((LocalData)data).Change;
}

Can someone tell me how I can do this correctly please?