How can I get RSI_Value in the rsi_Wilder by the IdDate? I sort my rsi_Wilder, so the highest IdDate always will be the last index. Therefore I can do this:
class RSI
{
public int IdDate { get; set; }
public decimal RSI_Value { get; set; }
}
List<Datamodel.RSI> rsi_Wilder = BeregnRsi_Wilder(idVirksomhedensStamdata, BeregnAntalDage: 21);
var lastValue = rsi_Wilder[rsi_Wilder.Count - 1].RSI_Value;
It works fine, but I think there must be a better way/better performance to find to RSI_Value by the highest IdDate. What's the best way to do this?
EDIT: Example.
rsi_wilder.Add(new Datamodel.RSI{IdDate = 25, RSI_Value = 17});
rsi_wilder.Add(new Datamodel.RSI{IdDate = 26, RSI_Value = 26});
rsi_wilder.Add(new Datamodel.RSI{IdDate = 27, RSI_Value = 9});
rsi_wilder.Add(new Datamodel.RSI{IdDate = 31, RSI_Value = 70});
rsi_wilder.Add(new Datamodel.RSI{IdDate = 32, RSI_Value = 55});
I need to get the RSI_Value with the highest IdDate and I don't know the IdDate number. The result I seek is RSI_Value = 55.
The code var lastValue = rsi_Wilder[rsi_Wilder.Count - 1].RSI_Value;
do the job, because the IdDate in rsi_Wilder is sorted from lowest to highest number.