Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-22-2006, 09:49 PM
Member
 
Join Date: Mar 2006
Posts: 91
ZTrader is on a distinguished road
How do MT4 EAs handle trade errors?

I've read a lot about re-quotes and failed orders with different brokers, but I'm wondering how these are handled by EAs in MT4... if a price quote is outside the specified slippage will it just keep trying until it gets the price it wants, or will the trade be abandoned? What if the order is rejected for some server glitch or other... does MT4 keep trying to get the order accepted?

Many EAs rely on being able to place, modify or close a position when the proper time comes, and it seems to me it would be a disaster if it just bails out under error conditions. I'm just wondering if some EA guru could explain just how these situations get handled...

THX.
Edit/Delete Message
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-26-2006, 03:32 PM
Baiwan's Avatar
Junior Member
 
Join Date: Nov 2006
Location: Singapore
Posts: 9
Baiwan is on a distinguished road
I feel the trade will just be abandoned... I am not sure if "looping" helps in this case... But, even you try to loop it... The next question is to loop for how many tries... Don't forget the time is clicking and the next tick is coming too... Perhaps, if it failed, then just wait for the next trade... Don't forget, there is always the next chance to make profits!
__________________
** Whatever the mind can conceive and believe, it can achieve.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-26-2006, 04:44 PM
Kalenzo's Avatar
Senior Member
 
Join Date: Dec 2005
Location: Bydgoszcz - Poland
Posts: 693
Kalenzo is on a distinguished road
Quote:
Originally Posted by Baiwan
I feel the trade will just be abandoned... I am not sure if "looping" helps in this case... But, even you try to loop it... The next question is to loop for how many tries... Don't forget the time is clicking and the next tick is coming too... Perhaps, if it failed, then just wait for the next trade... Don't forget, there is always the next chance to make profits!
It is quite simple - you can acces errors with GetLastError() function, check it's code and make a choice what to do (eg, try to send order again, or mabye call RefreshRates before you send order again), You can also use while loop - so the ea will try to place the order until it will place it on the server, of course you can make maxretries param to avoid metatrader crash.
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................
http://www.fxservice.eu/
........................................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-01-2006, 05:11 AM
Baiwan's Avatar
Junior Member
 
Join Date: Nov 2006
Location: Singapore
Posts: 9
Baiwan is on a distinguished road
Quote:
Originally Posted by Kalenzo
It is quite simple - you can acces errors with GetLastError() function, check it's code and make a choice what to do (eg, try to send order again, or mabye call RefreshRates before you send order again), You can also use while loop - so the ea will try to place the order until it will place it on the server, of course you can make maxretries param to avoid metatrader crash.
Brilliant!
__________________
** Whatever the mind can conceive and believe, it can achieve.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-21-2008, 02:34 PM
Senior Member
 
Join Date: Oct 2005
Posts: 130
mezarashii is on a distinguished road
Help critical error: mt4 keeps crashing

I have been running every demo I have in MT4 and they are all crashing. What is this error and what do I need to do to prevent it?


There has been a critical error
Time : 2008.02.21 22:31
Program : Client Terminal
Version : 4.00 (build: 211, 15 Oct 2007)
Owner : AleccohFx (AleccohFx)
OS : Windows XP Professional 5.1 Service Pack 2 (Build 2600)
Processors : 2, type 586, level 15
Memory : 1039532/595384 kb
Exception : C0000005
Address : 004614F7
Access Type : read
Access Addr : B27FCE51

Registers : EAX=0275F818 CS=001b EIP=004614F7 EFLGS=00010206
: EBX=00000000 SS=0023 ESP=00125C1C EBP=00125C54
: ECX=B27FCE51 DS=0023 ESI=0045E27C FS=003b
: EDX=000000CB ES=0023 EDI=0276A774 GS=0000

