Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

Trailing Stops and Multiple Lots

December 3, 2014 by Richard Krivo 18 Comments

Stop signs

 

This article is going to describe two slightly more advanced trading techniques:  how to trail a stop and how to maximize profits by trading multiple lots.

Let’s cover using multiple lots first…

Since as traders we always want to minimize risk as much as possible, I offer the following cautionary note:  each time a trader adds an additional lot to a trade, they take on more risk.  It may still be only one trade, but the size of the trade obviously plays a part.  For example, if a trader opens a single trade with a 100 pip stop, they take on 100 pips of risk.  If they open the same trade but with three positions, they are taking on 300 pips of risk!  It is imperative to be sure that the size of your account can handle the additional risk.

Here’s a quick way to make that determination…

A trader should never place more than 5% of their trading account at risk at any one time.  When trading a 10K lot, one pip, depending on the pair being traded, is worth roughly $1.  So a 300 pip stop would equate to a $300 risk.  If we divide $300 by .05 we get $6000.  That means unless you have a $6000 account you should not be taking on $300 worth of risk.  Possibly the trade can still be taken but with some adjustments to the size of the trade or the size of the account.  Either the size of the trade can be made smaller or the size of the account can be increased.

Moving on to implementing the strategy…

Since a picture, or a chart in this case, is worth a thousand words, let’s take a look at a historical 1 hour chart of the GBPNZD to see how we can employ our trailing stops and multiple lots strategy.

Trimult1

Here’s how we will trail the stop…

Since the pair is in a downtrend, we could enter the trade by selling three 10K positions at the point labeled  “Short Entry”.   Price has broken through support triggering our entry and the stop would be placed at the “Stop 1” level.   As price continues to move in our favor and breaks below the second green support level, we would close one of our three positions and move the stop to the “Stop 2” level.

By doing this we have locked in roughly 110 pips of profit

We also have placed our stop above a new resistance level so that our two open positions are protected.  Moreover, since our stop is now below our entry at this point, if the pair retraced and hit our stop we would show a small profit on the remaining two open positions plus the 110 pips we gained by closing the first position.  At this point, we have removed all risk from this trade.

As price continues to move in our favor, making lower highs and lower lows, when it moves below our next green support level we would close out one more position locking in a gain of about 310 pips on that one and move our stop to “Stop 3”.  As it was in the case above, we have locked in more profit and, by trailing our stop to the next level of resistance, we are protecting our “floating profit” on the remaining third position which is still open.

On the last open position we will simply continue to trail the stop using the same method as above.  When price no longer continues to make lower highs and lower lows, we will be stopped out at some point as the pair retraces.

So as price moves through the next green support level we would advance the stop to “Stop 4”.

We can see that price did not continue to move lower and, as price retraced, we were stopped out at the “Stop 4” level.  Since our third position had been open since the very beginning of our trade, we were stopped out with a gain of 320 pips on the last 10K lot.

 

Overall, the total gain on the three lots was 740 pips

. 88f3bc060c1fef296b51dca3bbb0e734

Had a single lot been placed on the trade the gain would have been 320 pips.  Now, don’t get me wrong, 320 pips is nothing to sneeze at.  However, given the choice, I’ll opt for 740.

From these examples the potential benefits of manually trailing one’s stop and trading multiple lots is quite apparent.

As always, when trying anything for the first time, be sure to test the concept out in a demo account numerous times until you completely understand the process.

 

All the best and good trading,

Richard Krivo

@RKrivoFX – Twitter

rkrivofx@gmail.com

 

 

Filed Under: Stop losing money, Trading strategy ideas, What's happening in the current markets? Tagged With: GBPNZD, multiple lots, trailing stop

Are You Putting Enough Emphasis On Your Exit Strategy?

December 13, 2013 by Andrew Selby Leave a Comment

Quantitative traders love new ideas. We are always looking for a new strategy that has demonstrated that it has some sort of edge.

Many developers spend a large portion of their time optimizing the entry points of their strategies. Strong emphasis on entry points can lead to a lack of attention on the back end. This can result in a lack of attention being given to a system’s exit strategy.

