OptF is not equivalent to ProF. If it were so, you could use the ProF instead of OptF, which is much harder to calculate. The .999 looks correct.
OptimalF factors are calculated from the whole balance curve, which the ProF is only the win to loss ratio. Balance drawdowns affect OptimalF, but not ProF.
We also used various formulae for calculating the margin from OptimalF, but what you're using above is the best method.