Random walk and Pascals triangle Hi, Im trying to do a bit of theory using a 1 dimensional random walk. Im trying to count the number of paths on Pascals triangle to a node, if I eliminate some of the paths (stop loss). I know without restrictions its n!/(nr)!r! but I cant workout the formula with resrictions on the number of paths. Im basically trying to work out the probability of getting to a node... any ideas appreciated thanks 

thanks. (love wolfram) Think I need a modification though. Looking for proability of getting to a specifice node (or two) to simulate stop loss and take profit. So I can only visit that node once (provided the other has not been visited) and I cant travel past the nodes (enpoints/boundaries) I was going to find the probability of reaching it in exactly N steps, N+1 steps, N+2 steps...... and then sum the probabilities using infinite series. I assign a probability to either direction. So Im really looking for the number of ways of getting to a node in exactly N steps with the restriction that I can only visit that node on the last step. I can do it using Pasacals triangle using a simple method but havent been able to get a formula.... 
Hi Scotty, maybe I can help, but I am not sure what you are actually trying to achieve. Are you trying to calculate probabilities of hitting SL/TP levels or is it something else? If the answer is yes, then counting paths in Pascal's triangle might not be the most efficient method. 
Hi, Yes trying to calculate probabilities of hitting SL/TP. I was looking at a 1 dimensional lattice with the end points being the SL/TP given the probabilities for 'left' and 'right' 
and then use those probabilities to work out EV calculations..... Adding the restriction that the end points can be touched only once is making it extremely difficult (for me anyway) 
Yes, it's a bit tricky. In the academic literature this problem goes under the names of The Classical Ruin Problem and Random Walk With Absorbing Barriers. The two standard methods of solving it are by homogeneous difference equations and momentgenerating functions. You can find a complete treatment of the problem in William Feller's An Introduction to Probability Theory and its Applications, 3rd Edition, pp. 344. If p = probability of 'right' and q = 1 p, then the probability of being stopped out (if starting at i and the SL is a and TP is b) is 1  (i  a)/(b  a) if p = 0.5 [e^(tb)  e^(ti)]/[e^(tb)  e^(ta)] if p <> 0.5 where t = ln(q/p) Hope that helps. 
I will take a look (been a few years since I hit the books) aalthought was thinking about buying Fellers book a couple of days ago. Downloaded Grinstead and Snell's Intro to probability last week and it has momentgenerating functions. Never heard of mgfs them before (generating functions I have). Would Wiener processes be the next area to look at? Can I ask if you're professional in this area or is it from education? Thanks again. 

I don't know if this is of any help, but this is the sort of thing which would be easy to do MonteCarlo simulations on, this will not give you a closed form answer however. 
My view of this conundrum is from graph theory, so please intervene if what I say doesn't relate to what you may be getting at. Assuming "randomness", the probabilities of a position hitting a SL or TP should be exactly the same barring they are exactly k steps from the entry. However, because there would be no reason to even consider this trading method otherwise, there must be some prior knowledge you're basing this on. So you plan to integrate historical data to generate previous probabilities of walks given a vertex in a path has been hit? Compiling data for when price n (/+) is hit, for n equal to the number of pips deviated from the entry may be hard because of the infinite amount of data. However, focusing more vaguely on certain entry levels and let's say n=+/25x when x is a positive integer over a certain pair over a period of 5 years or so may be very achievable. @SL@@price 25@@entry@@price +25 @@TP@ Is this anyone near what you're trying to do? 
1 Attachment(s) With fixed TP and SL and assuming random walk, the winning probability is easy to calculate by using pascal triangle. The real challenge is trailing stop if it is taking into consideration. Here is my excel sheet. Have a look! Btw if anyone have an idea how to calculate the probability by taking trailing stop into consideration then pls let me. Random walk and Pascals triangle.xls 
ForexQuant, extend your 'triangle' to include probabilities of 2R through to 6R, both sides should have the same probabilities. Let's say that you enter a position at 1.000. Think of the Excel cells with given probabilities as vertices and the edges which connect them complete the path in which your position may take. You now should have an idea of probability that your position will land on a certain vertex (+/ #R) and all of the possible paths it may take to reach that point. To include a trailing stop you should focus on how much you want to dump when the price hits a certain vertex and at which step. If you think about it, when the position reaches that point, it realistically should restart the process all over and from there a new 'triangle' (and hence graph) should begin. Why? Because if you disregard the spread, it is basically like closing the position and opening a new one of smaller size. From that point the open position (now smaller in size and negative in value) has the same probability to move to any vertex away from it as if you were to enter a position where you were stopped out. For this open position to move back to a positive value, it now has a farther way to go if we consider where it was actually opened at 1.000, and thus the probability is diminished. What does this mean? If you use a trailing TP with equal preference to the SL, as n trades approach infinity, it should run against you as much as it runs with you, and should hit both you TP and SL equally. And if you don't use a trailing TP, you'll close less positive positions, yet they will be valued more when you do close them, just enough to offset the cost of your trailing stops. So, although it may appear that trailing stops would produce larger gains...it's because there are so few that it wouldn't matter. No profits and no loss (except spread) because random walks, after all, are random. 

I wanted to do EV calculations so EV = risk*P(stopped out) + reward*P(take profit) and wanted to see how SL and TP affected the EV calculations. I then wanted to see if/how including a move of the SL to breakeven affected the EV calculation. If I had the formula (thanks Medici) I can write an array formula with a range of probabilities, SLs and TP. The problem is assuming each step to the right has the same probability but Im only using it over a relatively small number of steps. Started out as a curiosity...... 
2 Attachment(s) hi 1i (Guess who!), The previous excel sheet is for that particular case (6R to 2R) because I only calculate the probability of 100 steps since the probability of every single node above 100 steps is too small for that case and can be ignored. In fact the correct calculation should take infinite steps if you want to consider all kind of cases. Anyway I have revised my excel sheet for 2000 steps. I believe it is good enough to handle most cases that happened in forex trading. Random walk and Pascals triangle R1.xls 

EDIT>You got it. 

© Forex Factory