Posts Tagged ‘probability’

Trading System Thoughts: Context and Using Cumulative Tick on ES/NQ

June 21, 2010

My time is being stretched in many directions–custom projects, donor requests, beginning iPhone app development, and working on my own trading skills. This post is one focused on my recent trading thoughts.

First, an unsolicited testimonial. I’ve been part of Richard Todd’s Move the Markets Team for a while now. I find it to be incredibly valuable. If you are looking for a community of experienced traders that are serious about improvement, both of themselves and of newer members, look no further. I recommend it highly. There are a lot of free areas to start with, and if you want to go deeper, he charges a modest monthly fee for full access.

As part of a conversation I had recently with Richard, I was once again reminded about the importance of market context. As I talked about in my WWJT posts, in a trending market, almost ANY trend-following setup will work. In a choppy environment, almost ANY trend-following setup will die horribly. The specific setup DOES NOT MATTER. There is no “best” set of parameters to filter out the losers on a setup basis. The problem is not with the setup, it’s with the market context. A raincoat is not the best clothing to wear on all days, just on rainy ones. Flip flops are ideal footwear on the beach, but not for climbing Mt. Everest. You pick your clothes based on the weather context you expect to encounter. Don’t agonize over whether a blue raincoat or a yellow raincoat works best, and don’t look for the magic set of sandals that keep you warm even on a snowy day. Metaphor overload, core dump…

The most important thing is to identify when the markets are likely to trend, and then to apply a trend-following setup (buy a pullback in a trend, buy a breakout, etc.) or sit out. Conversely, identify when the markets are choppy and listless, and apply a range-bound setup or sit out. I have demolished myself in the past two Augusts by playing dummy trades (trend continuation) in a seasonally flat and choppy market. I get stuck in the trap of obsessing over the entry, target and stop parameters, so I needed this reminder to get back on track.

I believe your time is best spent practicing contextual skills rather than mining for the Holy Grail setup or magic parameters. Try these steps:

1. Become proficient in identifying chop and trends after the fact. This one should be relatively self evident. Look at the day’s chart after the close, and annotate where the trends were, and where the chop was. Continue to do this on intraday charts until you can do it instantly and effortlessly.

2. Go to live data and practice identifying whether the market is in a trend or in chop RIGHT NOW. Don’t worry about if the market is going to keep trending or keep chopping. Just correctly identify what it is currently doing. Continue until you can do it instantly and effortlessly.

3. The last step is to start to try to predict what is likely to happen next during the day. Will the trend be likely to continue? Will the range probably be broken? Many things can give clues to this including volume, time of day, support/resistance levels, tape speed, pending news announcements, and so forth. Along the way you should also gain the skill of predicting whether a trading day may be trending or choppy before the day begins, and also knowing what events and price levels would imply a change to that prediction. This one can take years of screen time to become proficient. Patience and work are needed! I have started to notice myself having the beginnings of this skill. I can only chalk it up to screen time. Watching what has worked, what has failed and what has generally happened in the past. Feeding years of price data into the most complicated neural network there is: the human brain.

Note that in all of these things, I have mentioned words such as “likely to continue” and “probably”. None of this is an exact, deterministic science! You also have to be able to think, make decisions and accept outcomes probabilistically. That means that the specific outcome of any one event does not determine whether a probabilistic decision was the right one or not! In a deterministic situation, the outcome judges the decision. Gravity always pulls you down to the earth, 100% of the time. Jumping off a cliff is always a bad idea, because you will always plunge to the bottom. In a probabilistic situation, it’s the odds up front and the information you had at decision time that say whether a decision was the right call or not. The odds will play out to a degree of “rightness” in the long run, even though you may be taking a beating in the short run. This way of thinking is very difficult for many to attain, including myself. My Outcome Simulator is one tool that can help. The excellent book Trading in the Zone: Master the Market with Confidence, Discipline and a Winning Attitude by Mark Douglas is another good resource. But unless you are hard-wired this way, and most of us aren’t I would imagine, this takes PRACTICE.

