1.) Point taken with your breakout question so I should rename the EA :-).
2.) I open 20 orders as it tends to average out the risk and prodiuces a lower drawdown in the longterm. I plan to detect when the first order fails and then make some kind of a hedge in the future to limit losses, but that will come in the next month or so.
3.) The 310000 is to close orders where they have been open too long as this is usually due to being in a long term sideways movement or downtrend. It is much better for this system to close these and limit losses and start trading at a more realistic level. The difference this makes is phenominal.
4.) This could also be programmed to short too but not got around to this yet. I think ATR could be used to improve things and also a trailing stop could be used in some cases but this would have to be on the fly decision based on some other things Ihave discovered. In most cases a fixed stop is the answer.
It might not be a bad idea to make the changes in stages. In other words, program it to short first with the current exit strategy and test that first. Then look to add ATR, trailing stop, etc. After all, the tests above do have some merit but who knows how much more they would have improved had the EA opened short positions as well. Hey, perhaps you might get to like it and not have to "go to work"
Leave all the default settings and apply to EUR/USD 5M.
Short & Long
Here's the EA modded to make short trades as well as long trades.
A couple of things to note... once the "breakout" condition has been met, the EA keeps on opening positions for every tick that the price remains above the 100 bar high (or below the 100 bar low for selling) until 20 positions are opened. This means all the positions are usually opened bunched up together at the same time and around the same price. Might it be more efficient to open just one larger position?
Second, once 20 positions are opened in one direction, no new trades will be opened in the opposite direction even if the trend reverses and breaks out in the opposite direction. It might be worth seeing if a breakout in the opposite direction is a good place to stop out the earlier trades and enter new positions in the new trend direction.
Backtesting on M30 with this EA enters bad positions on 20/2/2008 when there is a short lived "sell" breakout, which gets stopped out at -1000 pips on 13/3/2008. If those sell orders were closed when the next "buy" breakout occurs, the loss would only be about -100 pips on those trades.
New Long/short version
I've modded the EA again.
Now it only opens one position in the breakout direction. Position stays open until TP is hit, or until there is a breakout in the opposite direction. (Position won't be closed after specified period of time)
I've removed the MM for now, just trades fixed lots. Can add this later when it's more developed. I've also enabled trade on Friday, my feeling is that if there is a position already open from earlier in the week, it could miss a vital reversal signal if it happens on Friday, which might mean a bigger loss.
The results now have more losing trades, since the SL (opposite breakout) happens more often than fixed 1000 pip SL. Backtesting from Jan 2007 does not give encouraging results, I think more work needs to be done to find optimal parameters.
Also there's something weird around 18 Feb 2008 to 13 March 2008. It might just be my data, but it enters a sell on the 18th, and apparently there is no opposite breakout and the 1000 pip SL is still being hit on the 13th.
New trailing stop version
Added trailing stop.
Trailing starts when profit hits "trail_margin" pips - the stop loss is moved to break even.
The stop loss is moved "trail_every" pips closer to the current price each time the current price moves"trail_every" pips further from the opening price.
If the price does not reach "tail_margin" profit pips after breaking out, the stop loss will be whatever the price is for breakout in the opposite direction.
I have to say the results are very disappointing for M30 with trail_margin = 20 and trail_every = 5.
Might have to play around with the parameters to find combinations that work better.
Thanks for posting your modifications. Hopefully everybody else will find them worthy of testing. I am testing v2 currently and will let you know what I find.
Hi, thanks for your work on this. Just a few points:
1.) I opened multi lots / trades as this performed better in the long run on backtests. Drawdown was less.
2.) The Money Mangement is VERY important to the success of this.
I do not believe that it is possible to Predict the future prices with any accuracy so therefore the system is more there to make the most of earning from random fluctuations.
I like the idea of a trailing stop. Do you think this is better than a fixed stop?
OK here's the last version I'm doing for now.
This fixes a bug I introduced in versions 0.2 and 0.3
Trailing Stop has now been made an option. If you don't use it, the TP and SL levels will be as you specify.
Money Management has been added. If you use it, the lot size will be the specified % of your free margin, with the lot size calculated appropriate to LotSize (if your broker can use microlots, set LotSize to 0.01. If you can use minilots, set it to 0.10. If you can only trade whole lots, set it to 1.0). If you do not use Money Management, all trades will be done with LotSize lots.
Many thanks. I'll give it a go in forward test.
Could it be that there are still some bugs?. If I try my version and then your version on backtest with the same settings the results are MUCH different as if the basic logic no longer exists. Was there something you had to correct in mine perhaps?