Daily Market Conditions for Auto Trading

trading strategies and money management discussion, code, results

Moderator: moderators

greaterreturn
rank: 50+ posts
rank: 50+ posts
Posts: 64
Joined: Mon Feb 11, 2008 2:57 am
Reputation: 0
Gender: None specified

Daily Market Conditions for Auto Trading

Postby greaterreturn » Sat Apr 05, 2008 2:25 pm

Whether you auto trade or trade discretionary, you can probably help. And I'll reward you for an idea that produces results!

Currently, I have thoroughly tested an auto trading strategy both on historical tick, forward testing, and real time testing on multiple different Forex pairs using NinjaTrader.

It consistently makes 40% to 50% win/loss ratio with 14 pip average win and 4 pip average loss at 8 average trades per day. It only trades during 8 am to 12 noon EST. It's a simple 20 minute breakout strategy using advanced exit logic.

So it makes excellent returns from a holistic strategy perspective and it never needs "optimizing".

Now, let's brain storm about daily performance.

70% of days make great profits of 40 to 80 pips per day that have winners mixed with a few loser trades. Those winning days never have more than 15 pips draw down from the previous day.

However, certain days produce a string of losses that ends up at a loss or recover to a small loss or very small profit.

My goal is to filter out and avoid trading on those days. Ideas that work:

1. Filter based on tick volume per 5 minute period. This works excellently! It eliminates days like holidays or other low activity periods. In fact, that raised my win/loss ratio from 30% to 40% where it is now.

2. Terminate the strategy on a particular day that has greater than X draw down. While this feels good and I currently use it just for safety, it slightly hurts the profits because of some days that go down but recover to a smaller loss or even a small profit. This method locks in the loss at a certain level. I'd rather filter out the entire day.

Ideas that never seem to work:

1. Filter on small ranges. Some big winners happen after low range periods and others in large range periods. So this idea flopped unless I did I wrong.

2. Filter on volatility or momentum. I haven't figured out a way to use it as a trade filter. It seems winners and losers equally happen on low or high momentum times.

Conclusion:

While the strategy trades fine the way it is (with the daily limit of losses), it would be nice to discuss or experiment with other daily filters on market condition or otherwise.

Sincerely,
Wayne

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
eudamonia
rank: 500+ posts
rank: 500+ posts
Posts: 536
Joined: Thu Jun 15, 2006 9:50 pm
Reputation: 0
Location: Rocklin, CA
Real name: Edward Heming
Gender: Male
Contact:

Postby eudamonia » Sat Apr 05, 2008 5:53 pm

Wayne,

I'd like to congratulate you on putting together such a system. It is very similar in its statistics to the way that I trade (i.e. 40% win ratio, 3.5 to 1 risk to reward ratio etc.)

The BEST advice I can give you is to formulate some risk/position sizing rules that are conservative (i.e. do some Monte Carlo analysis and some worst case analysis) and TRADE your system.

One other piece of advice - don't stop trading when you have up to 18 losers in a row (this will happen if you trade this method over any period of time).

That's it quite frankly - the Holy Grail to your system. IF you can stick with it you will make profits in roughly 65% of all weeks and 85% of all months and 95% of all quarters. Your return/drawdown ratio will be roughly 4 or 5 to 1 or better. You will be more successful than 95% of all hedge funds.

My guess, however, is that you WON'T listen to a word I say. My guess is that you will waste precious time attempting to get your winning % up (probably at the sacrifice of your risk to reward ratio) - hence actually worsening your expectancy. Even if you have the courage to follow what I say your money management will be too aggressive (you will risk too much per trade and overall) and the first series of 8 or more losers in a row will dishearten you to the point where you abandon your idea completely.

I hope I am not coming off as a $*#$&!, but I know it sounds harsh. By the way I am also speaking from experience. Because I have fallen into this trap so MANY times myself.

I hope you don't take this as an idea that "filters don't work", that's not really the point of my post. There are certainly filters that do - as you have seen. However, there is no "perfect" market filter that will make your winning ratio 100% with a 100 to 1 risk to reward ratio. In fact, it has been my experience that "over filtering" the market tends to curve fit your strategy and guaranteeing it's eventual failure. My best analogy is this - some spices in your soup make it good - but too much spice will ruin your soup.