Simply using the first exit strategy that comes to mind might result in the system working just fine. However, taking the time to consider all of the potential exit options could result in discovering a much more profitable exit strategy for the system.

exit strategy

Have you put as much thought and analysis into your exit strategy as you have your entry strategy?

There was an article published on Forex Crunch this week that took a look at some of the potential exit strategies that a system might utilize. Having a list like this at your fingertips is a great way to ensure that you are considering all of the possible options when putting together your own quantitative trading system.

Here are the different types of exits that the article covers:

System-Based Exits

For many systems, these are the first type of exits that come to mind. They are generally based on the reverse of whatever entry signal the system uses.

 It stands to reason that you already should have planned your exit in advance so if you entered on a moving average crossover, for example, it’s usually best to exit on the opposite crossover.

Likewise, if you bought on a breakout you should probably sell when the price breaks down.

Trailing Stop Exits

Trailing Stops are a very popular way to make sure that your system retains some of its paper profits. As we covered last week, there are many pros and cons to using a trailing stop. The Forex Crunch article points out that one difficulty is knowing where to place the stops:

One of the difficulties when using the trailing stop is knowing how far away from the price action to set the stop as too close means you could take profits too early, while too far away and you might not capture any profits at all.

Price Targets

Price targets are a very popular exit strategy for many Forex systems. They allow traders to specify clear risk to reward ratios. However, those traders have to be prepared to accept the possibility of a price just missing their target and then turning into a losing trade.

The Forex Crunch article suggests that using pivot points as price targets is an interesting option:

Technical levels such as pivot points are often great places to set as price targets for a couple of reasons.

First of all, they use recent data so they adapt to market volatility. This means that the key pivot levels are all realistic profit targets.

Secondly, pivot points are watched by thousands of professional traders. This means they are better at predicting turning points.

Technical Indicators

This is the Pandora’s Box of exit strategies. Just because you are using one particular indicator to enter a trade doesn’t mean that you can’t use any other indicator to signal an exit. The articles suggests that Fibonacci, Elliot Wave, and Average True Range based indicators are all interesting options.

The Fibonacci is a mathematical sequence that manages to anticipate turning points with extraordinary accuracy while the ATR indicator is a good tool in order to gauge price moves.

This is by no means a comprehensive list of exit strategies. However, it is a great starting place to expand your thinking on the topic. How much thought have you put into optimizing your exit strategies?

Filed Under: Trading strategy ideas Tagged With: exit strategy, price target, technical indicator, trailing stop

Should Forex Traders Use Trailing Stops?

December 4, 2013 by Andrew Selby Leave a Comment

It’s no secret that one of the most important aspect of any quantitative trading system is its ability to protect capital. Profitable systems need to be able to keep losses small and let winners grow.

The question for quantitative system developers is: “What is the best way to achieve these goals?”

Many traders believe that using a trailing stop provides them with the ultimate combination of risk management and profit potential. However, there are also plenty of traders that disagree.

trailing stop

Should you be using a trailing stop with your trading system? The answer likely depends on the system itself!

 

Chris Svorcik from Winners Edge Trading wrote a post that details both the pros and cons of using trailing stops in your trading system. He breaks down the different types of trailing stops, and then discusses the benefits of using them, as well as the benefits of using fixed stops and profit targets.

Chris lists the following three reasons in favor of using trailing stops:

Riding the Tide of the Market

A trail stop would allow the market to decide how far it wants or does not want to go instead of the Forex thinking for the market. The Forex trader thereby “rides the tide” and “goes with the flow”.

Protecting Paper Profits

A Forex trader would be less nervous about “giving” back profits when a trail stop is used. The trailing stop helps protect the trading capital by the sheer fact that a Forex trader moves their stop loss to a level that is closer to the entry, which thereby “locks in” a smaller loss or profit.

Potential for Massive Wins

 A trail stop allows for massive wins – occasionally. These massive wins can seriously spike the equity curve to new levels.

Chris then flips the argument and lists the following reasons for using fixed stops and profit targets:

Smoother Equity Curves

Trail stops have the potential of creating smaller wins, smaller losses, and occasional bigger wins, which creates a more volatile equity curve.

