Automated Trading Championshio 2007: Common Errors in Expert Advisors

 

Automatic Checking


This year, we developed a system of automatic checking the submitted Expert Advisors, checking results being reported and the authors being notified about test results. This solution accelerated checking and improved its quality. The first several days of automatic checking revealed that many Participants had not checked their Expert Advisors before publishing.


How to Test an Expert Advisor Properly


Below are requirements of testing Expert Advisors using MetaTrader 4 Client Terminal build 209 (it can be downloaded at http://www.metatrader4.com/files/mt4setup.exe):
  • Temporary contest accounts (given in the Profile) with all Championship terms set up will be allocated to every Participant. To connect to server demo.metaquotes. net:443, it is sufficient to specify the login, the password and server name demo. metaquotes.net:443 manually in the authorization window:



  • After having been connected to the contest account, it is necessary to download the entire one-minute history from the HistoryCenter for the relevant symbols starting from 1999 (all timeframes will be recalculated automatically):




  • The Expert Advisor must be tested with the period of time from 2007.01.01 to 2007. 08.20 using the symbol and timeframe selected by the Participant and the "Every tick" bar modelling mode with checkbox "Recalculate" checked:



  • The maximum permissible duration of a test pass is 5 minutes (using modern Xeon, AMD X2). If an Expert Advisor needs more time for one pass, it will not be accepted due to its overconsumption of resources.

  • After each pass, all logs must be checked for possible trade errors. If a trading error occurs (absolutely any!) in test, the Expert Advisor will not be allowed to participate in the Championship. Network failures that may occur during the Championship are not classified as trade errors.

  • If an Expert Advisor stops by margin call (Stop Out message), the Expert Advisor will not be allowed to participate in the contest.


Common Errors in Expert Advisors


First of all, we check the results of all trades. Below is the list of the most common errors:
  • OrderSend error 130 (ERR_INVALID_STOPS) - stop levels are invalid or too close to the market.
  • OrderSend error 131 (ERR_INVALID_TRADE_VOLUME) - invalid volume of the trade: the rule prescribing to have volumes within the range from 0.1 to 5.0 lots (step 0. 1) has been broken.
  • OrderSend error 134 (ERR_NOT_ENOUGH_MONEY) - the money available on the account is insufficient to complete a trade.
  • OrderSend error 148 (ERR_TRADE_TOO_MANY_ORDERS) - the amount of open and pending orders has reached the limit set by broker. This is the direct violation of the Championship terms limiting the amount of simultaneously opened orders to 3.
  • OrderXXXX error 4051 (ERR_INVALID_FUNCTION_PARAMETER_VALUE) - the function parameter has an invalid value.
  • OrderModify error 1 (ERR_NO_RESULT) - an attempt to modify order with conservative values (for example, set StopLoss for the same value as previously). This indicates a "sloppy" coding.
  • zero divide - error of zero divide caused by careless coding.
According to the Rules of the Automated Trading Championship 2007, the margin call level makes 50%. It was fully unexpected to see dozens of Expert Advisors stopped because of Stop Out. Expert Advisors that have not manage to pass tests within the time period from 2007.01.01 to 2007.08.20, will not be allowed to participate in the contest.

Multicurrency Expert Advisors


Multicurrency Expert Advisors cannot always be adequately checked within the MetaTrader 4 Tester and often return the following error:
  • OrderSend error 4106 (ERR_UNKNOWN_SYMBOL)
This error is not fatal and can be neglected. Successful test results are not required for multicurrency Expert Advisors if no other errors occur. And, of course, these Expert Advisors must observe all the rules.

A Participant must explicitly specify his or her Expert Advisor as a multicurrency EA in the description. Since an Expert Advisor of the kind will not be tested by Organizers for sure, the developer must make sure him or herself that it works properly. We will make a final acceptance of multicurrency Expert Advisors manually after the 21st of September 2007. Unfortunately, if errors are found after the 21st of September, it will be impossible to update the multicurrency Expert Advisor.

Computer Overconsumption


The Automated Trading Championship 2007 is conducted to not only demonstrate successful trading strategies, but also to show effective software solutions. This means that the Expert Advisor must be coded well and effectively/economically. About 30 terminals with contest Expert Advisors will be launched on each server configured as Dual Xeon RAM 4Gb. If an Expert Advisor starts consuming of too many resources (processor, RAM, or disk space) and obviously disturbing other Expert Advisors' work, it will be disqualified.

For automatic testing, we set a limit of test passing to 5 minutes. If an Expert Advisor does not manage to pass the test from 2007.01.01 to 2007.08.20 within this period of time, it will be stopped forcedly with the reason for this given as: The Expert Advisor takes too long time (more than 5 minutes). Unfortunately, several dozens of Expert Advisors could not pass tests for this specific reason of resources overconsumption.

We would like to ask al Participants to check their Profiles, read the comments there, and modify their Expert Advisors' codes accordingly.
 
hello12345:
what does this sentence mean: About 30 terminals with contest Expert Advisors will be launched on each server configured as Dual Xeon RAM 4Gb.??
will this mean, that there are many EA in one terminal, and so if one EA is trading, "trade context is busy" will be for the other? so an alltime trading is not possible?
is there a maximum number of alloud orders per hour or per day, because some experts use many orders, some less.

Sorry, if that sentence was not quite clear. No, there will not be many Experts in one terminal. Only one EA will be launched in each terminal. "30 terminals on each server" means "30 Expert Advisors" on each server.
As to the maximum number of allowed orders, it is stated in the Rules of the Championship: Only 3 orders can be opened simultaneously. It means that your Expert Advisor must be coded in such a way that it cannot open more than 3 orders (no matter of what type) at the same time. Say, if there have already been 3 orders opened at a time, your Expert may not open the fourth one BEFORE it closes one of those three.
 
hello12345:
maria:
hello12345:
what does this sentence mean: About 30 terminals with contest Expert Advisors will be launched on each server configured as Dual Xeon RAM 4Gb.??
will this mean, that there are many EA in one terminal, and so if one EA is trading, "trade context is busy" will be for the other? so an alltime trading is not possible?
is there a maximum number of alloud orders per hour or per day, because some experts use many orders, some less.

Sorry, if that sentence was not quite clear. No, there will not be many Experts in one terminal. Only one EA will be launched in each terminal. "30 terminals on each server" means "30 Expert Advisors" on each server.
As to the maximum number of allowed orders, it is stated in the Rules of the Championship: Only 3 orders can be opened simultaneously. It means that your Expert Advisor must be coded in such a way that it cannot open more than 3 orders (no matter of what type) at the same time. Say, if there have already been 3 orders opened at a time, your Expert may not open the fourth one BEFORE it closes one of those three.
wow, very fast answer.so maybe i can ask you some other.
1. is there a amount of maximum pending orders open and close per hour or day. sometimes my EA opens 20 pending orders in one hour, is this a problem?
in the last championship was some EA deleted because of to many pending orders, but i dont know the amount, how oft the modify the orders.
2. in the rules there are 2-7 seconds fill in time for orders. in the "championship try-account" i often have 1 second in non fast market movement times.
will this be changed in championship or will this be possible sometimes with 1 second?
3. if i use a while loop because i have to refresh rates often (use 3 currencies), is a sleep(500) enough for saving cpu recources?
4. DataCenter connecting failed [6] was a error in the journals of the last year championship? how can i deal with this or is this error out of date?
Well, we will try to answer them, too:

1. Yes, 20 pending orders may become a problem, since the Rules prescribe only 3 simultaneously opened orders (see above). So, it does not mean per hour or per day, it means no more than 3 open orders at every moment of time. Theoretically, your Expert may open many pending orders, but the number of those being open at every specific moment of time may not exceed 3.
2. The conditions for "championship-try accounts" during the Championship will be exactly as it is prescribed by the Rules. If you sometimes see 1-second fill-in time, it's only because the conditions have not been properly tightened yet. But they will. Please consider 2-7 seconds to be the rule.
3. It's difficult to say whether sleep(500) would be enough for saving cpu resources or not. Let's say so: You should do your best to minimize the resources consumption.
4. As they say: Man proposes but God disposes. We will do our best this problem not to occur. However, there are more than us who may cause this problem. The same may happen during trading on a real account.

Hope this was helpful for you.
Regards,
 
thanks for the help, but i have to ask ones again because of question 1.
i mean the opening of 2 pending orders. then closing. then again opening. so there will be only 2 orders in the account at the same time.
but in the last championship some accounts was closed because of to many of this pending orders.
i dont know if they open and modified and closed it all the time, so my 20 sometmes will nit be a problem.
but thatswhy i ask for a maximum number per hour or per day, if there is any maximum.
an other think i saw by pending limit orders. if a open a limitorder, lets say a limit buy, and the next price will be for instance 3 pip below this limitprice, i allways get the limitprice and
not the real price that was reached in the market. is this normal? so sometimes by big movesthere are big differences.

i problem is the while loop too. without while looping i get a result in backtesting, with while(IsConnected()) i dont get any backtesting result.
is this normal?

thanks for your patience.
 
Will you change your server time during Daylight Saving Time change?
 
Milan:
Will you change your server time during Daylight Saving Time change?
Yes, it will be changed.
 
maria:
Milan:
Will you change your server time during Daylight Saving Time change?
Yes, it will be changed.
OK, I hope, it does mean the difference between server time and living time will be the same after DST change. Won't it be?
 
Milan:
maria:
Milan:
Will you change your server time during Daylight Saving Time change?
Yes, it will be changed.
OK, I hope, it does mean the difference between server time and living time will be the same after DST change. Won't it be?
Yes, it will if your place also changes time at the same time as our server does. In Russia, for example, it is usually the last Sunday of October. There are some countries (for example, China, so far I know) that don't change time at all.
 
The following code gives me an OrderModify error 1.  Can anyone tell me why?  All I want to do is move my intial stoploss to a
profitable position.  Do I have to modify my take profit as well?
 
OrderModify(OrderTicket(), OrderOpenPrice(),(OrderOpenPrice()+ movestop*Point), OrderTakeProfit(),0, Red);
 
Any help would be appreciated
 
I think I've figured it out, please disregard
 

In verification report of my Expert Advisor I recieved the following message:

-----------------------

62500 kb of log files (must be less than 64 000 kb)

0 min 50 seconds

Errors: 1

---------------------------

What does "62500 kb of log files (must be less than 64 000 kb)" mean?

Is my EA ok? what is the "errors : 1" ?

Reason: