# Option Pricing Macro/Addin in Excel or R Function to Capture Arbitrary Payoff Formula on Underlying Prices

I am looking for an option pricer in Excel or R package that can price a payoff that could be some formula on the underlying prices and interest rate. This means the option payoff could depend on multiple underlyings.

An example of the payoffs could be, when we have let us say, three underlyings for a American Binary Down and in option:

$(K-S_{1})*r*S_{2}*(T-t)/S_{3}$

Here, $K$ is the strike price or the price where the binary option becomes on. $r$ is the rate of interest. It can be assumed constant if simple or can be any other interest rate process. $S_{1}, S_{2}, S_{3}$ are the prices processes for the different underlyings. They are standard geometric brownian motions. $T$ is the time to expiration of the option. $t$ is the time when the price level is breached and the option becomes on.

Please let me know if any such macro or addin is available for Excel or any package in R that can do this. If my question is not clear or if you need more details, please let me know.