AutoTrading Scheduler is a MetaTrader expert advisor that lets you control the status of AutoTrading button in your MetaTrader platform based on a weekly schedule. In addition to enabling and disabling AutoTrading, this EA can also attempt to close all trades when disabled AutoTrading period is reached. The expert advisor is available for both MT4 and MT5.

This scheduler requires DLL imports to work properly. It imports one function from the standard Windows DLL file (user32.dll). Do not forget to allow DLL imports when attaching this expert advisor to a chart.

Interface

The panel controls are pretty straightforward. The Switch button lets you turn the scheduler on and off. The group of radio buttons to the right lets you switch between the local and server time. The status will inform you if DLL's are turned off, if connection is missing, or if AutoTrading is already disabled. The seven entry fields, each for every day of the week, serve to enter time ranges when you want AutoTrading to be enabled. The Set to all empty button will set the value entered for Monday to all other empty days of the week — this can be useful to quickly set the same schedule for each day. Finally, the checkbox at the bottom lets you make the EA to attempt closing all trades before disabling AutoTrading.

AutoTrading Scheduler - Interface

Usage

When Scheduler is off, it will do nothing. You have to turn it on for it to operate.

Changing the time from Local to Server can be useful if you want Scheduler to work based on your broker's trading server time, for example, during daylight saving time switching weeks.

The status can be OK, No autotrading, No connection, or DLLs disabled. The first and the second one don't affect anything — they just inform you. No connection means that the EA won't be able to close any trades before disabling AutoTrading, but it will disable AutoTrading without a problem. DLLs disabled is a real problem because enabling/disabling AutoTrading will be impossible.

The main part of working with the Scheduler is to set a valid weekly schedule. AutoTrading will be enabled during the time periods you set.

The time input fields work with time ranges given in 24-hour format with start and finish time separate with a hyphen. For example, the range 9-17 will be interpreted as "from 9:00 till 17:00" (or "from 9 a.m. till 17 p.m.").

More than one range can be given for the day using comma as a separator. For example, the range 13:30-16:30, 19:30-20:05 will enable AutoTrading during two periods: from 13:30 till 16:30 and from 19:30 till 20:05.

The main objective of AutoTrading Scheduler is to control the status of the AutoTrading button in MetaTrader. However, it can also be used to close the trades before disabling AutoTrading. This is attained by ticking the checkbox at the bottom of the panel. The expert advisor will attempt to close the positions and delete pending orders, but there is no guarantee that it will succeed in doing so. It will not re-try closing the trades because its first priority is to disable AutoTrading and after AutoTrading is disabled, managing trades becomes impossible.

Input parameters

  • Slippage (default = 2) — slippage value given in broker's pips to be used when closing positions.
  • PanelOnTopOfChart (default = true) — if true, the panel will be drawn on foreground, and the chart will be drawn as background. Setting it to false will uncover the chart behind the panel.

Downloads (ver. 1.00, 2020-08-11)

AutoTrading Scheduler is being developed via a dedicated GitHub repository. You are encouraged to actively participate in the improvement of this expert advisor by submitting your own features via pull-requests and by reviewing existing suggestions, changes, fixes, and so on.

AutoTrading Scheduler for MetaTrader 4

AutoTrading Scheduler for MetaTrader 5

To install — unzip and copy the entire AutoTrading Scheduler folder to MQL4/Experts/ or MQL5/Experts/ (if you are on MetaTrader 5) of your terminal's data folder.

Discussion

Do you have any suggestions or questions regarding this expert advisor? You can always discuss AutoTrading Scheduler with other traders and MQL coders in the forum.

© 2005–2020

EarnForex.com

Design — Mart Studio

Forex trading bears intrinsic risks of loss. You must understand that Forex trading, while potentially profitable, can make you lose your money. Never trade with the money that you cannot afford to lose! Trading with leverage can wipe your account even faster.

CFDs are leveraged products and as such loses may be more than the initial invested capital. Trading in CFDs carry a high level of risk thus may not be appropriate for all investors.