Risk to Reward Calculations

The Reward to Risk ratio is easier to calculate with a take profit because the potential reward is a given.

Less In-Trade Management

A take profit requires less trade management time. With clear levels where a Forex trader wants to exit the market for a loss or profit, it would be easier to create a “set and forget” mentality.

Chris continues by pointing out that the most important thing to consider when determining whether or not to use trailing stops is the type of system you are trading:

A Fibonacci strategy will use Fib levels as a take profit level.

A break out strategy, however, could be very well suitable for a trail stop.

Then again, for a range strategy the take profit level could be better suited.

A reversal trade might want to incorporate a trail stop after a certain profit has been reached, whereas a trending trade setup could seriously benefit from a trail stop loss as the price extends in one direction.

 

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: forex, trailing stop

Backtesting Biases and Variations

October 3, 2013 by Andrew Selby 4 Comments

Last week, I wrote a post discussing how altering the timeframe of a system can change its results. That got me thinking about other ways that backtesting results could be skewed in one way or another based on user defined data such as the date range and market used. These simple differences can have a tremendous influence on the overall returns of any system, so it is important to pay them their proper respect.

When running backtests, it can be very easy to gloss over the down periods and cherry-pick the big return years. The problem is that you won’t have that opportunity when actually trading a system live. You will need to prepare yourself for the possibility that you select the wrong time or the wrong market to trade a given system. Otherwise, you run the risk of letting these backtesting biases adjust your expected return to values the system cannot possibly deliver.

Adjusting the Date Range

Let’s use our 10/100 Moving Average Crossover System from last week as a base. We tested it from January 1, 2001 through December 31, 2010 on the Vanguard Total Stock Market ETF (VTI). All of our tests last week used a starting portfolio value of $10,000, a 10% trailing stop, and a $7 commission.

Backtesting bias in VTI

MA crosses on VTI returned almost 90% over the last decade.

Based on those settings, our 10/100 MA Crossover System returned 89.8% over ten years. This works out to be an annualized return of 12% with a maximum drawdown of 16.2%.

If we would have started trading this system on January 1, 2003, we would have registered a total return of 39% in the three years of trading until the end of 2005. This would have been good for a 16.4% annualized return with a maximum drawdown of only 6%. As you can see, if we based our strategy on these results, we would be expecting the system to continue to produce these extremely high returns.

On the other hand, if we would have started trading this system on January 1, 2006, we would have seen a total return of only 2.5% in the first three years. We also would have had to sit through a 14.2% drawdown.

It is also worth noting that while the ten year track record of this system from 2001 through 2010 is very respectable, we wouldn’t have known that when we started in 2001. If we actually started trading this system in 2001, we would show a total return of -6.2% at the end of 2002. After two full years trading this system, we would not have had a single thing to show for it. The system didn’t find its first big winner until April 15, 2003.

As you can see, the time you chose to begin trading the 10/100 Moving Average Crossover System could have made all the difference over the course of what was a net-profitable decade. It is very important to keep this in mind when you are struggling through drawdowns.

Adjusting the Markets Traded

The market you choose to trade can have the same affect on your trading as the date you start trading. Let’s look at how the exact same system would have performed over the exact same decade if we chose to trade it on different ETFs.

Trading the 10/100 Moving Average Crossover System on the XLF, which represents financials, would have provided a total return of -9.4% for the decade with a maximum drawdown of 30%. It is obvious to us at this point that financials had a rough time during this period, but we would have had no clue about that when we started in 2001.

The XLY, which represents consumer discretionary stocks, also would have underperformed the VTI. Trading the system on the XLY would have returned a total of 39.4, or 6.4% annually, with a maximum drawdown of 21.3%.

Backtesting bias for xly

XLY shows a 39.4% return over the same decade

If we would have been fortunate enough to trade the XLK, which represents the technology sector, we would have seen a tremendous total return of 95.7%. This works out to be an annual return of 14.2% with a maximum drawdown of 22.3%.

Once again, we see that decisions like what markets to trade and when to start can have a tremendous influence on our results. This is why it is so important to thoroughly backtest any strategy across many different combinations of date ranges and markets.