Now, I’ve been watching the cumulative tick on ES 5 minute charts. I’ve noticed a couple of things. Assuming that the context is a trending market, the cumulative tick does well at picking the trend direction and also giving an entry spot. If the cumulative tick changes from bearish to bullish, then buying the first DOWNWARD tick spike across the average of the tick lows gives a great entry point. You are basically buying the first pullback in what you hope turns out to be a new uptrend, but are using the tick to tell you when the pullback is in play instead of choosing it based on price alone. If you continue to get downward tick pressure on the next bars, that clues you in that the uptrend may be failing. Otherwise, buying should pick back up and you have a winner in very short order. This strategy would work great with a partial exit, taking some off after some number of points and trailing the rest. Here’s an example paper-trade I took in the NASDAQ-100 e-minis (NQ) today:

I bought the gap fill on a tick downspike (gray oval). The tick downspike is the entry signal, but the reason for the trade is the context: I didn’t buy the first downspike because we were still in space over the gap. The second tick downspike was the first retrace to yesterday’s high. Also, a strong opening gap = bullish tones for the morning, so that said to fade the downspike, not go short. I expected a bounce, and we got it, all the way to new highs, even! Opening gaps that clear the prior day’s highs and lows are typically strong. Gaps inside the prior day’s range are less so.

Back to the trade: Ended up “buying” 1 tick above the day’s low so far (!) I traded 2 contracts, both with a 2 point initial stop. One I “sold” after a 3 point target (first green oval) and the other I put on a 3 point trailing stop and “sold” much higher (second green oval). Net +12.5 “points”.

I’ll be posting more charts and a modified cumulative tick indicator sometime over the next week. I’ll also be working on my market context skills, because that is the only effective way to minimize your losing trades, and is the foundation to using a setup in the right way. My ultimate goal is to choose a trending setup and a chop fade setup, know when to use them, and then consistently apply them, accepting the outcomes as they happen. That should be my last hurdle to arrive at net profitability. It’s been a long, hard journey, but I think I can see the oasis from here!

Practicing with Probabilities: Outcome Simulator

June 15, 2010

I struggle with really internalizing probabilistic thinking, especially when trading live. I can understand the math and the reasoning–I’m a freaking rocket scientist after all. However, a rocket scientist is trained to NEVER be wrong. A trader must be trained to be “wrong” quickly and relatively often, and accept it and move on with their system. Staring a loss in the face (or even worse a string of losses) shakes your ability to believe in it. You doubt your system, and you doubt yourself, and that’s when impulsive revenge trades can come in and you blow yourself up. It takes practice to overcome your emotions, at least for me.

Assuming that you have researched a strategy, know when it should work and when it doesn’t, and are consistent in applying it, if you stick with your plan then the law of large numbers can come into play and your edge can pay off. But how do you know if the edge has changed? If you usually win 70% of the time, but start to win only about 30% for a few days, do you pack it in, or keep going? What if you start a new system? How many trades are enough for your hoped-for edge to show up in your outcomes? How many are too few to call it quits?

I created a tool to help myself practice these things. My Outcome Simulator lets you make simulated “trades” by clicking a button, and see how the results come in based on different probability settings. Hit the “Reset” button to start over. There are three modes to use it in:

1. Targeted distribution–you put in a desired win percentage for a group of 100 trades. A possible distribution is created that is close to your target. The wins/losses are assigned to each of 100 toggle buttons. As you click, they show if you won or lost, and your realized outcome distribution is shown. If you click all 100, your realized actual outcome will match the possible distribution, but for the first few trades the realized outcomes can be far different, as these screenshots show:

2. Random distribution–this mode creates a distribution at random between 0% wins and 100% wins. You can then see how the realized outcomes roll in with those kinds of rates.

3. Hidden distribution–In this mode, a distribution is chosen either targeted or at random, but it is hidden from you (targeted is kind of pointless running hidden, since you put in the number, but oh well). You could be looking at a net winning set, or a net losing set. Click to see outcomes, and try to decide from those if it’s a winner or a loser distribution. Then click the “show” button to pretend that you are quitting trading, and to see what the actual distribution was. When you click show, if the true distribution was below your actual results, then you made the right call, and quit while you were ahead of the possible. Even if you were a net loser on outcomes, if you did better than the true distribution you made the right decision to stop! Conversely, if you were a net winner, but the true distribution was better than your outcomes, you should have kept pressing. It was the wrong decision to quit. You should begin to learn to value the rightness of a decision based on what you knew at the time and in aggregate rather than what the individual outcomes of each “trade” are. It can also tell you a lot about yourself. If you have a run of 5 losses, do you get impatient and start clicking like mad? Revenge trader. If you have a string of wins, do you get fearful and hesitate to click more?