Stack Trace : 00453B1E 00000000 00000000 00000000
: 00000000 00000000 00000000 00000000
: 00000000 00000000 00000000 00000000
: 00000000 00000000 00000000 00000000
Modules :
1 : 00400000 007D3000 F:\Program Files\AleccohFX\terminal.exe
2 : 20000000 002C5000 C:\WINDOWS\system32\xpsp2res.dll
3 : 5AD70000 00038000 C:\WINDOWS\system32\UxTheme.dll
4 : 5B860000 00055000 C:\WINDOWS\system32\NETAPI32.dll
5 : 5FD00000 0000D000 C:\WINDOWS\system32\MFC42LOC.DLL
6 : 629C0000 00009000 C:\WINDOWS\system32\LPK.DLL
7 : 6F000000 00063000 C:\WINDOWS\SYSTEM32\SYSFER.DLL
8 : 71AA0000 00008000 C:\WINDOWS\system32\WS2HELP.dll
9 : 71AB0000 00017000 C:\WINDOWS\system32\WS2_32.dll
10 : 73DD0000 000FE000 C:\WINDOWS\system32\MFC42.DLL
11 : 74720000 0004C000 C:\WINDOWS\system32\MSCTF.dll
12 : 74D90000 0006B000 C:\WINDOWS\system32\USP10.dll
13 : 755C0000 0002E000 C:\WINDOWS\system32\msctfime.ime
14 : 76380000 00005000 C:\WINDOWS\system32\MSIMG32.dll
15 : 76390000 0001D000 C:\WINDOWS\system32\IMM32.DLL
16 : 763B0000 00049000 C:\WINDOWS\system32\comdlg32.dll
17 : 76B40000 0002D000 C:\WINDOWS\system32\WINMM.dll
18 : 77120000 0008C000 C:\WINDOWS\system32\OLEAUT32.dll
19 : 773D0000 00103000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
20 : 774E0000 0013D000 C:\WINDOWS\system32\ole32.dll
21 : 77C10000 00058000 C:\WINDOWS\system32\msvcrt.dll
22 : 77DD0000 0009B000 C:\WINDOWS\system32\ADVAPI32.dll
23 : 77E70000 00091000 C:\WINDOWS\system32\RPCRT4.dll
24 : 77F10000 00047000 C:\WINDOWS\system32\GDI32.dll
25 : 77F60000 00076000 C:\WINDOWS\system32\SHLWAPI.dll
26 : 7C800000 000F5000 C:\WINDOWS\system32\kernel32.dll
27 : 7C900000 000B0000 C:\WINDOWS\system32\ntdll.dll
28 : 7C9C0000 00816000 C:\WINDOWS\system32\SHELL32.dll
29 : 7E410000 00091000 C:\WINDOWS\system32\USER32.DLL

Call stack :
0045E200:32F7 [004614F7] ?ExecuteStaticAsm@CExpertInterior
00453980:019E [00453B1E] ?InitFunctionInt@CExpertInterior
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-21-2008, 03:28 PM
Linuxser's Avatar
Moderator
 
Join Date: May 2006
Location: Helliconia (Winter)
Posts: 2,418
Blog Entries: 2
Linuxser has disabled reputation
Quote:
Originally Posted by mezarashii View Post
I have been running every demo I have in MT4 and they are all crashing. What is this error and what do I need to do to prevent it?
You have a memory problem here.

Have you installed something estrange (software) lately?

I´m asking because I see the UxTheme.dll within the dll with troubles.

Try to restore your windows with fsc and the run some update.

It could be a memory module but we could see about this later.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-22-2008, 02:05 AM
Senior Member
 
Join Date: Oct 2005
Posts: 130
mezarashii is on a distinguished road
I see the dll now. Its a skin for creating an ubuntu theme. How do you reccomend wiping its path? Can I just delete that dll or will it leave traces everywhere and cause more problems?

Last edited by mezarashii; 02-22-2008 at 02:17 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-22-2008, 02:22 AM
Fulltime247's Avatar
Member
 
Join Date: Nov 2007
Posts: 44
Fulltime247 is on a distinguished road
i loop 5 times with 200 millisecond sleep(). you dont want to catch the price too far away from where you wanted it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-22-2008, 02:47 AM
Linuxser's Avatar
Moderator
 
Join Date: May 2006
Location: Helliconia (Winter)
Posts: 2,418
Blog Entries: 2
Linuxser has disabled reputation
Quote:
Originally Posted by mezarashii View Post
I see the dll now. Its a skin for creating an ubuntu theme. How do you reccomend wiping its path? Can I just delete that dll or will it leave traces everywhere and cause more problems?
I've see you edited our post.

First, eBoostr, I ´d never tested it but prefer to say memory tweaks like this one needs to come from Microsoft.
It´s not like the defragmenter or the firewall that has been made by a third party company.

Vista have this feature by default, maybe you should need to wait SP3 coming in a few months.

About UxTheme.dll, if you have installed some theme that does not come with XP, tUxTheme.dll needs to be patched to allow that.
I didn´t have good results by doing this until I decided to spend a full week learning about this.
Some themes works pretty well but others could cause problems.

To fix the problem te better way is just run full FSC and voila. A new system born.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-22-2008, 04:23 AM
Senior Member
 
Join Date: Feb 2006
Location: New Zealand
Posts: 249
Craig is on a distinguished road
I find the best way to handle these types of errors is to intrinsically code the retry into the EA logic, by this I mean instead of looping around a million times just check the number of open trades on the next tick (call to start), if the trade did not process for some reason there will be no open trades and it's time to try again. If you have trade signals which only last one tick, your probably going to have other problems.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Out of Memory Errors with ZUP 58 pipdaddy Harmonic trading 2 05-25-2007 02:53 PM
To trade or not to trade Indicators? yaniv_av Indicators - Metatrader 4 1 03-27-2007 01:01 PM
recalling functional errors Eaglehawk Expert Advisors - Metatrader 4 4 11-08-2006 07:52 PM
TSD Errors jdun Metatrader 3 4 11-01-2005 07:44 PM


All times are GMT. The time now is 06:48 PM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.