Filed Under: Test your concepts historically Tagged With: annual return, backtesting bias, drawdown, etf, moving average crossover, system, trailing stop, VTI, XLF, XLY

The New Yearly High System

September 25, 2013 by Andrew Selby 2 Comments

At the root of most trend following systems is the idea that you want to be long markets that are moving higher or short markets that are moving lower. One of the simplest and most popular ways to identify markets that are trending up or down is to look for ones that are making new 52-week highs or lows. This simple signal can be used as the root of a very simple and easy to follow trend following system.

About The System

In his book, Unholy Grails, author and trader Nick Radge discusses a number of different systems providing set rules and backtesting results. One of the first systems he describes is based on the concept that stocks making new yearly highs are likely to continue higher, and stocks making new yearly lows are likely to continue trending lower. This is one of the core concepts behind most systematic trend following strategies.

Radge points out that a system that is based on new yearly highs and lows is very user-friendly because most financial resources publish data for stocks making new 52-week highs and lows. This means that we could literally trade this system manually without any trading software.

One way that Radge simplifies the system is by assuming that there are approximately 250 trading days in a year. Therefore, any stock making a new 250-day high or low will also be making a new yearly high or low. This means we can treat this system as a very simple 250-day breakout system.

This system establishes a long position on the open the day after a stock makes a new 250-day high and then exits that position on the open of the day after the stock makes a new 52-week low. These 250-day highs and lows are easy to monitor using a price channels overlay, which is available in most charting packages. The solid yellow lines on the chart below represent the 250-day high and low prices.

yearly high and low in BND

BND forms a new 250 day low

Trading Rules

Enter Long When:

  • Price Closes At New 250-Day High

Exit Long When:

  • Price Closes At New 250-Day Low

Backtesting Data

In order to backtest this system, Radge used the stocks in the All Ordinaries Index, which is the most popular stock market index in Australia. He compares his results to the All Ordinaries Accumulation Index, which is a benchmark that represents a buy and hold approach on the Australian equities markets.

His testing period ran from January 1, 1997 through Jun 30, 2011. The account started with $100,000 and sized positions at 5% of the account. Commissions and dividends were also taken into account.

Trading the New Yearly High System over those 14 years would have produced a total of 170 trades. The Compound Annual Growth Rate (CAGR) would have been an impressive 18.21%, more than doubling the 8.78% CAGR of the benchmark buy and hold account. The system was profitable on 53.3% of its trades and posted a Sharpe Ratio of 0.395.

The glaring negative of the backtesting results would be that the New Yearly High System posted a maximum drawdown of over 50%.

System Analysis

One of the most common things you will hear about system development is that traders place far too much emphasis on entry and exit signals. Conversely, there is generally not enough emphasis placed on risk management and position sizing. This system is a great example for those philosophies because its entry and exit signals appear to work just fine, but its 50% drawdown indicates that it doesn’t do a good enough job protecting its profits.

The New Yearly Highs System has a significant strength in that it works. Its returns actually beat a buy and hold approach by more than double. However, its weakness needs to be addressed, because it would be an absolutely nightmare to attempt to stick to the system while sitting through a 50% drawdown.

Improving The System

Trend Filter

The first thing I would do to improve this system is introduce a trend filter using the 200 day simple moving average (SMA). This filter would simply require that the general market be in an uptrend in order for the system to enter a long position in any single stock. This would ensure that the system was not taking long positions in stocks that were trying to trend higher against a downtrending general market. We should have more overall success if we consistently trade with the trend of the overall market.

Trailing Stop

Another condition I would add to the system would be an ATR-based trailing stop that would ensure that we locked in profit from any profitable trades. It would also minimize our losses on losing trades. Adding this stop might cut down the overall returns a bit by cutting short trades that would have eventually turned profitable, but the downside protection would likely be worth that sacrifice.

Changing the Universe

One of the things that Radge suggests is trading the system exclusively on the market index as opposed to individual stocks. He suggests that this would cut down on volatility and then proves that concept with backtesting results. This idea lowered the CAGR to 13.92%, but also cut the maximum drawdown down to 36.03%.

