Trading Systems Part 6 - Basic Manual Simulations in Forex and Futures
We are going to apply the techniques discussed in the previous story to show how to simulate a particular market. What we are looking for is an optimal risk/reward multiplier, RR. In the real world, however, we more often find complications.
I will be writing other stories on this topic because this is a major focus of our web site: Pagoo or Playing A Game Of Odds.
However to begin, let's take an example where an optimal multiplier may not exist because we all want to remain sceptics about this whole approach. What do we do when our method does not work out easily?
The first step is to find a chart you want to trade where a trend reversal has recently taken place. This means you can enter early enough to profit from the remaining trend. As noted earlier, you may have a notion of why that trend reversal is occurring. As a result you may have reason to believe the new trend is tradable. By 'tradable' I simply mean that the target price of the first signal is achievable.
For our purposes, let's take the S&P 500 where the market has been in a longer term uptrend from 2009 but suffered through a period of correction from 2014 through 2016. As you can see from the chart below, at point A a trend reversal takes place, made evident by the faster 100 period moving average, MA(100), crossing above the MA(200). You are free to choose whichever relevant MA periods you prefer, or just use price action cycles, or use a regression line or whatever makes you confident the trend has changed. Crossing MAs is just an example I use here. Mistakes are allowed and you will see the outcome of those when you do your testing.
We can readily see the S&P is in a solid uptrend but we did not know that at point A. In fact, all we knew was that the S&P had been uptrending for many years and had recently gone through a correction. For all we knew, the correction might have become deeper. Once the MAs crossed, we acted as if the uptrend had resumed. That's all we needed to know.
Pin bar example
For our first example of a system, let's use the pin bar signal. It's a popular candlestick pattern and many traders already make use of it.
The second step is to mark every hanging man candlestick on the chart. A hanging man candlestick pattern has a small head and a long lower tail. A bullish pin bar is just a hanging man with a prominent size and location to distinguish it, but that will be clearer as we work along. Each hanging man has been marked with a green arrow. Now let's filter out the candlesticks that do not meet our basic criteria for a pin bar:
- Ignore hanging men outside the range of the MA cross: marked as red 'OR'
- Ignore hanging men which have no retrace with at least two previous red bars: 'NR'
- Mark the spikes which seem too extreme: 'S'
That leaves five candidates that qualify as signals. The spike is disqualified partly because it is not preceded by several down bars and partly because the target price may be so far above today's market that achieving that TP seems improbable - and probability is the name of the game. Pin bar #3 barely qualifies, but it does have two prior down days but is not as prominent as we would like. Pin bar #5 does not strictly qualify but is 'rejecting' the area below the MA(100), which gives it a measure of confluence.
Also note that if we lose the second trade we will be out of the market until we reenter for the third trade. During that period there was a big rally in our direction. There's an earlier engulfing pattern in the first week of December 2016 that we could add, but then we need to examine all engulfing patterns as entry candidates otherwise we would be selecting patterns based on hindsight. I will just keep this simple for now, but this is the sense in which I mean a pin bar signal is not complete.
The third step is iterative: starting at an RR multiplier of one, consider each trade in turn in the order it would occur in a live trade scenario. We will mechanically simulate what would transpire given our setup and the calculated TP. We will hold that position, opening no others, until it is either stopped out for a loss or triggers our TP for a win.
To show the mechanics, I indicate the risk of each trade in the table below, where the risk comes from the OP of the following time period less the SL given by the bottom of the pin bar. I always move the SL a few points beyond the bottom of the pin bar so that my stops would survive a challenge at the same price as the pin bar low. I will count any final open position as a loss because I want to be as sceptical as possible in the simulation and I have no other way to handle it until it's closed or the trend ends.
The starting conditions for this table are:
- A maximum risk of 2%, assumed to be $100,000 here
- A Risk Reward ratio of 1:1, or RR=1, so that the TP is 1 x Contract Risk
- We are trading the ES mini S&P500 contract with a contract size or CS=50
- The columns are just the setup parameters except for the final two result columns.
Total wins 5/5 $7585
We went over the risk limit by 3% on trade #2. A small amount is acceptable but in general avoid extra risk of more than 5%. Also note that we were able to open all trades because each trade reached its limit before the next signal was reached. It's unusual to get five wins in a row but that is a consequence of the strong trend and the fact that we only required an RR of one. A low RR means the market was more likely to reach the TP.
The fourth step is to repeat the simulation, raising the value of RR by a small step. Let's run the simulation again, this time with an RR=2.
Total wins 4/5 $11,135
Even though we were stopped out of one trade, we received double on the remaining four so our wins exceeded the results of the first simulation. We can conclude for this market under these counditions that holding out for an RR of two times risk is more profitable.
Let's run the simulation again, this time with an RR=3.
Total wins 3/5 $8,735
Step five is to compare our results. When we raise our TP to three times our risk, the total profit falls compared to the case with two times risk.
Because our wins fell compared to the previous round, we would normally turn to target that area 1 < RR < 3 and iterate in smaller steps to focus in on an optimal value of RR. This final Step six would result in an optimal RR.
However, in this case, it's worth looking further since this market has been in a long term uptrend. In fact, the S&P 500 climbed over 25% in this same period and it seems that a win of only $11K out of $100K in funds is too low, even if we only risked 2%. Others who are 100% invested in the S&P stocks have made about 25%, but only if they close now. In contrast, we are fully cashed up. Still, 25% is better than 11% so let's see what is going on here.
First, note that in the previous simulation with TP set to two times risk, we won four times receiving twice our risk for each. So in total we made roughly eight times our maximum risk (4 wins x 2 x $2K), except for slippage cause by rounding down. So let's try to see if taking a trade with an RR=8 will win:
Total wins 2/5 $19,935
Trade #4 was skipped because we still had trade #3 open and one of our rules is not to go over 2% risk. Not only did one trade win at RR=8 but we managed to win two trades.
Almost $20,000 is a substantial profit for a $100,000 portfolio that never risked more than 2% per trade, although by trade #3 we were down potentially 6%. The system I have used above is one of the simplest. It uses a crossing MA to detect trend reversal and just one type of candlestick, the pin bar, as a trade signal. There's clearly huge potential for improvement.
The gains took place over 16 months and the trend is not yet finished. As it finishes you can expect to surrender some of that profit as what appear to be retracements turn out to become trend reversals that trigger stops.
At some point it will become clearer that the uptrend is over and either a period of consolidation or a downtrend ensues. At that stage you can stop opening positions on signals. Until then the system does need to book profits to pay for the coming losses, or you could stop now until the next uptrend starts. Whatever you do, you must be consistent so that you can evaluate your performance and make necessary adjustments for the next trend you trade.
If we look at the chart, something we can only do in hindsight, we can see a number of pin bars have not yet had their lows retested and the chart is currently trading at all time highs. That means that any RR multiple would work, as long as we closed our position now to lock in those profits. But how do we approach this problem before the trading takes place?
If we knew the path of prices from the outset with clairvoyence, but determined to only enter trades based on pin bar signals, pin bar #3 would be best because it has furthest to run without being stopped. Yet it is also possibly the weakest shaped pin bar on the chart: small, does not protude from surrounding bars, is in a tiny retrace, is far above the moving averages, and so on. A reasonable pin bar trader would reject it. A position opened on pin bar #3 and held until the last day of trading would yield almost 18x risk, or $27,390 here because of rounded down contract sizes ($765 x 2 contracts x 18). So the optimum RR for this leg of the bull market in the S&P would lie somewhere between RR=8 and RR=18.
But you cannot know about this single pin bar in advance. When you see RR numbers going over five, stop and examine the situation further. Your entire simulation cannot depend on one outlier.
This chart is typical of the S&P 500. It represents stocks that have risen consistently for a century. The growing companies that comprise the S&P together with general price inflation, cause the index to be in a solid uptrend. There is no guarantee this will last but with all time highs being posted daily, it's unlikely to end anytime soon.
The current rapid rise we are witnessing is at the high end of its previous performance, comparable to the post Soviet Union bull market of the 1990s. This suggests that expecting an eightfold increase or more for a pin bar could be unrealistic for other periods. You need to go back further and run the same simulation in earlier time periods. This is the time to break out your programming talents, for those that have them. Even a spreadsheet would make short work of this data and the worksheets or programs could be reused on other markets and time periods.
If you don't have the time or inclination to program a simulation, print out the charts and user a ruler to find where stops are triggered. Do rough calculations for the trade risk and TP levels and avoid laboring over decimal places unless necessary for the market in question. The advantage is you will have a permanent record for your files.
To begin our exploration of systems, I have picked an easy chart, although it is absolutely current and has some tricky quirks. Most charts will not be so easy because very few markets at the present time trend so strongly without pause. When inflation picks up, commodity prices should resume their uptrend.
When we turn to other markets that don't trend so strongly, we will see that there is often an optimum RR somewhere in the range one to five. It's up to you to find that optimum so that you can calculate the TP for the setup tool.
In the first series on "The Basic Setup" I showed you how to bring together all the key components of a trade setup except the target price, TP. We have now come full circle, calculating an optimal risk/reward multiplier, RR, and therefore a TP that completes all the elements you need in the basic setup. Now with the basic setup in place you should be able to apply it to your preferred signal method and estimate an RR as input into a system of trades.
Perhaps what you discover by measuring the results of your system under different RR values will lead you to calibrate the approach you have been using up until now, or even to change to a different signal method. That's all part of learning and trading.
None of these methods or ratios are permanent fundamental constants of the universe in the way that mathematical pi is. In fact you can expect RR and some of the signal filters to change over time and between markets.
However if you apply your time and energy to investigating the trend and measuring the performance of your system rather than constantly second guessing every trade and whether you should take profits or move to break even, I believe you will be far better psychologically equipped to make profits in futures and forex. Micro managing trades will cause you to make so many mistakes you will lose confidence in your ability to trade anything. Aside from excess leverage, there is probably no greater impediment to trading than poor psychology and implementing a system will help you see that.
In our future stories I will apply the methods detailed above to calculating the optimal RR for other markets. I will continue to pick tricky examples, such as ambiguous trends or markets consolidating, because that's where I believe there is the most to learn.
Although the PagooLABS site is educational and does not advocate any position in a futures or forex contract, it is important to present the following disclaimers as additional information. Trading these markets can be risky and you must be aware of the following:
U.S. Government Required Disclaimer Commodity Futures Trading Commission Futures and Options trading has large potential rewards, but also large potential risk. You must be aware of the risks and be willing to accept them in order to invest in the futures and options markets. Don't trade with money you can't afford to lose. This is neither a solicitation nor an offer to Buy/Sell futures or options. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this web site. The past performance of any trading system or methodology is not necessarily indicative of future results.
CFTC RULE 4.41 "These results are based on simulated or hypothetical performance results that have certain inherent limitations. Unlike the results shown in an actual performance record, these results do not represent actual trading. Also, because these trades have not actually been executed, these results may have under-or over-compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated or hypothetical trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profits or losses similar to these being shown."
Copyright (C) PagooLABS 2017. All Rights Reserved.