Ultimately trading the market is about YOU. Do you have the brass required to RISK your hard earned dollars in the market place and the CONFIDENCE it takes to continue trading when the chips are down? If not then you won't ever make it. Sorry, but that is the secret to trading. Yes you must have system with a positive expectancy (and the knowledge to know a robust method from a curve fit one), yes you must have cash in your account, but most IMPORTANT of all you must have the experience and the wherewithal to ride out the storm.

To sum up, as Michal would say, "You must KNOW what you are doing".

Edward
Eudaimonia (pron.: you-die-moan-e-a) (Greek: εὐδαιμονία) is a classical Greek word commonly translated as 'happiness'. The less subjective "human flourishing" is often preferred as a translation.

greaterreturn
rank: 50+ posts
rank: 50+ posts
Posts: 64
Joined: Mon Feb 11, 2008 2:57 am
Reputation: 0
Gender: None specified

Postby greaterreturn » Sat Apr 05, 2008 10:53 pm

Thanks Edward! I read every word.

You are very kind to open members eyes to the challenges of trading. It's an excellent public service. And I agree with everything you say.

In essence, you advise against analysis paralysis by saying TRADE YOUR SYSTEM. That's good advice.

After re-reading your post a second time, I decided to switch my energies away from improving those losing days instead to writing the Monte Carlo run you talk about and explained in other threads.

I plan to start this version of the strategy running live on Monday morning.

After I have this version running live, however, I plan to experiment with a post TRO made today in the Buy Zone thread. He uses a 960 hourly range average and 24 hourly bar range average to dynamically determine his target profit.

That's what I need!!! On the losing days, the market is more tranquil and the good trades on those days don't have enough steam to trigger to my "fancy shmancy" exit strategy. And I can't lower the trigger as it damages the strategy on other days. But if I can find a dynamic formula to lower the trigger on less volatile days, that should make them profitable.

But since that takes time to experiment and fine tune, I'll focus right now on getting this version into production by Monday A.M. according to your advice, Edward.

Thanks for the encouragement and frank words.

Sincerely,
Wayne

greaterreturn
rank: 50+ posts
rank: 50+ posts
Posts: 64
Joined: Mon Feb 11, 2008 2:57 am
Reputation: 0
Gender: None specified

Postby greaterreturn » Sun Apr 06, 2008 3:10 am

Edward, WOW! Your advice was spot on, of course.

I built and completed the monte carlo run.

It turns out that only risking 0.5% (1/2 of 1%) of the account balance on each individual trade looks safe.

The test ran 10,000 monte carlo runs where each run randomized 1 year of trading.

So with that risk per trade, this strategy had a worst case draw down of 24% out of all the 10,000 runs. On average, it turned a $1,000 account into $12,515.22 in one year. That's a 281% annualized return on investment--slightly better than other standard investments.

So on a $1,000 account that's only $5 of risk per trade. Since the average losing trade is 5 pips (including 1 pip in commission) that means only 1 mini lot can be traded.

NOTE: That means that my max loss per day (due to the daily loss limit) would be 20 pips * 1 lot or $20.00. Even a string of 5 days at $20.00 per day wouldn't discourage trading, agreed? And I think that's the key to your concern--ability to stick to it through the draw down periods, right?

LESSON LEARNED:

After studying and experimenting with Monte Carlo runs, it became clear that the real answer to growing the account fast is to invest more money in the account initially rather than taking more risk per trade.

Since it has 281% return with only 25% worst case (average only 10%) max draw down, that seems a wise course.

So the plan now is to start trading the strategy Monday and budget adding more money to the account each month until the total balance reaches $10,000.

After that, I'll probably start drawing money from it each month or perhaps, more strategically, after each 25% run up.

Thoughts, Edward?

Sincerely,
Wayne

peter_77_peter
rank: <50 posts
rank: <50 posts
Posts: 41
Joined: Fri Feb 02, 2007 3:36 pm
Reputation: 0
Location: a beautiful pirate island in the mediteranean sea
Gender: Male

Any suggestions for a good monte carlo tool for TS?

Postby peter_77_peter » Sun Apr 06, 2008 2:18 pm

Hi Ed and Wayne and all other pirates on this thread!

I´ve found your discussion about adjusting your risk / sizing to the results of Monte Carlo analysis very helpful.