Using the hidden distribution mode can simulate what it’s like to start trading a new system. You don’t really know what actual outcomes you are going to get when you start. In the markets, there is no set “true” distribution. The odds are always changing. But this simulator can give you practice in coming to the decision to stick with a system or bail on it, as well as a feel for how many trades it takes to get a reasonable level of confidence in a system’s viability. For the chronically conservative, this can give you practice at sticking with a well reasoned concept even if you see a string of losses right out of the gate. Then you should be able to get over the hump instead of going back to the drawing board and tweaking setup parameters ad infinitum looking to filter out all losses. This tool is more about training your brain and emotions than predicting or modeling the markets, which I would argue is the most important foundational thing to do before any trade system work.

Of course, the emotional side of being wrong is not really present in a simulation. I can arrange for you to pay me every time the tool beats you if you need me to 😉 But seriously, if you do this enough times, it can help condition your mind to think this way and accept outcomes as they happen under your larger system goals.

This tool is freely available under “Released Tools” at my Google site. If you feel this is valuable to you, please consider a donation to my blog.


Greed and Fear Revisited: Outcome vs. Opportunity

September 19, 2009

In trading, Greed and Fear are often condemned by many people. Greed is thought of as a companion of Fear, and both are considered to be bad when found in traders. I want to propose a different way to think about Greed and Fear. I agree with Mr. Gekko, that Greed is good, and I will go even further to add that Fear is good, also. However, they are only good for you if you are greedy and fearful of the right things. Otherwise, they are vices and not virtues.

My trading psychology in the past has always been this:

A mindset of maximizing my profits (or winning trades) and minimizing my losses (or losing trades) right now on THIS trade.

This mindset is focused on the outcome of the current trade. I believe that an outcome-based mindset (whether it’s P&L focused or win/loss focused) is where Greed and Fear cause us to fail as traders. The flipside is that this same mindset is also the source of profit for many successful traders, as they fade the losers.

I submit that traders SHOULD be greedy and fearful, and that the following should be the mindset for a successful trader’s Greed and Fear:

A mindset of maximizing your exposure to profit opportunities (Greed), and minimizing your exposure to loss opportunities (Fear) at all times and in all trades. (more…)

Monte Carlo Trade System Simulator

April 2, 2009

There’s a lot of discussion out on the web about trading system expectancy. I first heard about it from Trader Mike, and then in Van Tharp’s Trade Your Way to Financial Freedom. If expectancy is a new subject to you, read Trader Mike’s excellent article for definitions and details. Short version:

average win rate * average amount won – average loss rate * average amount lost = expectancy

Or average expected profit (or loss) per trade taken.

So say you know the theoretical or historical expectancy of your system. What could really happen when you start trading (or keep trading)? How many losses could you possibly see in a row? How many losses will you get in a row on average? What happens when the law of large numbers meets a relatively small number of trades (like 200)?

There is a trap in treating expectancy as gospel. It is this: “Past performance is no guarantee of future results!” Taking a series of past trades, you can calculate a historical expectancy. The number accurately describes these actual trade results. However, the expectancy of a trade system is a living thing. Each future trade outcome is unknown, and unknowable. Literally anything can happen. Therefore, system expectancy should be:

1) Monitored and updated as trades are taken to ensure the system remains as you have tested and experienced it,

2) Given uncertainty bands that are representative of different probability outcomes over small trade samples.

Number 1 just protects you from a system that stops working, or alerts you that conditions are changing and your strategy needs to adapt. Number 2 is something that needs a bit more thought. Over a very, very large number of samples, the outcomes of actual results will approach the odds of each outcome happening–the expectancy will match your outcome. But over a very small number of samples, there can be wide variation in what should happen according to the odds, and what does happen in reality. Here’s a few examples:

Say I’m flipping a coin. 50% odds of heads (H), and 50% odds of tails (T). If I flip this coin hundreds of millions of times, probability and expectancy say I should have very close to 50% heads and 50% tails (0.5H and 0.5T). No problem. What if I flip only once? I will have either one heads (1H) and zero tails (0T), or 0H and 1T. Only two possible outcomes. That’s not a 50/50 distribution. But this is a trivial example. Who puts on just one trade? You do, each time you trade. You could get zero or 100% as your outcome. You can’t judge a system on one trade, just as you shouldn’t judge yourself by the outcome of one trade!! (This is written for my benefit as much as yours.)

