• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 1:26am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:26am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

MT4- Is it possible to shift a chart automatically so current price is in the center 4 replies

Transferring live data from MT4 to AmiBroker automatically 8 replies

Software which opens trades automatically on MT4? 1 reply

Fibonacci FAN automatically drawn in MT4? 4 replies

How to automatically back up my MT4 files? 17 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: How to restart a MT4 program automatically?
Exit Attachments
Tags: How to restart a MT4 program automatically?
Cancel

How to restart a MT4 program automatically?

  • Post #1
  • Quote
  • First Post: Edited Dec 28, 2010 8:35pm Jun 6, 2010 2:29pm | Edited Dec 28, 2010 8:35pm
  •  InvGroup
  • | Commercial Member | Joined Jun 2009 | 21 Posts

Dear forum members.


Anybody out here knows why a MT4 OrderSend command doesn't fire with a Stop Loss value other than zero?

Just because the stop loss value is not equal to zero, MT4 would not accept the following command:

xx=OrderSend(SymbolEA1,OP_BUY,1,Ask,3,Ask-25*Point,Ask+25*Point,"My order #2",16384,0,Green);

Any help would be appreciated.


Thank you.
P&P

  • Post #2
  • Quote
  • Jun 6, 2010 2:49pm Jun 6, 2010 2:49pm
  •  hayseed
  • Joined Nov 2006 | Status: Member | 3,647 Posts
once the internet connection to the trade server is reistablished, it should reconnect on it's own.... or at least mine does.....


it's kinda automatic....h
to trade and code, keep both simple... no call to impress....h
 
 
  • Post #3
  • Quote
  • Edited 4:18pm Jun 6, 2010 4:03pm | Edited 4:18pm
  •  fxtests
  • | Joined Jun 2010 | Status: Junior Member | 4 Posts
The easy way:
1. create a file run.bat in your MT4 directory
2. Add following lines in run.bat :
:START
terminal.exe
goto START
3. In your .mq4 add following lines:

#import "kernel32.dll"
int WinExec(string NameEx, int dwFlags);
#import

and in start():

if(!IsConnected())
WinExec("taskkill /IM terminal.exe",0);

If MT4 is not connected there are no ticks so a while should be used to check the connection.

4. start MT4 platform with run.bat

An example is attached.
Attached File(s)
File Type: mq4 test.mq4   2 KB | 881 downloads
 
 
  • Post #4
  • Quote
  • Jun 6, 2010 4:03pm Jun 6, 2010 4:03pm
  •  InvGroup
  • | Commercial Member | Joined Jun 2009 | 21 Posts
Quoting hayseed
Disliked
once the internet connection to the trade server is reistablished, it should reconnect on it's own.... or at least mine does.....


it's kinda automatic....h
Ignored

Hi Hayseed.

Thank you for your answer. We will test that and see how it works.

We appreciate your help.

Thx.
P&P
 
 
  • Post #5
  • Quote
  • Jun 6, 2010 4:23pm Jun 6, 2010 4:23pm
  •  eagle4x
  • | Joined Sep 2005 | Status: pip my ride | 507 Posts
Try these resources:
http://www.mt4i.com/autorestart.aspx

http://forum.mql4.com/16990
 
 
  • Post #6
  • Quote
  • Jun 7, 2010 7:28am Jun 7, 2010 7:28am
  •  fxtests
  • | Joined Jun 2010 | Status: Junior Member | 4 Posts
Quoting fxtests
Disliked
The easy way:
1. create a file run.bat in your MT4 directory
2. Add following lines in run.bat...
Ignored

You can run also multiple MT4 instances if you rename the terminal.exe with
terminal1.exe for second instance. Don't forget to change the name in mq4 file and in run.bat.
 
 
  • Post #7
  • Quote
  • Jun 7, 2010 8:24am Jun 7, 2010 8:24am
  •  moetzger
  • | Joined Sep 2009 | Status: Member | 120 Posts
you could use autohotkey to autorelogin every 3 hours or so. when doing regularly relogins, the case of "cant connect whatever you do - only a restart helps" is more unlikey to happen.
works wonders here
Patience is key.
 
 
  • Post #8
  • Quote
  • Jun 11, 2010 8:57am Jun 11, 2010 8:57am
  •  InvGroup
  • | Commercial Member | Joined Jun 2009 | 21 Posts
Quoting eagle4x
Disliked
Try these resources:
http://www.mt4i.com/autorestart.aspx

http://forum.mql4.com/16990
Ignored
Hi Eagle4x

Thank you very much. We appreciate.

P&P
 
 
  • Post #9
  • Quote
  • Jun 11, 2010 8:58am Jun 11, 2010 8:58am
  •  InvGroup
  • | Commercial Member | Joined Jun 2009 | 21 Posts
Quoting moetzger
Disliked
you could use autohotkey to autorelogin every 3 hours or so. when doing regularly relogins, the case of "cant connect whatever you do - only a restart helps" is more unlikey to happen.
works wonders here
Ignored

Hi Moetzger.

Thank you for your answer to our question. We appreciate.

P&P
 
 
  • Post #10
  • Quote
  • Last Post: Jun 11, 2010 9:00am Jun 11, 2010 9:00am
  •  InvGroup
  • | Commercial Member | Joined Jun 2009 | 21 Posts
Quoting fxtests
Disliked
You can run also multiple MT4 instances if you rename the terminal.exe with
terminal1.exe for second instance. Don't forget to change the name in mq4 file and in run.bat.
Ignored

Hi FxTests.

Thank you very much for your help. We appreciate.

P&P
 
 
  • Platform Tech
  • /
  • How to restart a MT4 program automatically?
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023