EA Moving Average
This tool for MetaTrader 5 is specifically engineered to streamline your trading operations. This Expert Advisor serves as automated trading software. It is utilized to monitor financial markets and execute trades based on predefined algorithmic rules, enabling precise position management without the need for constant manual oversight.
How to Setup and Use EA Moving Average
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
Description & Settings
Idea by
: .
MQL5 code by
: .
The EA is based on \MQL5\Experts\Examples\Moving Average\Moving Average.mq5 from standard delivery. What's new or changed:
For each of the four signals (
Buy Open
,
Buy Close
,
Sell Open
, and
Sell Close
), there is now their own indicator Moving Average, for which parameters may be set, such as:
period
(averaging period),
shift
(horizontal shift of the indicator),
method
(averaging method), and
price
(type of prices, based on which the indicator is calculated);
Flags
Use Buy positions
and
Use Sell positions
- enable opening BUY and SELL positions, respectively;
Flag
Consider Price Last Out
- consider the price of the last closed trade. If the value is "true", then the new BUY position will be opened at a price equal to or lower than the price of the last transaction, while the new SELL position will be opened at a price equal to or higher than the price of the last closed transaction.
Price of the last closed position is monitored on OnTradeTransaction. The EA keeps at most one position in the market, so it can be used on both netting and hedging accounts.
Inputs
Maximum Risk in percentage
- highest risk, in percents;
Descrease factor
- decrease factor, in case of losing trades in trading history;
ххх: period
- averaging period (individual for each indicator);
ххх:
shift
- horizontal shift (individual for each indicator);
ххх: method
- averaging method (individual for each indicator);
ххх: price
- price, at which the indicator is calculated (individual for each indicator);
Use Buy positions
- a flag enabling opening BUY positions;
Use Sell positions
- a flag enabling opening SELL positions;
Consider Price Last Out
- a flag to consider the price of the last closed trade;
magic number
- unique identifier for the EA.
Default parameters, EURUSD M15, period from 2018.01.01 to 2018.05.03.
Recommendations on optimizing on M15
(Genetic) optimization can be performed in the "1 minute OHLC" tick generation mode. To start with, mark the parameters of
period
(Start 12, Step 1, Stop 30) and
shift
(Start 0, Step 1, Stop 6).
Upon genetic optimization, go to the "Every tick" mode or the "Every tick based on real ticks" mode and run a single test for the pass selected.