Lenny D. answered 07/13/19
Financial Professional with many years of Wall Street Experience
I have no idea what you are coding in. It doesn't matter.
Let S= Spot Price and F= Forward price and σ be Implied Vol. and K = strike. With Lognormal we have the Probability S will be above K at Maturity is
p = N(((lnF/K)-.5σ2)/σ) which is the probabilty you will get $1 at maturity. This has to get discounted back to present value. So the fair value is
e-rtN(((lnF/K)-.5σ2)/σ) w Where N is the cumulative standard normal distribution
I have been intimately involved with options for more years than I care to mention. I have very large Vanilla and exotic option portfolios. If you need help. pleas feel free to reach out.