I am trying to construct an algorithm that compares the chosen indicator/metric values of the current bar with those of the previous bars.


I would like to check

if (10 period EMA > 30 period EMA for 3 bars in a row)


if ( close of the previous bar > low of the bar that occurred 2 bars ago)

How would I code these sorts of criteria in C#?

I appreciate any and all help.