Keeping with the line of thinking that trading the system on indexes would reduce volatility, I would be curious to test the system trading across multiple indexes or ETFs. It would be interesting to see how the system performed on the ETFs traded by the Ivy Ten System or the markets recommended by Andreas Clenow in Following The Trend.

Filed Under: Trading strategy ideas Tagged With: All Ordinaries, drawdown, NIck Radge, trailing stop, trend filter, yearly high

Setting Initial Stops Using Average True Range (ATR)

April 18, 2013 by Andrew Selby 1 Comment

Getting stopped out of positions is a common occurrence for all traders. There is a sense of relief involved when a positions gets worse after your stop is triggered, but it can be incredibly frustrating to get whipsawed out of a position only to watch it rocket higher.

Accounting for volatility in your stop placements helps reduce the chance of a whipsaw trade. Fixed distance stop losses don’t bring the same advantage.

Using Average True Range (ATR) To Set Initial Stops

Average True Range (ATR) represents the average range that a market moves over a given time period. Using a multiple of ATR allows a trader to give highly volatile positions enough room to run, while at the same time making sure that low volatility positions are held tightly in check.

I typically set my initial stop 3ATRs below a new position. If that’s new lingo to you, it means that I take the ATR and multiply it by 3. If you bought LNKD at 178.66 and its ATR was 6.22, then you would set your initial stop 18.66 below you entry point, which would be 160.00 if there was no slippage. Based on your own personal risk preferences, you can use any multiple of ATR in order to take into account that market’s historical volatility.

LNKD ATR chart

The LinkedIn (LKND) daily chart with its average true range (ATR)

What Is Average True Range (ATR)?

The concept of Average True Range (ATR) was originally introduced by J. Welles Wilder in his 1978 book New Concepts in Technical Trading Systems. Wilder was looking for a way to describe the historic volatility he was encountering in commodities markets.

Wilder took the True Range indicator and smoothed it out using an exponential moving average. The most common time frame for ATR is 14 days.

True Range is calculated using the following formula:

true range = max[(high-low), abs(high-prevclose), abs(low-closeprev)]

By adding the second two components of this formula, Wilder was able to account for gap up and gap down situations that True Range struggled with. True Range only measures the change within a bar and not the change between two bars.

My Evolution To Using Average True Range (ATR)

When I began my trading career over a decade ago, I didn’t think I needed to bother with setting an initial stop loss. I was only going to be buying stocks that went up, so I had no reason to worry about downside risk. That was for suckers who couldn’t identify growth stocks.

Experience humbled me. I was likely to be wrong on as much as 50% of my trades. As I began to come to terms with the fact that I was not a perfect stock picker, I started to see the need to set a stop-loss order when I established a position.

My reading informed me that Livermore and Loeb recommended no more than a 10% stop. O’Neil recommended a 7-8% stop.

Since I still viewed myself as quite gifted, I figured that a 7% stop would work for me because I was only dealing with the very best stocks, and it was very uncommon for them to lose 7% from a breakout…..or so I thought.

As I continued to lose money, a very intelligent trader pointed out to me that I was not even considering the volatility of each of the stocks I was buying. Some of the stocks on my watch list would move 2-3% up or down everyday, but some of them rarely moved more than 0.5%. This explained why it felt like some of my positions had too much room and others felt way too tight. Experience taught me that looking at volatility just makes sense.

Example ATR Comparison

The chart of LNKD above showed a stock with a 6.22 ATR. As a point of comparison, here is a chart of MSFT, which has an ATR of 0.504.

Microsoft (MSFT) daily chart

Microsoft (MSFT) daily chart

Even a novice trader can see that there is a huge difference in volatility between these two stocks. Since LNKD moves with much more dollar volatility than MSFT, it will need more room to work with if you establish a position. Conversely, MSFT doesn’t need much room at all because of its low volatility history.

Using ATR For Trailing Stops

ATR extends beyond setting the initial stop loss. The indicator also works for setting trailing stops as a position becomes more profitable, such as in the RSI Trend strategy. A simple application of this is to keep the stop updated to be a mutliple of the market’s ATR below the high of the position.

