In the spirit of giving back and sharing...... I am enclosing in interesting strategy that you can incorporate into your automated NT trading. This will work in any market and it will typically work to give you a serious edge. Here is the concept: A static stop loss vs. a static profit target will give you predictable results but it suffers one major draw back and that is: You can't have both a high % winning system and a system that catches the long runs. You have to pick your poison in the form of either being a scalper and taking more winners at less profit per trade, or try to only catch "the big ones" and you will usually have far more small losses than big wins.
The code syntax I am enclosing will help you split the difference and get both. Start by setting your PT and SL close to even or with one slightly more than the other, and let these both be a decent size. From here, slip in my code below and you can scalp out small winners when the market would normally turn against you and not hit your full profit target. In times where the move went more in your direction, you may hit your full profit target or come close, but the idea is that having this in place will protect you.
If you are a scalper and you typically play a PT = 50% or less of your SL, then this is for you! Add this to your trading system to catch the larger trades you would normally have missed. My advise to scalpers is to is to set the first level of this one tick lower than you would normally set your PT. So if your normal PT = 3 for example, then your first level is: If your position has reached a positive avg price of 3 then move your SL to 2. If this was the only thing that ever occurred you would be much worse off then just having your normal PT at 3, but in reality you will hit multiple levels throughout your trade history and your average PT will actually be much higher than 3, and your winning % will be about the same. So you end up getting the best of both worlds.
For trades only looking for "The big one", I advise that you use this to give you a few levels below your "Big trade profit" you usually like to hit. This will take your average profit down slightly but increase your winning % enough to offset it.
If you have any questions hit me up and I will expand further. But for anyone that codes this is fairly straight forward.
This is an interesting topic that is often overlooked in trading, so I wanted to share my insights in the hopes that it can help some traders out there.
Any system no matter how good will always hit a losing streak. This is just unavoidable, and it should be expected. The best systems out there will only ever succeed by the smallest margins. So you need to know the following statistical likelihoods:
1. Every system will hit a string of losing trades. Taken out of context a few bad trades may lead people to abandon a perfectly good system. Losing streaks are unavoidable, losing days are unavoidable. This is part of the game, and rather than fighting this fact you need to embrace it. Does your 401k that makes you 2% to 5% each year do so by never losing a single day? No, quite the opposite. It likely looses half the time and wins half the time and squeeks by with the narrowest of margins to give you a small gain every quarter. Start thinking about trading this way and you will get much further.
2. How can you tell if your system will work in the long run or not? You need to test at least 12 months, but preferably 24 months or more. If you can win 20 months out of 24, and the losing months don't wipe you out, you have a viable system. There are plenty of traders that manually trade a few days, and make their decisions about the merit of their system based on that alone. A few days won't tell you anything. You need at least 1,000 trades over several months before you can even tell what a realistic winning percentage would be. Any good statistician will tell you only a large sample size will give you a statistical baseline for decision making.
If you have an automated trading system you have a huge advantage because you can quickly test 12-24 months and check your performance. Without this though, you will likely be making decisions about the merit of your system with too little data.
I have a wide range of systems that produce 6 figure returns each year, but they all lose around 40% - 50% of the days they trade. This is to be expected. The market does not move the same way each day, so embrace this fact instead of fighting it and you will see much better results in the long run.
Last edited by iantg; March 5th, 2016 at 12:34 AM.
The following 6 users say Thank You to iantg for this post:
Some say draw downs are to be frowned upon and that any system that takes any significant loss should be abandoned.
To this: I give you exhibit A: (Q3 2015 ES with a net profit after commissions of > $30K)
and B: (part of Q4: 2015 ES with a net profit after commissions close to $9k).
Here is the lesson to be learned:
1: Draw downs are a part of trading and are unavoidable, and statistically speaking a system that wins 51% will theoretically do what Vegas does and make millions over time.
2. Draw downs are the payment you have to make to earn your eventual profit. Stay in the game for the long run and you can expect to survive the bad to realize the eventual good.
3. There is no such thing as the perfect system. At best, trading systems can only squeek out tiny profits over a long period of time. In the short run there will be bad, days, bad weeks and even potentially bad months. But in the long run a system with a 51% or better expectancy will pay off.
Attached below are a few screen shots from one of my many automated systems that run 24 hours a day. The daily results look crazy. Every other day is a loser, and some days are large losers, but if you look closer, you will notice that the weekly view looks better with fewer losing weeks, and if you look even closer you will see the monthly view is even better. If you step back further and look at it quarterly or annually you will see the real picture. A system that actually makes money!
Last edited by iantg; March 7th, 2016 at 10:42 PM.
The following 4 users say Thank You to iantg for this post:
I figure this topic would help some trend traders as it is a very popular topic. One of the keys to being successful in trend trading is to know when it is appropriate to use a trend trading tool box. In markets that move up and down there are variety of tools that work fairly well, but in sideways markets they completely break down and fail. So the first rule is to define when markets are trending and when they are ranging. Here are some of the ways you can easily achieve this:
1. Time filters: Markets tend to trend during the US open for around the first 2 or 3 hours and then it's a coin toss from there. If you are trading an auto-strategy you can just use a time based parameter and only trade between X and Y hours. Fairly easy to program and run and it should get you at least 60% trending market conditions.
2. ADX: This is the only indicator I know of that claims to tell when the market is trending or not. it does a decent job from what I have seen. There are a variety of settings to play with but if you used a larger time frame say 10 minutes or so, you could tell if the market was in an up trend or down trend and how strong it was. If the trend was below a specific level you could set your code to just not take trades, this would essentially filter out sideways action.
3. Range Filtering: One of the easiest ways to find out if you have favorable conditions for trend trading is to analyze the range of the last N number of bars. Just call a few variables such like this:
double point1 =MAX(35);
double point2 = MIN(35) ;
double range = point1 - point2;
Using something like this you can only enter trades when there is enough movement in the market. If you are trying to pick off a profit target of 10 ticks for example, you will likely fail if the market is only moving in a tight range of 5 ticks over the last 35 bars. So a better strategy would be to just filter these periods of sideways movement out, sit on the sidelines and wait until the market has a little more to work with. If you have a market moving 20 ticks in the last 35 bars for example, then you will be more likely to get 10 ticks in your favor with the right additional setups.
Just throwing out some ideas that may be helpful.
The following 10 users say Thank You to iantg for this post:
Thanks for the great posts. I especially like your Moving targets/stops code. Thanks for sharing. I never liked Trailing Stops, but this piece of code may work better. I will check it out. I do like to move stops as soon as a reasonable move is made though, otherwise, you will be holding a loss in what could be a smaller winning trade if you had moved your stop. Of course, as you have shown in your code, you need to leave some wiggle room for the trade to work, but let the trade come back and take you at a loss is not good to any strategy.
Filtering choppy markets is one of the toughest things. I never found any value on ADX, as it also filters some good runs and you are almost always late in your entry. Another suggestion is to use a synthetic bar (UniRenko for example). Try it, see how it performs on your strategies (btw, synthetic bars don’t work well with the Strategy Analyzer, results are way off to the optimistic side). I like UniRenko and a modified version that I use on my own tests.
Another thing I can suggest (if you have already not done so) looking at your post 13 charts is that you introduce a ‘daily loss limit’, and check how it will affect your overall P&L curve. I learned that for some strategies, days that are bad are really bad and limiting the losses on those days can be very helpful.
Like you I couldn’t find much value using the Strategy Analyzer (SA) or Optimizer tools of NT. I do use them at a very high level, maybe to give me an idea if a certain MA is better than another, but I always go thru Market Replay. I also use SA sometimes with intrabar code in my strategy so I can sometimes get better results but as usual they are way off or way too optimistic. Market Replay makes NT much more powerful than Tradestation to test intraday strategies (or any other platform to my knowledge), and NT is the only tool I use for testing intraday strategies. I also use Tradestation for stocks (which is great btw as you can use many market breadth indexes and variables in your strategy) and VectorVest to test portfolio strategies.
Thanks for this awesome thread, iantg. Just goes to show how freakishly hard it is to create something viable and profitable. I wonder if you have a specific way to deal with chop? Chop is my ultimate nemesis. I'm tempted to use Renko bars but they hide real price movement so I don't see how it's possible to auto-trade with them in a strategy. I tend to favour Range bars, but even they have their (significant) limitations.
Thanks for reading my posts and taking an interest in some of my ideas. I appreciate your dialog and contribution to the topic of filtering through choppy / sideways markets. I think this is one of the most important topics out there, so perhaps I should expand on my thoughts further in the hopes that it can help out.
Let me first state for the record that I am not a trend trader, and my style of trading is completely directionless from the market. So my current success has little to do with what I am about to recommend. That being said, I used to successfully trend trade before I arrived at my current trading system.
Here are my observations over several years of trend trading:
1. There is no silver bullet in predicting the future direction of the market. All indicators / technical analysis and any other attempts at predicting the future will have the same 3 cycles:
A: The Current market conditions have just changed (A down trend is now an uptrend, or an uptrend is now a downtrend, or a strong direction market is now a sideways market, etc.) Because this measurable change event has occurred I should now do X. (In this scenario traders often take entry or exit positions based on what I will refer to as Change Event 1. The hope is that the past condition before Change Event 1 will stay in the past and the new condition that has started will continue. Because the market is made up of thousands of participants that see different things in different time frame I will simply state that Change Event 1 has around a 50% / 50% chance of materializing in your favor. Some things may seem to work better than others in the short term, but when doing a large scale back-testing of several years and hundreds of thousands of trades you will find that 50% / 50% odds is a pretty fair characterization because half of the moves in the market are fake-outs and have the moves are break-outs.
B. Once Change Event 1 has occurred, People will now use their technical analysis to predict that current market conditions will continue (an uptrend will stay an uptrend / a downtrend will stay a downtrend, etc.). Again, sometimes trends run long sometimes trends run short, but I would say you have around a 50% / 50% chance again. I will characterize this trading cycle as Continuation 1.
C. Once Chance event 1 and continuation 1 have occurred traders now have a difficult decision to make. They now have to decide if Continuation 2 will occur to keep the current trend in place or if Change Event 2 will occur to reverse the position. Given the obvious fact that there are two binary outcomes here I will once again place the odds of success at 50% / 50%.
If you take away all the fancy indicators and trading jargon this is essentially the most minimalist view of the market and how it behaves in relation to any traders attempt to understand it or predict it. I won't discourage people that believe they have found a way to break the 50% / 50% odds in any of the cycles that I have mentioned, but if you normalize everything in the most simple way this is the reality of what you are up against.
All this being said, I believe there are only two real aspects of past market behavior that carry any level of accuracy or reverence to future market behavior. And these only work outside of critical event time frames such as market opens, market closes, and major news releases: But here they are:
1. Volume: Outside of the previously mentioned critical event times, volumes tend to gradually increase and decrease. Therefore light or heavy volume in the immediate past should predict light or heavy volume in the immediate future. Unless you are near a critical event time frame, volume rises and falls very gradually typically.
2. Trading Range: Outside of critical event times, a tight trading range will typically stay a tight trading range and a large trading range will stay a large trading range. If the last 50 bars had a range of 10 points it is more likely that the next 50 bars will also trade within 10 points and far less likely that it will trade within 100 points. Like volume, the trading ranges tend to rise and fall gradually outside of critical event times.
Nothing else will be a consistent predictor of the future market other than these. So the way to use these to your advantage is to us the rule of thumb to stay out of markets with light volume and thin ranges, and only trade markets with heavy volume and larger ranges. Even these are not silver bullets, so you will never get 75% or 90% accuracy with either of these, but you will beat the 50% mark constantly, and after years of testing I have observed these are the two most consistent predictors of what the market will do next. Unfortunately they do not apply at all to direction, but you should be able to use these to filter out thin ranges in the market > 50% of the time. If I had to rate this statistically I would say the overall accuracy is around 60%.
Hope this helps a little.
The following 5 users say Thank You to iantg for this post:
First of all, I'd like to let you know that English isn't my mother tongue. So I beg your apologies if my English isn't so fluent as you.
I found your posts very insightful. I appreciate greatly your approach and methodology in market studies. I am very thankful about the time you spend to share your works. And, I have some questions to ask you.
I used to be a demo discretionary trader but I decided to look more about automated or mechanical strategy to trade market with real money. The main purpose to do this is to find the best reasonable way to trade market and to develop my system as much as precise I can. To limit any form of gambling. When I trade, I'd like to have strict rules to respect and to follow to avoid any emotional bias. So I, first try to find a logical model close to my trading strategy. It give me a reliable way to know at any time what to do : enter, hold on or exit markets. In doing so, I found that it will be easy to automate it with a small script to test my strategy on historical data. And so, this is what I got :
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).
Results are mostly same on SPX500 and DAX. It's a small logical code that I could give you if you want. According to your definition of a good system of trading. This strategy wouldn't be a good one because of the lack of 20/24 of wining months even if it used to be profitable. So what do you think ? Could I expect any future positive return any longer with this strategy ?
Pharmakon thanks for reading my posts. I may have over simplified or overstated the exact ratio of winning months to losing months (20 out of 24). There is no real hard line in the sand per se, other than you need to make more than you lose in the long run. I think the concept of "The long Run" is relative to everyone.
Let me explain my thinking and where I got my 20 out of 24 months idea from. If you want to fund your margin account with a fairly low amount: Let's say $20K USD. Then you have around $10K to $15K to risk beyond your required margin account minimum just to be in the game. If your average monthly draw down on your bad months is around -$5,000 to $,8000 USD, then as long as your testing / market replay results hold up in real trading, you could theoretically weather the storm even if you hit your worse two months right off the bat. Your originally $20K could potentially survive and in month 3 you climb out of the hole. The reason I like to see at least 24 months of history is to know if winning 10 out of 12 months is statistically likely in the long run or if it is just an anomaly observed in the year you tested. Ideally more years and more testing would be nice, but everyone has a since of how much risk they are willing to take based on what they see from testing their systems.
To me, if I can get 10 out of 12 winning months for 2 years or more, I know that under a worse case scenario if I hit my two losing months as soon as I go in with real money, I can survive with only around $20k based on my trading systems and how they work. Everyone will have to adjust their own systems to find that sweat spot but this is just my preference.
If someone theoretically had $100K to play with and statistically they won 7 months out of the year, they will make money in the long run, but there is a real risk that the $100K will get knocked down close to a margin call at certain points under worse case scenario conditions.
Most people are fairly risk adverse when it comes to their money, so if a system loses them money the first month they trade, they will likely shut down their margin account and walk away. Now if you know that statistically speaking under very large scale market replay / backtesting your system wins 10 out of 12 months, you will be more likely to stay the course and not just shut down your account and give up. Odds are if you lost during the first month you jumped in, you would likely win the next 8- 10 months in a row before you hit another losing month. To me this would be the type of testing statistics I would need to keep me in the game. There may be others who could watch a system lose 4 or 5 months in a row right off the bat, but my guess is this is less than 1% of traders.
So it just comes down to how much skin you want to have in the game, and what that looks like relative to your trading style and system.
Hope this helps. If you have any other questions let me know.
Last edited by iantg; March 25th, 2016 at 11:02 PM.
The following user says Thank You to iantg for this post:
I find this post very intresting. Thank you for sharing.
I'm not trading with bots so maybe I will make a stupid remarks.
I found little value in bots for retails investors because IMO their main added value is the fact that they give you the opportunitie to trade 50 market with only 1 or 2 traders and a small crew of IT guys vs having to hire 50 goods traders (which is difficult to find and fairly expensive to fund). So sometime if you have lots of equity it is better to be just average on 50 market than good on 1 or 2 ? But for us in general having too much $ to invest in not our main problem?
For the same reason I found them efficient in the equity world since they can scan thousands of stocks per second to find abnormal prices (which you can not do with one human brain). I remember one Guy in Japan who has made at the beginning of his career more than 1M$ in one trade because his bot has spotted a fat finger mistake from a broker who instead of selling 1 share at 600k yens has entered a sale of 600k shares at 1 yen... it was a very illiquid stock so he had the time to purchase a large block of them.
Other than that I don't see any added value except of course the purely intellectual challenge ?
R.I.P. Olivier Terrier (aka "Okina"), 1969-2016.
Please visit this thread for more information.
Last edited by Okina; March 26th, 2016 at 07:21 AM.