each day you two things can happen. either the price goes up or down. There are two ways that the probability $S_4=17$ when $S_2=17$ Either the price goes up the first day and down the second. or it goes down the first and up the second. Since it went up the first day, the probability of the stock going up the third day is .6 and the probability of going down the fourth is .4 . The probability for the second method is.4 the third day and .4 the fourth.
Therefore the probability that $S_4=17$ on the fourth day is $.6*.4 + .4*.4$ = .10*.4=40% What you did is correct.
The answer you where looking for is correct. However as Andrè Nicolas pointed out, Your drawing doesn't add up. However, the result is still right.
Now, for part b, If the stock price on day 5 was 18. What is the probability the price on day 4 was 17? You need to take into account only the paths that take to S_5=18$. How many ways are there for this to happen. The following: (-1,1,1),(1,-1,1),(1,1,-1). Lets take a look at the probability of each one. the first one is:$.4*.4*.6$ the second one is:$.6*.4*.4$ and the thirs one is:$.6*.6*.4$ both the first and the second satisfy the condition. Therefore, the probability is $\frac{2/5*2/5*3/5*2}{3/5*3/5*2/5+2/5*2/5*3/5*2}$ Which is equal to $\frac {24/125} {42/125}=24/42=4/7 =0.\overline{571428}$