Using ATR as a trailing stop can help to protect your profits, while at the same time give your position enough room to move.

Filed Under: Stop losing money Tagged With: atr, average true range, initial stop, trailing stop, volatility

Probability Trailing Stop

November 28, 2012 by Shaun Overton Leave a Comment

Generic trailing stops maintain a steady pip distance between the most favorable price seen and the stop loss. One thing that I don’t like about this is that trailing stops ignore the take profit. My goal was to increase the information available by using a trailing stop in the context of a take profit.

The only information needed for doing so is the ratio between the stop loss and take profit. If I use a 50 pip take profit and a ratio of 1, for example, then the stop loss is also 50 pips. If I used a ratio of 2, then the stop loss is 100 pips.

As the price moves closer to the take profit, the stop loss should maintain the same ratio over the remaining distance. The original take profit was 50 pips. Say that the price increased 20. Only 30 pips remain to hit the profit target. The probability trailing stop adjusts the stop loss to 30 pips from the current price if the ratio is 1. If the ratio was 2, then the stop would adjust to 30 * 2 = 60 pips. The idea was that perhaps the stop loss should ratchet closer to the take profit as it becomes increasingly likely to occur.

An easier way to think about where to set the stop is to ask, “How many pips are left until the trade hits its take profit?” If the answer is 40, then the stop loss adjusts to 40 pips away from the current price and not the entry. If the answer is 25, the stop loss changes to 25 pips from the current price. The stop loss adjusts faster and faster as a trade nears its take profit.

Changing the stop ratio to something like 0.5 makes it more complicated. If 40 pips remain before a trade reaches its limit, then the stop loss adjusts to 40 * 0.5 = 20 pips away. If 25 pips remain, then the stop ratchets to only 12.5 pips away.

Test Results

I backtested the idea using a variety of forex pairs and DOW 30 stocks for the first quarter of 2009. The direction of a trade, whether long or short, was chosen using a random number. The date chosen was simply because I have M1 data for multiple instruments. The broad spectrum of results would reflect the same trend regardless of the time periods used.

All backtests were on M1 charts. The unit sizes of the trades don’t matter much; I set the trade size to a standard lot on forex pairs and 1,000 shares for equities trades. All used a 50 tick take profit with an equidistant stop loss (the stop loss ratio was 1.0). The profit factors help keep the information consistent among the different instruments.

InstrumentProfit Factor
EURUSD0.96
USDCAD0.88
DIS0.91
MSFT1.0
WMT0.87
XOM0.87

All of these backtests involve a minimum of 300 trades. The EURUSD backtest included more than 1,700 trades. The sample size for all tests are more than sufficient for drawing a conclusion. Using a probability stop with a ratio of 1.0 is a bad idea.

Although the equity curves naturally varies among instruments – and would differ using new random numbers – the equity curve below shows what it generally looks like.

Equity curve of probability trailing stop

The equity curve for a probability trailing stop on Exxon (XOM) for Q1 2009.

The entry efficiency of the system appears solid. However, that is because the worst possible exit always shifts up. The idea trades exit efficiency for a hint of entry efficiency. Knowing that the trades pick their direction using random numbers, it is not worthwhile to get excited about this seemingly non-random metric.

Entry efficiency for Verizon (VZ)

The entry efficiency consistently comes out near 55-60%. The above image shows the entry efficiency for trading Verizon (VZ).

The losses have to come from somewhere. Clearly, as the image below demonstrates, it results from the terrible exit efficiency. Results typically ranged from 35-40%.

Exit efficiency for probability trailing stop

The exit efficiency for a probability trailing stop ranges from 35-40%. The above image is taken from trading McDonalds (MCD).

If you would like to test the concept for yourself, you can download the NinjaTrader export file by clicking Probability Trailing Stop. You need to email me for the random number file, which needs to be placed in the “C:\” directory. The code will not function without it.

Although the tests for a stop ratio of 1.0 look terrible, all is not lost. I can flip this on its head and turn it into a profitable concept by blending it with the random trailing limit. Outcomes using a ratio of 3.0 also offer potential hope. We’ll cover those outcomes in future blog posts.

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: stop loss, Take Profit, trailing stop

