Delay Script

 

Is there a script or  settings in metatrader once i put a buy or sell order, the order will execute for example 30 sec or 1 min later?

I am looking for a way to delay my order by a set amount of seconds 

 
You can't do it without coding.
 
Drazen Penic:
You can't do it without coding.
So a coded script can be used?
 

Yes, it can be done in two ways - using sleep function, where script starts and waits for given period, or using timer functionality where you can set time when will order be executed.

Sleep can be used in scripts, but timer needs expert advisor.

 

You should be aware that you can't be sure if order will be opened at exact time - there is network latency and brokers' server latency. I observed order opening times from half a second to two seconds in "normal conditions".  

 
Drazen Penic:

Yes, it can be done in two ways - using sleep function, where script starts and waits for given period, or using timer functionality where you can set time when will order be executed.

Sleep can be used in scripts, but timer needs expert advisor.

 

You should be aware that you can't be sure if order will be opened at exact time - there is network latency and brokers' server latency. I observed order opening times from half a second to two seconds in "normal conditions".  

Thanx for the reply

Where can i download the sleep script ? i cant find it in the codebase

 

I am not sure there is such a script in the codebase.

Attached is one rudimentary script I wrote.

You can select buy/sell, set lot size and delay in seconds.

Drag & drop on the chart and it will open order with delay after you click button. 

Files:
DelayOpen.mq4  2 kb
 
Drazen Penic:

I am not sure there is such a script in the codebase.

Attached is one rudimentary script I wrote.

You can select buy/sell, set lot size and delay in seconds.

Drag & drop on the chart and it will open order with delay after you click button. 

Wouldn't this conflict with an EA already attached on the chart?
 

This is a script.

You can run it even if you have EA or indicators on the chart.

 
Drazen Penic:

This is a script.

You can run it even if you have EA or indicators on the chart.

This script does not work.

 Attached to chart, when i click buy order its executed instantly. 

 

You can't interfere with built in controls. If you click BUY on Metatrader button it will execute immediately and there is no any way to prevent this.

Script, I sent you, opens order delayed by given number of seconds.  

If you want to have delay you must use script or expert advisor that will delay order opening some time after you run it.

 

And, as I mentioned in above post - script is rudimentary, just an illustration of how it can be done.

Reason: