I am trying to port the example strategy : Momentum Effect in Country Equity Indexes, written in Python to C#. The results appear to be quite different. Upon closer examination of the ranking table at any rebalance point, there appears to be a discrepancy between momentum ranks in C# and Python (produced by MOM indicator). I've attached the python and C# versions here. Looking at the Debug Console:


Why is there a difference?

I am attaching the Python and C# codes below.