Breakeven Trailing Stop

March 16, 2012 by Shaun Overton Leave a Comment

The trailing stop that we build in most of our custom expert advisors varies somewhat from the generic trailing stops out there. The code uses two inputs. An input is basically a variable that pops up on the screen when you load the expert advisor. You can change the input value without the need for additional programming.

Expert Advisor inputs tab

This is a screenshot of typical inputs for a MetaTrader expert advisor

The unique aspect of our trailing stop is that it does not trail until the trade reaches a certain amount of profit. Delaying the adjustment allows the user to treat the stop order as a take profit tool instead of simply exiting at a loss.  Most traders feel that once a runner appears, only then does it make sense to adjust the initial rules for exiting at a loss. Acting defensively about the trade only when a decent amount of profit is on the table avoids early stop outs, or at least so the theory goes.

TrailStart is the input which controls when the stop moves from losing to breakeven. It is only at this point of profit that the EA adjusts the exit conditions to avoid a loss.

Say, for example, that the TrailStart is set to activate at 20 pips. That means when your buy trade goes up 20 pips from the entry price, the EA automatically adjusts the stop loss to equal the entry price. The EA cannot lose from that point forward, not counting the effects of slippage.

TrailAmount kicks in only after the stop already adjusted to breakeven. This input controls the distance to increments at which the stop loss should update favorably. If TrailAmount equals 5, it means that the stop loss should adjust in your favor 5 pips for every 5 pips of extra profit beyond the TrailStart at 20 pips.

If the stop loss already moved to breakeven at 20 pips, it means that the stop loss is currently at 0 pips. The trade neither wins nor loses if the market hits the stop. If the price advances another 5 pips (TrailAmount ), the expert advisor determines that it must trail the stop again by 5 pips. The price reaching +25 causes the stop to advance from 0 to +5. When the price moves another 5 pips to +30, the stop advances to +10.

Notice how the stop distance remains a consistent 20 pips in the example. It’s the exact same amount as the TrailStart input.

Filed Under: How does the forex market work?, NinjaTrader Tips, Trading strategy ideas Tagged With: break even, input, stop loss, stop order, trailing stop

Random Trailing Limit

March 12, 2012 by Shaun Overton 14 Comments

I got the idea for a trailing limit from Van Tharpe’s market classic Trade Your Way to Financial Freedom.  I made Jon Rackley read through the book as part of his training when I first hired him. He brought my attention to an unusual claim made on page 267. Van Tharpe says that it’s often possible to make money even with random numbers.

Random numbers are a pet theory of mine. I’ve long put effort into figuring out whether I could develop a strategy that trades totally at random and still makes money. As the owner of a programming company for traders, and as part of Jon’s initial training for NinjaTrader in December, I assigned him the task of programming the strategy into code.

The book states that trading with totally random entries and a 3 ATR trailing stop generally leads to making money. Flip a coin. You go long if it lands on heads.  Go short if it lands on tails. One important note is that we elected to use pure random numbers in our programming instead of the pseudo-random numbers that computers generate. Doing so allows us to avoid time biases in the seeding process that generally pop up when the seeds used are close together in time.

The first working version that I reviewed displayed everything contrary to Van Tharpe’s claims. Using a trailing stop, regardless of the instrument and time frame tested, inevitably led to devastating losses. The profit factors consistently came in near 0.7, a truly awful number.

We did what most of our clients do when they find abysmal strategies. We flipped the strategy on its head. The new strategy uses only a 3 ATR (50 period) trailing limit.

Trailing Limit Analysis

The early conclusion is that trailing limits seem to offer a great deal of potential. Although Jon sent me the code several months ago, it’s only this evening that I had a chance to properly review and test everything.

The profit factors are very encouraging. It depends on the chart that I tested. The worst that I found was a 1.0 profit factor. Everything else came out with profit factors greater than 1. The small table below contains the initial test results. Before you go off salivating that this is the next hot winner, there are a few considerations to keep in mind:

  1. The results depend entirely on the sequence of random numbers used. Using different sets of random numbers will cause different outcomes.
  2. The better results on the higher time frames likely result from sampling error. The number of trades involved was only ~160, which is not enough to make definitive conclusions on the nature of the performance. I prefer to see 400 or more trades before drawing definitive conclusions.
  3. These results do not include spread costs or commissions.
