Script OpenAtTime
The description of actions:
The script to open an order at the specified time. Also, in a consequence, it can close this order at the specified time. If the order was closed or deleted then the script automatically to finish a work. Should be attached to the chart of currency pair at that will be opened order.
Assignment:
The script allows to automate trade. It is useful to those, who uses opening (or installation) orders at certain time. Start a script, set parameters of the order and you should not watch time any more.
Parameters:
OpenAtTime = the time when the order should be opened (or placed); here should be a string such as "hh:mm".
The following of seven parameters define the opened order.
Order_BuyDirection = type of the order; value true - buy, value false - sell.
Order_StopLoss = the level stop-loss of the order (in pips). If this parameter is equal 0 then position will opened without a level stop-loss.
Order_TakeProfit = the level take-profit of the order (in pips). If this parameter is equal 0 then position will opened without a level take-profit.
Order_Lots = the size of lots for order.
Order_Pending = type of execution of the order; value false - to open a position at the current price, value true - to open the pending order.
PendingOrder_OpenPrice = the open price of the pending order. This parameter is used only if parameter Order_Pending = true.
PendingOrder_Expiration = date of the expiration for pending order. This parameter is used only if parameter Order_Pending = true.
Slippage = slippage (in pips).
MagicNumber = magic number for order.
ArrowColor = color for arrow on chart at open price of order.
PlaySoundAtOpen = enable/disable play sound file at open order.
PlaySoundAtOpen_FileName = the name of sound file that will played at open order. This parameter is used only if parameter PlaySoundAtOpen = true.
HiddenLevels = enable/disable hidden levels s/l and t/p.
UseCloseAtTime = enable/disable an option "closing order at the specified time"; value true - the order will be close at the specified time, false - the option is not used.
CloseAtTime = the time when the order should be closed (or deleted); here should be a string such as "hh:mm". This parameter is used only if parameter UseCloseAtTime = true.
PlaySoundAtClose = enable/disable play sound file at close order.
PlaySoundAtClose_FileName = the name of sound file that will played at close order. This parameter is used only if parameter PlaySoundAtClose = true.
UseLocalTime = define timezone; true - use a local time (time of "Windows" at PC of trader), false - use time of the Terminal (time of the broker).
Delay = frequency of a check up current time. It is set in milliseconds, for example value 5000 means periodicity of 5 seconds. It is necessary to remember, that too often periodicity can brake the terminal.
The status: Free-of-charge, it is possible to download the full version.
Platform: MetaTrader 4.

See also these scripts:

- at the specified time, closes open position or deletes pending order.

- limit duration of an open position.

- the system of two orders: "one opens other".
Frequently asked questions:
How I can run a script ?
How I can determine that the script works ?
Why the script does not trade ?
|