I'm trying to write a trinomial tree option pricer for European style kickout options. I'm in the process of teaching myself C++. My problem is that part of my code assigns the variables pu,pm,pd values(these are the up, middle and down risk-neutral probabilities for the tree), but when I use a formula to assign the values it disregards the first part of the eqn. Here is what it looks like:
double pd; //down probability double pu; //up probability double pm; //middle probability double S[250][250]; //stock price at node i,j double c[250][250]; //option price at node i,j double up = 0.0; //up movement double down = 0.0; //down movement double dt = T/N; //time step double drift= rate - div - .5*vol*vol; //drift pu = (1/3) + (drift/vol)*pow(dt/6,.5); pd =(1/3) - (drift/vol)*pow(dt/6,.5); pm = (1/3);