CurrencyPeriodProfit FactorDates Tested
EURUSDM11.129/12/2011-3/12/2012
GBPUSDM11.169/12/2011-3/12/2012
USDJPYM11.259/12/2011-3/12/2012
EURUSDM51.112011
GBPUSDM51.02011
USDJPYM51.062011
EURUSDH11.262011
GBPUSDH11.252011
USDJPYH11.482011
Random trades sometimes produce solid looking equity curves

Random trades sometimes produce solid looking equity curves. Remember that this was generated with purely random numbers and a trailing limit

What made me feel better about the results was reviewing the entry and exit efficiencies of each strategy. The number of trades involved really cluttered the graphic. I ran a backtest on a much shorter time period so that the horizontal, blue line would appear clearly on each graph.

The entry efficiency of a random entry is... random

The entry efficiency of a random entry is… random (45.45% entry efficiency)

The exit efficiencies of random entries with traililng limits are outstanding

The exit efficiencies of random entries with trailing limits is off the charts. (77.73% exit efficiency)

The entry efficiency tells us exactly what we would expect to find. Trades which enter at random do not perform better than random (obviously). What’s interesting is how the trailing limit exit strategy actually skews the entry efficiencies to read slightly worse than random. This is a good example of why it’s dangerous to rely purely on statistics. Keeping the big picture in mind reduces the likelihood of making an erroneous conclusion, in this case that there might be something “wrong” with our perfectly random entries.

The exit strategy, which is what we’re truly testing, looks absolutely stellar. It shows that acting as a conditional probability allows for a great deal of adverse movement while capturing extreme points of the move.

Adding Money Management

The percentage of winners for the tested charts ranges from 60-67% accuracy. High percentages of winners often lead to winning streaks. My cursory glance through the chart led to my easily finding a suitable example to cherry pick. Here, 5 trades in a row reach their near maximum take profits.

Random trades on a hot streak

Picking trades at random occasionally leads to streaks of lucky winners

Testing that I’ve done in the past tells me that it’s often advantageous to increase the position size based on consecutive winners when a strategy is more than 50% accurate.  My first idea after reviewing the initial results was to modify the forex money management strategy to pursue the consecutive winners. We unfortunately do not have time to pursue those changes in the code right now. Let me know if you’re interested in seeing this and we’ll make it a priority if enough readers respond.

While increasing the risk after consecutive winners works out statistically in your favor, it does add to the risk. It’s entirely possible for a “winning” set of trades to start losing based solely on the money management strategy.  There’s no way to know whether your set of trades will be the luck beneficiary of the extra risk or whether it will be the unlikely loser.

Conclusion

Everyone talks about stops. You always have to have a stop. Blah blah blah. I know it’s going to be the first question that everyone asks.

My research shows that trading with a stop is for suckers. Larry Connors’ book Short Term Trading Strategies That Work was the first trading book where I actually felt like I read valuable information. One of my favorite sections is on stop losses. His research shows that using a stop loss (even a 50% stop loss) always reduces the performance of a strategy. My own independent analysis bears this out.

Not using stops does not mean never taking losses. On the contrary, refusing to exit the market at a loss makes for a 100% odds of blowing up one day. The point of using a stop or limit is to empirically define, and to never waver from, a specific point or points in the market at which you will exit. A trailing limit accomplishes that goal admirably.

Interestingly, the trailing limit is one feature which FAP Turbo incorporates that I have yet to find in any other expert advisors. Although I’m not a fan of FAP Turbo type of strategies, it certainly does interest me that one of its main features aligns with this research. Also notable is the fact that the trailing limit continues down even to the point where it accepts losses.

Filed Under: NinjaTrader Tips, Test your concepts historically, Trading strategy ideas Tagged With: atr, profit factor, random, statistics, trailing limit, trailing stop, Van Tharpe

FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2023 OneStepRemoved.com, Inc. All Rights Reserved.