Actually, after 1,5 years of development we have to perform Monte Carlo Analysis as a next step, to get a better esteem about the risks/drawdowns we´ll be facing, finally adjusting our risk/sizing parameters to the results coming from that.

The thing to keep in mind concerning this is: If you generate some hundreds of trades with your backtesting, parameters like %winners might be reliable, if you are robust concerning strategy settings and out of sample data respective to a peer group of stocks resembling the profile of stocks you need for your approach. On the other hand side: the distribution of trades resolved from backtesting is not reliable. But the distribution of the trades is crucial to the appearance of loosing streaks and drawdowns, and that is crucial about staying in the market to finally cash in the positive expectancy of your system, that is the reward you´ll get for the risk you take as overall performance.

So if you´ll adjust your risk parameters to backtesting, the chances that you´re doing fitting are high, resulting in being swept out of the market before you are able to cash in your edge. That´s why you have to run monte carlo analysis to get a better esteem on a proper choice of risk / sizing.

My Question: If anybody knows a good tool for doing this compatible with TradeStation, any link or suggestion is highly appreciated. Please keep in mind that our trend following system is quite sophisticated, that is we are running optimization on a TS Multi-Data-Screen, have seperated our code into several strategies, like one for filters, one for triggers, one for exits/sizing and incorporated own globalvariables to be able to communicate throughout this. Any Tool suitable has to be able dealing with this.

Some tools / information on Monte Carlo Analysis I´ve found googling this:

http://www.adaptrade.com/montecarlo.htm
http://www.portfolioriskanalysis.com/what_is_mcs.html

Apart from that I´ve just posted a long text trying to share some of the experiences I´ve made within 1,5 years of developing a trading system in the thread: "to automate or not to automate". Any comments on that are appreciated as well.

best regards from spain,
Peter
Last edited by peter_77_peter on Sun Apr 06, 2008 6:32 pm, edited 1 time in total.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

greaterreturn
rank: 50+ posts
rank: 50+ posts
Posts: 64
Joined: Mon Feb 11, 2008 2:57 am
Reputation: 0
Gender: None specified

Postby greaterreturn » Sun Apr 06, 2008 5:21 pm

To do Monte Carlo analysis, I just wrote custom C# code. I pasted in a array of the trades from 2 backtests on different instruments and coded it to randomize the list and then a method called getTrade() that returns the next trade in the list. When it reaches the end, it re-randomized the list and starts over.

I uses a random number of trades per day from 6 to 15 since that's the max and min # of trades per day in my system.

Then it also does the logic of if the day has a X draw down from the previous day, it stops the trades for that day and moves to the next.

It randomizes 200 days (a year of business days) of trades and then repeats that process 10,000 times. During the 10,000 runs, it tracks the average profit at the end and the max % drawdown ever during any of the 10,000 runs.

You can set the starting balance and % account risk per trade inside the code.

This is NOT a user friendly windows application. It's raw code that does the job.

If you want the code, I don't mind sharing it. I may even tweek it and improve it over time.

But you'll need to know some C# or be good at googling it to adapt it to what you need.

Let me know. I'll post it.

Wayne

User avatar
eudamonia
rank: 500+ posts
rank: 500+ posts
Posts: 536
Joined: Thu Jun 15, 2006 9:50 pm
Reputation: 0
Location: Rocklin, CA
Real name: Edward Heming
Gender: Male
Contact:

Postby eudamonia » Sun Apr 06, 2008 5:45 pm

Wayne,

Your Monte Carlo results sound reasonable and I agree that risking 1/2% per trade is a prudent approach and is in line with the risk I take on a per trade basis for many of my systems.

I'm glad that you are spending some time on risk management and as Peter wisely pointed out in our backtesting we are often fooled into believing that we can risk more than we actually can (that's because a backtest only shows one possible distribution of trades).

Confidence in your system of course is very important and I believe that managing risk appropriately (as well as backtesting your ideas) can give you the confidence to stick with your method through thick and thin.

Good luck with your trading Monday. I assume that you have tested to make sure that the backtesting fills/slippage/commissions are appropriate for live trading. Assuming you've done that then you should be well on your way to success.

Edward

