2 MA Crossing
This professional-grade solution for MetaTrader 4 helps traders achieve greater efficiency in their daily workflow. 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 2 MA Crossing
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
We will start creating this EA by defining the input variables.
followed by defining global variables. variables with this global scope will be known or accessible to all functions.
When EA is executed, the first function that is executed is OnInit (). So that we often use this function to validate and initialize global variables that will be used.
When the market price moves (tick), the OnTick () function will be called and execute all instructions / functions contained in this OnTick () function block.
Inside the OnTick () function will call various other functions.
Starting to call the checkMinEquity () function to control the adequacy of trading equity. If the equity funds are sufficient (exceeding the minimum equity), it will be followed by a signal variable declaration and followed by a call to the NewCandle () function which functions to inform when a new candle is formed.
The getSignal () function will read the values on both moving average indicators and return signal information whether an upward or downward cross occurs as a signal for a buy / sell signal.
Based on this signal information, it will be forwarded to the transaction () function to set open buy or sell positions.
And it will be continued by calling the setTPSL () function which functions to set the take profit and stop loss prices.If equity does not meet the minimum equity requirement, an alert will be displayed and this EA will be terminated.
Function to setTPSL()
If you are looking for an App to support your trading, please download our SignalForex app in the play store