Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

jswanson

A Statistical Method For Stop Placement

Recommended Posts

In the September 2012 issue of Futures magazine, author Neil Rosenthal began a multi-part series on system development. During the first series Neil uses MetaTrader 4 (MT4) to code a simple system and demonstrates how he uses Excel to analyze the results as the first step to building a trading system. After discovering a market edge – what I call a key concept – Neil demonstrates his process of finding an initial hard stop value for his system. I found his method similar to what I use. I thought it would be helpful if I recount his method here.

 

While many people focus on the specifics of a trade entry, trade exit is also vitally important. After you have discovered what you think is a solid “key concept” the next question you may wish to explore is: Where should the initial stop be placed? Within Neil’s article he calls this his ISL (initial stop loss).

 

The Trading System

 

Because we not focusing on a specific trading system I’m going use Neil’s idea of using a random entry method. That is, upon the open of the market a virtual coin will be flipped. If the coin comes up heads, we go long. If it comes up tails, we go short. This will take the focus off the trading system and place the emphasis on the true point of this post, how to determine where to place your ISL. Indeed this process is applicable to all system trading development.

 

I’m going to trade this on Euro currency futures market and will use the 830 open (Central) as the time to open a new trade and the 1500 close (Central) to close the trade. Trades will be executed and managed on a 5-minute bar chart. Below is the TradeStation code that will act as the foundation of our trading system. If you are familiar with the steps I use to develop a trading system, you will recognize this stage of development as the “Baseline” system. This Baseline system will act as our stake-in-the-ground or reference point to compare the modified version against.

 

 

 

vRandomNumber = Intportion( Random(100) );

If ( vRandomNumber >= 50 ) Then buy("LE") next bar at market

Else sellshort("SE") next bar at market;

 

 

The Results

 

 

The system was executed over a five-year period ending July 31, 2012. No slippage or commissions were deducted from the results. The test generated 1,269 trades. The number of short trades (625) accounted for 49% of the trades and the number of long trades (644) accounted for 51% of the trades. As expected the number of winning trades is near the 50% mark at 51%. You can see that this system actually produced a positive net profit of $27,200 with an average trade of $21.43. If we factor slippage and commissions the system would appear to be a break-even system.

 

RandomSystemResults.png

 

We can probably improve the average profit per trade by limiting what we lose on trades that move against us. This is the purpose of having an ISL. By using an Excel spreadsheet to analyze the maximum adverse excursion (MAE) for our winning and losing trades we can help narrow down a proper value for our ISL. MAE is the amount a trade moves against us. For example, if we open a trade that immediately climbs to a profit of $100, then falls to $75 into the red before we finally close the trade at our $250 profit target, our MAE would be $75.

 

So we now know we wish to examine the MAE of our system, but how do we do that?

 

Trade Recorder Function

 

Fortunately, I created an EasyLanguage function called TradeRecorder which does exactly what we need. By placing this function within our strategy code all our required trade information is sent to an Excel formatted file on our hard drive. From there it’s just a mater of cut-and-pasting our trade information into another Excel spreadsheet to analyze our results. Please read this article for a more complete description on what TradeRecorder can do.

 

Data Analysis

 

Now that we have all the trades in an Excel file I can take this data and cut-and-paste it into another spreadsheet called Trade Analysis, which is available at the bottom of this post. This spreadsheet is nothing fancy but will compute what we are looking for. Using the sort feature in Excel I can separate the winning and losing trades. Then I can use Excel’s built in functions to generate the mean and standard deviation of the MAE values.

 

Below are the values generated by Trade Analysis for our example run of our trading system.

 

RandomEntryMAEResults.png

 

In our example trading system we can see winning trades have a mean MAE of around 19 ticks. This suggests that a stop value smaller than this value will likely result in stopping-out of winning trades. In other words, the stop value would not be large enough. On the other hand, if we look at our losing trades we can see the mean MAE is 72 ticks. Such an extreme move against us is unlikely to produce a positive trade and we should be looking at cutting our losses. Notice how losing trades move strongly against our position while winning trades take much less “heat”. With this information we already have a ballpark idea on where to place our ISL. Furthermore, the same analysis can be done with the maximum favorable excursion (MFE) to help us locate a proper profit target to test. But more on that later.

 

