MA Cross Studies Expert Advisor For MT4
WE IMPROVED THIS EXPERT ADVISOR FOR YOU!!!
PLEASE NOTE: This expert advisor was publicly available for free usage on other websites and is not programmed by us. We explain the functionality and possible improvements of the EA. Furthermore, we are convinced that fully automatic Expert Advisors will fail in the long run. On the other hand, our semi-automatic approach with detecting the best setups and then activating our Expert Advisors (e.g. V-Power EA, EdgeZone EA) produced many successful traders and some of them even got prop traders at prop trading firms. Therefore, we added a similar semi-automatic trading feature (to allow only buy or only sell trades) to the free Expert Advisors. You can download the modified version here and enjoy!
Table Of Contents:
- MA Cross Studies Expert Advisor For MT4
- The MA Cross Studies Expert Advisor For MT4 – Entry Criteria
- The MA Cross Studies Expert Advisor For MT4 – Exit Criteria
- The MA Cross Studies Expert Advisor For MT4 – Room for Improvement
The MA Cross Studies Expert Advisor For MT4 employs a pair of moving averages to define a trade entry. This technical indicator is the primary tool for determining the trade direction and timing, but the expert advisor makes use of other factors when deciding to enter a trade. These factors are not presented here as the trading algorithm just seems too deep to be understood even by advanced programmers, much less by novice coders.
Despite this sophistication, the expert advisor failed to produce profits when run in the strategy tester for five months of test data and using the default settings. Since the external variables are as vast as the code functions, finding the best or ideal combination of settings might be a challenge for users. It is possible that the current settings are not optimal for the symbol and period used in testing. Still, the overall metrics in testing do not look bad at all.
The MA Cross Studies Expert Advisor For MT4 – Entry Criteria

The MA Cross Studies Expert Advisor performs a lot of calculations the first time the program is attached to a symbol and on every tick. However, it executes trades only when a new candle has formed on the current symbol. The robot also displays information on the chart that the user can use to check and confirm which settings are enabled in Inputs and what the current values of parameters are.
As shown in the image above, the user can see the values of the two moving averages, the indicated lot size for the next trade, the account balance and equity, current running profit for the trading account, free margin, stop loss and take profit for the next trade, required minimum margin, and the trading schedule.
The following are the most important parameters that the user must understand and set correctly in Inputs. The default values are also shown, along with some explanation.
- Allowed_Trade_Direction = 2 – The value of this variable can be 0, 1 or 2. If the value is 0, only buy trades will be taken. If the value is 1, only sell trades will be executed. If the value is 2, both buy and sell trades will be initiated by the robot, but these trades are not executed simultaneously.
- HedgingAllowed = false – This variable is false by default, meaning trades will not be hedged.
- Hidden_Tp_Sl = false – Since this variable is set to false, trades will have definite stop loss and take profit values. Otherwise, the stop loss and take profit will not be shown, meaning they are not set in place at all but the expert advisor keeps these values in memory for later use.
- Leverage_Per_Position = 0.9 – Since the position size changes as the balance varies, this factor defines how many microlots (0.01) to trade for every 1000 units of the account balance.
- StopLoss_Percent = 0.9 – The stop loss is set at 0.9 percent of the account balance.
- Trailing_StopLoss_Percent = 0 – Since this value is zero by default, trades will not be trailed when they start gaining profit.
- TakeProfit_Percent = 0.6 – The take profit is set at 0.6 percent of the account balance.
- Slippage = 10 – This value, given in points, is the maximum acceptable slippage for trades.
- Minimum_Free_Equity_Percent = 10 – If the free margin goes below this percentage, new trades will not be executed.
- Average_Up = false – If the user wants to add trades when the initial trade moves in his favor, this variable should be set to true.
- Average_Down = false – If the user wants to add trades when the initial trade moves against him, he must set this variable to true.
- Close_All_At_MA_Crossover = false – If this variable is set to true, open positions will be closed when the technical indicator provides an opposite signal.
- MA_Timeframe_Previous = PERIOD_H4 – This is the timeframe where the fast-moving average is applied.
- MA_Timeframe_Current = PERIOD_H4 – This is the timeframe where the slow-moving average is applied.
- MA_Period_Previous_Add = 8 – This number is added to the MA_Period_Current value below to obtain the period for the slow-moving average.
- MA_Period_Current = 4 – The fast-moving average in use in this expert advisor has a period of 4.
- MA_Shift_Previous = 0 – This means that the slow-moving average has zero shift.
- MA_Shift_Current = 0 – This means that the fast-moving average has zero shift.
- MA_Method = MODE_SIMPLE – The method used for the fast- and slow-moving averages is simple.
- MA_Applied_Price = PRICE_CLOSE – The two moving averages are applied to the close price.
- Start_Day = 1 – This number refers to Monday as a day of the week.
- End_Day = 6 – This number refers to Saturday as a day of the week.
- Start_Time = "7:50" – The robot looks for trade entry at this opening time.
- End_Time = "8:10" – The robot stops looking for trade entry at this closing time.
This trading system uses two moving averages as primary indicator for trend and trade direction. The moving averages and their settings, together with an explanation on how a signal is interpreted, are provided below:
- Simple moving averages (4-hour chart, period 4 and 12, simple method, close price) – The expert advisor obtains the values of two moving averages corresponding to the current candle on the active period and symbol. The period of the slow-moving average (period 12) is obtained by adding the period of the fast-moving average (period 4) to the MA_Period_Previous_Add variable (8) in Inputs. A buy or sell signal is generated in this manner. If the slow-moving average is below the fast-moving average, a sell signal is generated. If the slow-moving average is above the fast-moving average, a buy signal is produced. While it appears that the signal is reversed, it is exactly how it is written in the code.
With the default settings, the expert advisor executes one trade at a time with clearly defined take profit and stop loss price levels. The stop loss and take profit percentages defined in Inputs produce a stop loss of 120 pips and a take profit of 80 pips. This relationship of take profit and stop loss results in a risk-reward ratio of 1.5 in favor of risk. As such, this type of trade management requires a high winning percentage to make money. In fact, the win rate should be way more than 50 percent to achieve this.
On the other hand, the lot size of each trade is constant, but it cannot be set by the user in Inputs. The expert advisor computes this value from the stop loss percent defined in Inputs and the current account balance. The position size thus obtained becomes the lot size of all trades taken thereafter. The trade volume does not vary with the change of the account balance.
The MA Cross Studies Expert Advisor For MT4 – Exit Criteria
By default, the MA Cross Studies Expert Advisor does not use stop loss adjustment in trade management, although this function is available. If the user wants to use this function, he can enable it in the expert settings. With the current settings, it means that trades will only be exited by their take profit or stop loss values, and this is noted in the strategy tester Results tab.
The MA Cross Studies Expert Advisor For MT4 – Room for Improvement
The MA Cross Studies Expert Advisor needs further testing to find the combination of settings that will yield positive results. In the testing done using five months of test data, only 18 trades were taken by the robot, and 55 percent of those trades were profitable, which is already satisfactory. The drawdown is also acceptable (4.5 percent). However, the profit factor is wanting (0.84). This means that the default settings might not be enough to generate profits.