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

    • Date: 25th April 2024. Investors Monitor a Potential Japanese Intervention, and upcoming Tech Earnings. Meta stocks top earnings expectations, but revenue guidance for the next 6 months triggers significant selloff. Meta stocks decline 15.00% and the Magnificent Seven also trade lower. Japanese Authorities are on watch and most market experts predict the Japanese Federal Government will intervene once again. The Japanese Yen is the day’s worst performing currency while the Australian Dollar continues to top the charts. The US Dollar trades 0.10% lower, but this afternoon’s performance is likely to be dependent on the US GDP. USA100 – Meta Stocks Fall 15% On the Next 6-Months Guidance The NASDAQ has declined 1.51% over the past 24 hours, unable to maintain momentum from Monday and Tuesday. Technical analysts advise the decline is partially simply a break in the bullish momentum and the asset continues to follow a bullish correction pattern. However, if the decline continues throughout the day, the retracement scenario becomes a lesser possibility. In terms of indications and technical analysis, most oscillators, and momentum-based signals point to a downward price movement. The USA100 trades below the 75-Bar EMA, below the VWAP and the RSI hovers above 40.00. All these factors point towards a bearish trend. The bearish signals are also likely to strengthen if the price declines below $17,295.11. The stock which is experiencing considerably large volatility is Meta which has fallen more than 15.00%. The past quarter’s earnings beat expectations and according to economists, remain stable and strong. Earnings Per Share beat expectations by 8.10% and revenue was as expected. However, company expenses significantly rose in the past quarter and the guidance for the second half of the year is lower than previous expectations. These two factors have caused investors to consider selling their shares and cashing in their profits. Meta’s decline is one of the main causes for the USA100’s bearish trend. CFRA Senior Analyst, Angelo Zino, advises the selloff may be a slight over reaction based on earnings data. If Meta stocks rise again, investors can start to evaluate a possible upward correction. However, a concern for investors is that more and more companies are indicating caution for the second half of the year. The price movements will largely now depend on Microsoft and Alphabet earnings tonight after market close. Microsoft is the most influential stock for the NASDAQ and Alphabet is the third. The two make up 14.25% of the overall index. If the two companies also witness their stocks decline after the earnings reports, the USA100 may struggle to gain upward momentum. EURJPY – Will Japan Intervene Again? In the currency market, the Japanese Yen remains within the spotlight as investors believe the Japanese Federal Government is likely to again intervene. The Federal Government has previously intervened in the past 12 months which caused a sharp rise in the Yen before again declining. The government opted for this option in an attempt to hinder a further decline. Volatility within the Japanese Yen will also depend on today’s US GDP reading and tomorrow’s Core PCE Price Index. However, investors will more importantly pay close attention to the Bank of Japan’s monetary policy. Investors will be keen to see if the central bank believes it is appropriate to again hike in 2024 as well as comment regarding inflation and the economy. In terms of technical analysis, breakout levels can be considered as areas where the exchange rate may retrace or correct. Breakout levels can be seen at 166.656 and 166.333. However, the only indicators pointing to a decline are the RSI and similar oscillators which advise the price is at risk of being “overbought”. 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 on how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Michalis Efthymiou Market Analyst 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.
    • $ALVR AlloVir stock bottom breakout watch, huge upside gap, https://stockconsultant.com/?ALVR
    • $DIS Disney stock attempting to move higher off the 112.79 triple support area, https://stockconsultant.com/?DIS
    • $ADCT Adc Therapeutics stock flat top breakout watch above 5.31, https://stockconsultant.com/?ADCT
    • $CXAI CXApp stock local support and resistance areas at 2.78, 3.52 and 5.19, https://stockconsultant.com/?CXAI
×
×
  • Create New...

Important Information

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