While it may be tempting to place a stop just beyond our 19 tick mean, a more optimal number can be found by using optimization. We are not done yet on determining our ISL. However, it will have to wait for a future post.

 

Video

 

Below is a video that explains in detail on how to use the Trade Recorder function with the Trade Analysis spreadsheet. These two tools can be used to help you determine your ISL for systems you develop. Both these tools are available as a free download at the bottom of this post.

 

 

Downlaods

 

The trading system code and an excel spreadsheet used in this post is available here.

Share this post


Link to post
Share on other sites

TradeStation is great, but there are limits to what can be gleaned from the reports that a strategy test generates . . .

 

For other ideas for useful Excel trade analysis using the TradeRecorder function that JSwanson has kindly provided, have a look at 'Trading Systems that Work' by Thomas Stridsman.

 

BlueHorseshoe

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • META stock nice rally off support and breakout at https://stockconsultant.com/?META
    • Date: 3rd December 2024. High Bond Yields Boost Euro, But ECB Signals December Cut! The French government is close to collapse due to the French Prime Minister’s persistence on the latest budget. French bond yields rise to their highest since 2012 and the Euro attempts to correct upwards during this morning’s session. According to state central banks, the ECB will continue cutting interest rates in December. Is the current bullish Euro temporary? The SNP500 renewed its highs for a second consecutive day mainly due to gains from Meta, Tesla and Microsoft. EURUSD – ECB Members Indicate Cut For December! The US Dollar is declining in value against most currencies this morning after significant gains on Monday. However, the performance throughout the week will depend on the JOLTS Job Openings, ADP Employment Change, NFP and US Unemployment Rate. Positive dynamics have been unfolding amid Trump’s warning to BRICS nations against creating a currency alternative to the US Dollar, threatening 100% tariffs on their exports. Experts fear this signals a potential trade war with China, India, Russia, and others. Moscow countered that forcing reliance on the Dollar could erode its appeal as a reserve currency. Meanwhile, investors await November employment data. With private consumption rising (2.1% to 2.3%) and core inflation increasing (2.7% to 2.8%), further labor market strength could challenge a December rate cut of 25 basis points. Most experts still expect the Fed to proceed, but a pause in rate cuts is anticipated early next year. Currently, the Euro is the second best performing currency of the day behind the Australian Dollar. Many believe this is partially due to the competitive price and high Bond Yields. However, this can quickly change as the ECB’s dovishness and France’s political and budget crisis continue. ECB Governing Board member Yannis Stournaras indicated today that interest rates are likely to be cut further in December, with experts anticipating a 25 basis point reduction. For the Euro to maintain a buy signal in the short-term, the price will need to rise above $2,647.92 and this afternoon’s JOLTS Job Opening to fall below expectations. SNP500 – Stocks Reach All-Time High! The SNP500 so far this year is trading 27.50% higher and is at an all time high. This is mainly due to gains from Meta, Tesla and Microsoft. On Monday, 59% of the most influential stocks rose in value. Wedbush Securities reaffirmed an “Outperform” rating on Apple shares with a $300 target, citing a potential record 240 million iPhone sales in fiscal 2025, driven by the new Apple Intelligence AI feature. Last month, Apple reported $94.9 billion in revenue and $1.64 EPS, beating forecasts and last year’s figures. The performance of the SNP500 will depend on this week’s employment data, similar to the US Dollar. Most analysts believe the ideal scenario for the stock market is for the data to come in as expected. Always trade with strict risk management. Your capital is the single most important aspect of your trading business. Please note that times displayed based on local time zone and are from time of writing this report. Click HERE to access the full HFM Economic calendar. Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Michalis Efthymiou HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • RBLX Roblox stock, nice rally off the 49.19 gap support area, from Stocks to Watch at https://stockconsultant.com/?RBLX
    • CTLT Catalent stockt, watch for a bull flag breakout at https://stockconsultant.com/?CTLT
    • AAPL Apple stock, top of range breakout at https://stockconsultant.com/?AAPL
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.