Back to the example: How about with 3 flips? There are 8 possible and equally probable outcomes now: TTT, HTT, THT, TTH, THH, HTH, HHT, HHH. Now we’re getting more complicated. If you guessed heads each time, you could end up with 0 wins, 33% wins, 67% wins, or 100% wins. Not exactly 50/50, but better than the results for 1 flip.

Lets move on–what about 200 flips? Rather than do that by hand, I used my Monte Carlo Analysis tool. This tool simulates a series of occurrences to get the outcome distribution, then does it again and again, as many times as you specify. Each simulation is a randomized outcome based on the odds of each result happening (win or loss) over a series of trades. If you repeat the simulation many times, the variations of outcomes can be seen. We let “reality” present itself rather than try to predict and model what will happen. That’s what Monte Carlo methods are all about.

Here’s my results for flipping a coin 200 times in a row, and then repeating that experiment 100,000 times (took 44 minutes to run):


By way of explanation, refer to the chart legend:


Each point of the green line is the peak net profit encountered for that trade over all 100,000 simulations. Similarly, the red line is made from the peak net losses encountered at each trade. No one outcome distribution matched either of those lines. Rather, it is a composite of all 100,000 simulations for each of the 200 trades taken. Most trade outcome distributions will fall within these lines, though they may touch them at some point. The probability of reaching this envelope is much higher in the beginning few trades, and gets less and less likely as you get more and more samples and the law of large numbers kicks in. The white line is the simple midpoint of the high and the low PnL lines. The blue line is the current outcome distribution for the last 200 trade simulation that has been run.

As you can see from the overview picture, over our large sample size (20 million coin flips overall) the simple median outcome distribution is very near 50/50, though any random group of 200 outcomes can end up above or below that. Also, note that the largest losing streak encountered was 22 in a row! The average losing streak was 6.98, meaning that over 200 trades with these probability parameters, it is common and actually likely that you will see at least 7 losses in a row. If you risked 15% of your capital on each trade, you would have even odds of blowing out your account. If you risked only 7% of your capital per trade, you would on average experience at least one 50% drawdown at some point during the 200 trades. Also note that every single simulation had a losing streak of at least 3 in a row. So if you get three strikes, you’re not out, you’re just living in the world where reality meets probability. Seven losses in a row? Par for the course for flipping 200 coins, on average.

After running the 100,000 simulations to populate the red and green lines, you can Re-Calculate a new 200 trade run to see how it stacks up next to the extreme values. Here are a few more interesting plots showing some different outcomes that can happen:




All 50/50 theoretical odds, yet you can be a net winner, a net loser, or some of each over a finite number of trades. This also says to me that a small edge, e.g. 55% win, 45% loss, is no better than random chance over small (i.e. real life) sample sizes. High consistency beats sporatic home runs, hands down.

Now imagine if you had a system that only had a 33% win rate, but an average win amount to loss amount ratio of 3:1? That has a positive expectancy, but real life could bite your head off with a streak of 11 losses in a row on average! Look at this outcome, where you got 74% losses instead of the expected 67%:


Ouch. Did you “expect” that outcome? BOOM HEADSHOT!

The need for systemic risk management becomes clear; you need to know more than just “where’s my stop loss on this next trade”. You also have to size your positions to withstand the likely string of adverse outcomes (commonly known as a run of bad luck). You must also forge your psyche to withstand the losses or wins that will probably come to you in groups. Again, this is for me as much as it is for you. In summary, if you make something like 20 million trades, your results should match your expectancy, and your broker will be rolling in a pile of money. If you take a more realistic number, like 200, not so much. All because probability is an average over very large samples, while each trade is a binary: 1 or 0, all or nothing.

So what sort of variance could you see with your current system’s expectancy? What edge do you need in terms of win rate vs. loss rate, and average winner vs. average loser in order to make sure you don’t draw down your account dramatically? How much (or how little) of your account should you risk per trade to deal with the number of losses in a row your system may (and probably will) encounter?

Download MonteCarloAnalysis.xls* and find out! Remember to enable macros.

*By downloading this, you agree that Prospectus is awesome. And that you should some money. And you never call anymore. We used to be close…