PS Peter I use Adaptrade's MSA software for my analysis and it works brilliantly with or without TradeStation. I'm sure it's not as customizable as your own code but I'm not the coder that Wayne is.
Eudaimonia (pron.: you-die-moan-e-a) (Greek: εὐδαιμονία) is a classical Greek word commonly translated as 'happiness'. The less subjective "human flourishing" is often preferred as a translation.

peter_77_peter
rank: <50 posts
rank: <50 posts
Posts: 41
Joined: Fri Feb 02, 2007 3:36 pm
Reputation: 0
Location: a beautiful pirate island in the mediteranean sea
Gender: Male

thanks for the fast answers, and some infos on commision/f/s

Postby peter_77_peter » Sun Apr 06, 2008 6:46 pm

Dear Wayne and Ed,
thanks for explaining process and tools you are following doing Monte Carlo.

I think I´ll first research whether Adaptrade MSA is customizable to my needs, if not I get back to you Wayne, considering recycling your homegrewn code. In the end its always best to do the dirty work on your own, to know exactly what kind of reliability you get. On the other hand side, you don´t have to reinvent the wheel, if there´s realiable tools at reasonable prices.

Ed: Do you use Adaptrade MSA for Monte Carlo only, or are you making valueable use of any of its other features?

thanks again,
and good luck with your trading,
Peter

p.s.: Considering Eds advice on reassurance with respect to fills/slippage/commissions I definitely agree, and like to point out that there are small inconsistencies in Tradestation, like: In TS Backtesting all commissions are calculated on a per piece basis. If you´re dealing with position sizes that add up commissions to an amount smaller then a dollar, then this is slightly misleading because you´ll have to pay the 1$ Minimum in reality. Thats why I implemented an own comission able to see the small difference it makes. I do pretty mid-term trading, and found it as well useful to implement a switch not considering intraday tick data, only sticking to closing ticks. This way I get optimization results that are not distorted by TS "tick simulation" which I don´t trust that much, or can question it, estimating the influences it might have. As well to get a better esteem considering slippage you should watch tick data, or collect tick data, or spend some money on collecting test trades, therefore you can check whether your estimates are sound. Things like this can easily add up with heavy trading. But most important, as anytime, it´s just good to know what exactly is going on.

greaterreturn
rank: 50+ posts
rank: 50+ posts
Posts: 64
Joined: Mon Feb 11, 2008 2:57 am
Reputation: 0
Gender: None specified

Postby greaterreturn » Sun Apr 06, 2008 9:20 pm

About fills/slippage/commission, I coded the system entirely using limit orders. Discretionary day trading on the emini taught the importance of that years ago.

As for fills, the limit is set at 1 pip better than the market. Half this time it fills at the market, the rest of the time it fills a pip better or at the limit price. About 2% of the time the limit never gets filled, so it cancels it after a number of seconds.

Partial fills still aren't handled by the strategy. But since I'm only trading 1 lot, that's useless anyway for now. I'll work on that after it's in production. That's an intriguing issue.

Commission Yes, I'm calculating in commission also. 1 pip is the cost at MBT. All the stats I gave earlier included commission.

GOOD NEWS. I went through every single trade today to verify that each trade correctly followed the rules and found a bug in the exit system. After fixing that, the win/loss ration bumped 5% better.

Actually, I plan to flip it on to live trading tonight using only a micro lot just to make sure it connects to my live account and processes correctly. That's critical since this will be the first time to hit the live account in an automated way and I won't have time to deal with any significant issues in the morning. Got a day job!

Once any kinks are worked out tonight, it'll be ready for tomorrow morning.

Thanks for the encouragement!

Sincerely,
Wayne

greaterreturn
rank: 50+ posts
rank: 50+ posts
Posts: 64
Joined: Mon Feb 11, 2008 2:57 am
Reputation: 0
Gender: None specified

Postby greaterreturn » Sun Apr 06, 2008 11:57 pm

Just finished testing for the evening. Of course, fixed a couple of bugs. And now the strategy is very properly refusing to trade the USDJPY due to its tick volume filter. So I'll get up early and test again before the 8 EST to 12 EST pseudo session starts.

It appears from studying charts today that it can be improved by resetting the 20 minute breakout range every 5 minutes instead of every 20 minutes. That's one idea to test after this thing is generating equity.

- Wayne

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “strategy trading & money management”