public static double blackFormulaCashItmProbability(final Option.Type optionType,@Real final double strike,@Real final double forward,@StdDev final double stddev,@Real final double displacement){
  if (stddev == 0.0)   return (forward * optionType.toInteger() > strike * optionType.toInteger() ? 1.0 : 0.0);
  if (strike == 0.0)   return (optionType == Option.Type.Call ? 1.0 : 0.0);
  final double d1=Math.log((forward + displacement) / (strike + displacement)) / stddev + 0.5 * stddev;
  final double d2=d1 - stddev;
  final CumulativeNormalDistribution phi=new CumulativeNormalDistribution();
  return phi.op(optionType.toInteger() * d2);
}

public static double blackFormulaCashItmProbability ( final Option . Type optionType , @ Real final double strike , @ Real final double forward , @ StdDev final double stddev , @ Real final double displacement ) { if ( stddev == 0.0 ) return ( forward * optionType . toInteger ( ) > strike * optionType . toInteger ( ) ? 1.0 : 0.0 ) ; if ( strike == 0.0 ) return ( optionType == Option . Type . Call ? 1.0 : 0.0 ) ; final double d1 = Math . log ( ( forward + displacement ) / ( strike + displacement ) ) / stddev + 0.5 * stddev ; final double d2 = d1 - stddev ; final CumulativeNormalDistribution phi = new CumulativeNormalDistribution ( ) ; return phi . op ( optionType . toInteger ( ) * d2 ) ; }
black 1976 probability of being in the money ( in the bond martingale measure ) , i . e . n ( d2 ) . it is a risk - neutral probability , not the real world one .
