General Topics
Markets
Technical Topics
Brokerage Firms
Community Lounge
Site Support

# Help needed with probability math

Discussion in 'Automated Trading' started by braincell, Nov 18, 2011.

1. ### braincell

This is a question for those good at Math and probability. It has to do with probability distribution and probability mass function.

Now, let's say we have two trading systems; System1 and System2.
Each places trades for 5 days and these are the end of day profit results:

System1:

1: +210
2: +90
3: +20
4: +70
5: -340

Total System1 = +50
Average daily = +10

System2:

1: +20
2: -10
3: +15
4: -5
5: +30

Total System2 = +50
Average daily = +10

--------------------------------

On the face of it, both systems are equally profitable. However, the price distribution on system1 is much wider than system2, indicating
there was an element of luck involved. This means that the true profitability (predicted forward) of system1 should be lower than system2,
if we were to adjust according to the risk and unreliability of the results.

I am using only 5 days for the sake of simplicity, but sample size will be a constraint in real testing also.

Question:
What is the probability that the next (6th) day will be +10 (average daily) for system1 and system2?

I expect that it will be higher for system2 and lower for system1. How would I calculate exactly by how much?

I tried using the probability distribution formulas but i haven't had any luck. I'm overworked and underslept for the last few days and
this just isn't getting through to my brain. I normally solve these things myself but for whatever reason my brain is just stuck on a seemingly simple problem.
Embarrassing.
Any clues will be appreciated.

PS
I'm not even sure i'm approaching this problem correctly, or that it has so much to do with probability. Maybe i'm just using the wrong formulas.

Thanks.

2. ### rosy2

i get 50% for both

scipy.stats.norm.cdf(10,mean(sysone),std(sysone))

3. ### DontMissTheBus

The easiest (and most naive way) to do it is just with conditional probability.

For system 1: prob(t=6, pnl>+10|t=1...5) = 4/5
For system 2: prob(t=6, pnl>+10|t=1...5) = 3/5

The amount of effort to improve on the estimation using this method rises dramatically... and not necessarily better.

4. ### DontMissTheBus

The problem with your approach is that you are using a guassian normal approximation for returns that are clearly (by construction) not normal.

A nice illustration of how one needs to be very careful with this sort of analysis.

5. ### abattia

Re-sorting the trades in increasing size order, and then plotting cumulative frequency for each system (I have no idea how to upload my plot of this ... sorry), shows that System 1 produces a higher proportion of trades greater than +10 than does System 2 ...

So I would conclude P(t=6, PnL>+10) is higher for System 1.

Here are the sorted trades for each system

Sys 1: -340, +20, +70, +90, +210
Sys 2: -10, -5, +15, +20, +30

To the OP: Am I assuming correctly that your question is "which system has a higher probabilty of next trade at least +10"?

6. ### braincell

Heh, you guys are coming up with the same solutions I considered.

@DontMissTheBus
Yes, conditional is interesting but consider having values of: +11,+11,+11,+11,-3000. Is that system still better than system2? Guess not.
Maybe I didn't phrase my question properly though. Common sense would indicate that in the case of such extreme values, the next one is most likely to be somewhere around -1500 (similar to avg). Perhaps i need to weigh them somehow. Not sure.

@abattia
Yes, we can assume that we are looking for the probability that the next trade is >= 10. But this makes system1 better. This is exactly why i chose the values I did. I would prefer to have system2 as better.

Perhaps this isn't about probability at all! Maybe i'm just trying to quantify risk aversion.

How would i quantify risk though? (over a small sample)

My idea is to find the amplitude of the distribution (from smallest to highest) and then divide the average daily by the distribution range. Then multiply the AVG by that value. I'm not sure that would work so well though.

Another idea is to create a moving average from between the points in time and find the histogram values, then compare the distribution of the histogram to the average daily profits value. Err... but MA of what length? Do i simply divide by the total histogram value? Or do a sqrt() maybe? Err...

Maybe using the usual risk ratios on a small sample would work just as well. But the problem isn't using risk ratios, it's how to arrive at a unified "value" of a system? Meaning that this value would need to be a result of multiplication of average daily profits and risk. How do i multiply them?
Does that inherently mean i have to decide on an arbitrary multiplier?

7. ### DontMissTheBus

Well... that wasn't the question you asked. But in response to this new scenario, you can consider using conditional mean (that is, average only the values from your observations that exceed the threshold you care about).

I should caution against the thinking process that beings with "Common sense would indicate that in the case of such extreme values, the next one is most likely to be somewhere around -1500"

It's not. It's entirely dependent on the nature of your returns process. If your returns process is iid (unlikely) or mean-reverting (very likely), you would be entirely wrong. (keep in mind that while volatility tend to cluster, returns do not).

So, a more complete to your problem as you now pose require that you define some sort of structure on the nature of your returns - most likely based both on empirical observations and the system that generated them.

8. ### braincell

I mean, if i just did:

Score = Average Daily Profits * Sharpe Ratio

that wouldn't be quite relevant as i would need a linear scoring system. that wouldn't be linear. or would it?

9. ### abattia

Use Sharpe Ratio?

On basis of a simplified approx calculation (assuming risk free rate = 0%) using...

Annual SR = SQRT(250) * AVERAGE(daily PnL) / STDEV(daily PnL)

I get

Sys 1 SR = 0.8

Sys 2 SR = 9.3

Sys 2 looks much better on this basis.

10. ### braincell

Yeah. I know what you mean. For example systems with huge stops get a returns distribution curve which has the biggest peak at a slightly positive value, another smaller peak at the one stop level (negative), smaller peak at 2xstop, and another smaller peak at 3xstop, etc. This is assuming a fixed TakeProfit/StopLoss ratio within a simple system.

I have no idea how to quantify the "prefference" of each of the curves. I'd like them to be close to normally distributed with a positive mean. How to measure the distribution curve and quantify its "quality" is really the advice i'm looking for. Quality is subjective and depends on risk aversion within a specified period. How on earth do i define that? Look in the mirror and ask myself?

#10     Nov 18, 2011
ET IS FREE BECAUSE OF THE FINANCIAL SUPPORT FROM THESE COMPANIES: