Ubzen Creating Immortal EA

 

Lately, theres been allot of discussion about how an EA must Die. I've decided to create this thread to settle the Myth once and for all. This little project of mine would be trying to answer one fundamental question "Can a Expert Advisor really survive the test of time?". There has been a few articles and discussions here and there but nothing comprehensive. This would be an attempt to put some mql4 codes behind the legend.

The goals of this project:

  1. The EA must Survive a 10 Year Back-Test without using Strategy Optimizer.
  2. The EA must return 30% Annually and have a Relative Drawdown <= 30%
  3. The EA needs to work on the Major Currencies as outlined by the Championship website.
  4. The EA needs to Identify Trending and Ranging Markets Automatically and trade accordingly.
  5. The EA must be Self-Scoring and Self Optimizing without using Strategy Optimizer.
  6. The EA must Survive 3-Months of Demo-Live Testing.

This may seem like a complex project but I actually intend to keep it quite simple. For the system, I've decided to go with Week-End Gaps. Yep, cant get a cleaner signal than that. And for the Fountain-of-Immortality I'm gonna be looking at Be-In-Phase and BarrowBoy's SFX. If anyone have any articles or approaches which deals with this subject, I'll like you to post. For now, I'll wait on some suggestions and then I'll move on.

 

They are pretty goals... Why not have a few EAs working together - They trade when the market suits them and stop when the market doesn't? Do we really need an EA that can make pips no mater what? This is an interesting topic you have created and I look forward to what people have to say.

 
They trade when the market suits them and stop when the market doesn't? Yeah I think thats along the same lines. The question becomes when to switch to which system? Does that really generate a winning approach? Could you teach this approach to someone without being ambiguous about how it's done?
 

Admirable project Ubzen! I hope that what I'm working on will pass your test. Here's what I'm up to:

I did an Excel spreadsheet of two months' trading history using a strategy that effectively picks up trends, down trends and channels then trades accordingly. I watch the hourly charts with a 144 period moving average and 24 period bollinger bands. This lets me compare hourly price movements to the daily and weekly ones rather effectively. When the two moving averages agree that there is an up trend in effect, I go long until the trends no longer agree (one turns down). I do the opposite when both averages agree on a down trend by going short and liquidating when one of the averages turns upward. If my weekly average (the 144 bar moving average) doesn't move more than 20 points between two bars (when I'm not in any open positions) I declare the trend a channel and place trades based on the bollinger bands. I go short if the daily moving average (middle band) is above the weekly average AND the price was recently outside the upper band but has come back inside the bands. I go long if the complete opposite is true (daily below weekly and price went below lower band but has come back inside the bands). In both cases with the channel trades, I liquidate the positions the instant the price hits the opposite band from the trade's entry point.

This is the data I got (being completely honest with myself over the entries and exits, taking losses like a man (and not drinking over them either)):

60% of the time, one lot trades gained 450 points

40% of the time, one lot trades lost 230 points. (both of these figures are adjusted for an average spread of 60 points)

So, more than half the time, I gain and less than half the time, I lose half of what I usually gain. Average gain per trade is 220 points.

I'm still fairly inexperienced at coding in MQL4 and I'm having a terrible time making this thing come to life. Especially since the entire MQL4 site went down today and I had no access to Documentation :P

I'll be watching this thread.

 
ubzen:
They trade when the market suits them and stop when the market doesn't?


That has to be your aim - as a minimum you will need one system/EA for ranging, one for trending
Combining all that code in one EA is a potential development & performance headache
Also they may need to trade on the overlap, so one maybe covering (i.e. trading opposite to) the other
They will respectively need to now how wide the range is or how strong the trend is and... when chaos reigns!

-BB-

 
ubzen:

Lately, theres been allot of discussion about how an EA must Die.

If an EA Dies, then get another one, or have a few to complement. I don't see any problem or the need for such discussion, whatsoever.

 
Moved to BarrowBoy's SFX
 
BarrowBoy:



Combining all that code in one EA is a potential development & performance headache

Ranging = Channeling I assume? Sideways average movement?

I can work out my system with pure boolean logic and math on paper. The trick is translating it into MQL4. I'm trying my damndest.

60% +450, 40% -230, DD < 20% based on two months' data I plugged into Excel.

I've explained how it works earlier. It shouldn't be too hard to program but I suck at it.

 

Thanks to all for all your comments. I'm going to switch gears now and focus on the Meat and Potatoes of such an approach. The Week-End-Gap, why Weekend Gaps, well because it's the first thing which ever worked for me. It was easy to code when I first started out and it seemed to yield some good results. I read about it somewhere online during my newbie days and the post said something like the gap always closed around 90% of the time. 90% that seems pretty good, so why isn't everyone getting rich of these. Well I think some of the reasons are because of drawdowns. Just because a gap Will close does not mean it'll close anytime soon. This lead me to my second law of trading (just made up the law part) its probably not enough to know which direction the market is going, I'd also need to know when its gonna start moving there.

Ok, so with gaps, I know the direction but I don't really know which direction it going to go in first. This brings me to the third law, that is: whichever direction its going to be going in first is the True direction. Now heck, I can probably ketch all 90% of those gaps closing or give myself a decent chance of closing with a profit by averaging the price in a grid like fashion as it goes against me, but to what end. If price does not come back, I run the risk of blowing the account Quick. For this reason, I'm gonna leave one of my favorite Technique (averaging) out of this project unless as part of last result analysis. Mostly every tech will-be on the table as I'm trying to develop this Immortal System, but the convention ones will take priority above the non-conventional methods.

The 1st Run: this stage would be consist of programming a gap logic where if the gap is greater than 9-Pips the system will place an order expecting that the gap will close. The stoploss and takeprofit in this case is quite simple. Basically, its the distance of the gap. The lots size would be fixed of-course. This create a 1-to-1 profit to loss ratio per-trade (-spreads). If a system can profit under such conditions for an extended period of time then theres really the only thing left worrying about is how to get our 30% returns and drawdowns out of it. IIRC, I don't think it's going to pass this test. ....Ok, I gotta go, I'll update later.....

 

Hello Ubzen, I have a question concerning your conditions here.

I have run into a problem whereby channels behave differently between silver pairs and currency pairs that trade on four digits.

You see, I have to tell my EA that if a pair has four digits, treat it in calculations as though it has five (by including the damned zero). This is because four-digit currency pairs show channels at 2 pips or less (on the weekly moving average) and five-digit pairs show them at 20 pips or less (on the weekly as well). It's like the four-digit currency pairs HAVE a fifth digit but the powers that be do not acknowledge this to the common man as they should.

The problem will arise when I tell the EA to trade silver. Silver has four digits but shows channels at 20 pips or less, not 2 as with currency pairs. It will treat the four digit pair like it has five, making 20 pips look like 200 thereby missing EVERY SINGLE CHANNEL. This could lead to catastrophic losses.


My solution is to make two EAs based on the same math, but to simply omit the four digit modifier in one of them and rename it [myEA]SilverOnly or something. That way, if I decide to share it with anyone, I can send both in a .zip file with a read-me file explaining the difference. ["MyLittleFriend.mq4 is for use on all pairs except those that include silver. MyLittleFriendForSilver.mq4 is only for use on silver pairs. (translated into several languages)]

If I do it like that, can I still participate in your project?

Thanks.

 

I have an EA I created last week unoptimized backtest for this year starting 01/01/11 with a 50% return on deposit, but it uses martingale and had a rather alarming drawdown close to the beginning of the test but was ok, after that. You can see five large Martingale spikes in the test, the worst one was the second one. The rest did what they were supposed to do and recovered most of, or all of, the loss.

Reason: