MQL4 TUTORIAL BASICS – 01 HOW TO CODE A MACD EXPERT ADVISOR

Published on November 28, 2022

Popular guide related to Currency Trading Tutorial, Forex Checklist, and MACD Zero Crossover, MQL4 TUTORIAL BASICS – 01 HOW TO CODE A MACD EXPERT ADVISOR.

With MQL4 for Metatrader4 we create an automated Expert Advisor that is going to do automated trading with MACD Signals – and it all can be coded in under 10 minutes…

In this video, we are going to code an Expert Advisor that is able to calculate the MACD Oscillator, it does not only generate signals it actually trades them, so let’s find out how to do that with MQL4.

To get started please click on the little symbol here or press F4, now you should see the Metaeditor window and here you want to click on: “File/ New/ Expert Advisor (template)” from template, “Continue”, I will call this file: “SimpleMacDEA”, click on “Continue”, “Continue” and “Finish”.

Now you can remove everything above the “OnTick” function and let’s also delete the two comment lines here.

We start by creating a signal that will be a string variable, right now we don’t assign any value here because we need to calculate that later on and to do that we use the included “iMACD” function that comes with MQL4, it uses a few parameters so let’s go through the parameters one by one.

The first one is for the current symbol; “NULL” is a placeholder, it will actually calculate the current symbol, you could also use “_Symbol“ and for the time frame we could use “_Period”, I would like to calculate the values based on the close price, “MODE_MAIN” is used to calculate the base Indicator line, the last value here is a shift value that would be used to calculate the value for a different candle but in our case we use 0 (zero) because we want to calculate the value for the current candle.

So what’s left are these 3 values here; let’s open a new chart window, click on: “Insert/ Indicators/ Oscillators/ MACD”, now you should see the values: fast EMA 12, slow EMA 26, MACD SMA 9, apply to close, that’s exactly what we are using here, so let’s click on “OK” and the MACD should appear in the lower part of your chart. Let’s right-click select “Templates/ Save Template” and save it as “tester.tpl” because this is the template that is going to be used in the backtest but before we can do that we need to finish our Expert Advisor here.

If the current value for the MACD is greater than 0 (zero) – zero is this line here – so if the signal line is above the zero line we would expect it to return to the zero line, that would be a sell signal so we assign the word: “sell” to our signal.

Otherwise if the MACD is below the zero line that would be a buy signal so we assign the word: “buy” to our signal, and if the signal equals buy and “OrdersTotal” equals zero that would mean we have no open orders we use the “OrderSend” command to buy 10 micro lot.

Otherwise, if the signal equals sell and we have no open orders we use “OrderSend” to sell 10 micro lot.

Finally, we use “Comment” to output the text: “The current signal is:” and the signal that we have calculated on the chart.

Let’s click on the “Compile” button here or press F7, you shouldn’t get any errors here but if it was too fast for you you might want to watch the other videos in this basic series first or maybe even the premium course is interesting for you.

If everything is okay you can click on the little button here or press F4 to go back to Metatrader and in Metatrader you want to click on: “View/ Strategy Tester” or press CTRL and R, please pick the new file: “SimpleMacDEA.ex4”, enable the visual mode here and start a test.

Here we are! Our Expert Advisor is actually working we also have open positions and in this little video you have learned how to automate the MACD using MQL4 to open buy and sell trades on your chart and you have coded it yourself with a few lines of MQL4 code.

MACD Zero Crossover

MACD Zero Crossover, MQL4 TUTORIAL BASICS – 01 HOW TO CODE A MACD EXPERT ADVISOR.

The Day You Begin To Trade Forex Without Indicators

One is The RSI Paint Indicator which is an RSI that locates divergence and reversal signals.
In the previous currency or forex (FOREX) traders relied on other individuals to assist them out.

MQL4 TUTORIAL BASICS – 01 HOW TO CODE A MACD EXPERT ADVISOR, Get popular explained videos about MACD Zero Crossover.

3 Things To Assist You Discover Momentum In Trading Forex To Increase Profit

Well, I can tell you that there absolutely are big gains to be made in forex, that is particular. An unprepared customer may be forced to make rushed choices they later on regret. And, when you think, your emotions have a field day.

When you find out about forex trading there are lots of technical tools to master, however one of the most basic to use is the pivot point. Pivot points deal with support and resistance levels to provide you an indication of entry and exit points for your forex trades.

Macd Trading Divergences are most reputable when they cross the absolutely no line in between the peak and the failure peak. Such as the two in June and August in the chart.

However there is one indication, one core piece of details, that is always as much as date and constantly appropriate. That piece of information, is cost. And particularly the closing cost at the end of every Macd Trading signals day. All the news, details, economic and basic information offered, is shown because closing rate.

In the same manner, when the MACD Pie chart stops decreasing and starts increasing, go long. Location the initial stop loss at the immediate small high formed in the cost action. Change it with a routing stop when rates continue to rise.

4) Trading Set Up. When do you prepare to trade? When will you accept brand-new entries or exits? Is there a point when all trades will be closed? Particular times of day are better than others depending upon the Macd Trading Crossover system you are planning. A schedule likewise helps you manage your life and put your top priorities in appropriate order.

As a trader for over 25 years now, I have used many methods towards market timing. The outcome of all has actually led me, numerous years earlier, to follow the course of market cycles which are based upon natural laws. This decision has settled and continues to do so in my trading today.

Why I say these two indications are the very best for you. Let me discuss. Trending conditions in the market exist not more than 30-40% of the time. Rest of the time, the marketplace is range bound or what you call combining. After a great trending move, the market will relocate a combination phase.

In our trading group, some of our traders have actually been utilizing this technique very successfully. This is a longer term trade, generally lasting a week or 2, and takes persistence to establish, patience while in the trade, and knowing when to leave the trade. The charts are there to assist you. Pleased trading.

Rather of predicting a buy point, it tells you that the current up-trend is coming to an end. Now this is the most crucial stage and my trading decision lies here. This is generally where you should leave the trade.

If you are searching exclusive entertaining comparisons related to MACD Zero Crossover, and Forex Online, Price Action Forex, Marketing Mistakes you are requested to signup our subscribers database for free.

Enjoyed this video?
"No Thanks. Please Close This Box!"