Magic Number Forex – The Forex Expert Advisor

Magic number Forex – the tool to follow algorithmic trading results

Magic number Forex is the topic in this article, and here I will talk about the Expert Advisors themselves. These are automated strategies. So let say you have a normal strategy, a manual strategy that you learn from somewhere, you saw some video, you read it in the book and you are applying it daily. But with the time, you will notice that you are missing so many entries. All right?

Because obviously, we are human beings. We cannot sit in front of the computer for 24 hours from Monday to Friday. And this where the Expert Advisors with their Magic number Forex can be beneficial because they trade all the time.

Let’s say you are a trader, and you have a trading strategy. You would be able to follow it 8-10 hours per day or a maximum of 12 hours. The other 12 hours, you are missing many trades. What if you have 2-3 strategies, would you be able to follow them simultaneously?

The solution is to trade Forex Expert Advisor

Many traders think that algorithmic trading and the Forex Expert Advisor is something tough and complicated. It was before, and it not anymore. There are strategy builders. Nowadays, everything is automated and secure. You do not need to be a developer to build your website. You do not need to be a developer to develop your Forex Expert Advisor.

Simply these are codes that we attach to the Meta Trader platform to trade automatically.

The Forex Expert Advisors are structured in a file, and we attach this file to the Meta Trader platform.

If you have experience in buying Forex Expert Advisors from the market place, you would know that they normally give you the ready ex4 or ex5 files. They do not give you the code. In all of our courses, we give the code and we teach the traders how to compile those into Forex Expert Advisors.

If any of our students is a developer he can add something to improve the code for himself, why not?

Just what I have already shown that they execute the trades automatically, and we don’t need to be in front of the computer. We don’t need to do anything. Once we place the Expert Advisors over the chart, we set the Magic number Forex, and we leave it to do its job. All right?

Now, if you look again on my chart, I will right-click on one of the Expert Advisors, and I will go to modify. This is from where you can see the code of this Expert Advisor, and it opens in the Meta Editor.:

Code of the Forex Expert Advisors.

Now, if I scroll down, you will see that we have long code for each Expert Advisor, and if I go down to the end, you will see it’s about 7000. In this case, it is 6 757 or 56 rows to the end. It’s a huge code. It is much longer than the Expert Advisors we have created with EA Studio.

How are the expert advisors in FSB Pro different?

  • possible to follow on the higher time frames
  • many more options in the settings of the Expert Advisor.
  • possibility to add to the position, to reduce from the position, to reverse the position
  • custom indicators are available to download
  • to add custom indicator you would need to have it in C++

And if I go to the top, you will see where we have the indicators parameters, and I can change the Stop Loss and Take Profit after that.

In the code as well, you can change the Magic number Forex.

So what is the Magic number Forex?

This is the tool that we set in the Expert Advisors to follow the results after their trading. The Magic number Forex is used when we connect our trading account with the statistical website to track the results. Also, when we have many Expert Advisors trading in one account, and we look at the History, we use the Magic Number Forex to recognize which is the EA that opened the trade.

I will need to click on Compile, and it will change the Expert Advisor inside the Meta Trader. And below, you can see I have the other indicators from this Expert Advisor, and pretty much this is what I know from the Expert Advisors code.

I’m not a developer, and I don’t know what all these things mean. Of course, with the years, I have learned some things, but I’m not touching anything of the code, and I don’t suggest you do that. If you are not an advanced developer. And all of that came with the 

FSB Pro that I have used to create these Expert Advisors.

Keep in mind that with FSB Pro we can create not only Forex Expert Advisors but for commodities, stocks, indexes. It depends on what Historical data you will import in the program. Here is a video where I explain more about the data, and how to import it:

So I didn’t hire any developer to do that for me. It would be very time consuming, and it will cost me a lot of money.

I have been through this process already where I was hiring developers to program or to automate the strategy. For me, it was time-consuming. It was costly. These guys take a lot of money for that, and it’s tough because they need to have an idea about Forex or Trading. And it was taking nearly one month to develop the whole Expert Advisor.

Obviously, after that, there were mistakes.

I had to give them the Expert Advisor back. So I was testing it then giving it back. And then again and again, and sometimes it was taking a couple of months for one single Expert Advisor. Very expensive, time-consuming, and this is a hard thing that I’ve been through. Even they forget to place the Magic number Forex, or they had no idea about it, so I had to explain basic concepts…

However, when the Strategy Builders came up, it is so much easier for me, and for many traders the algorithmic trading became much more easier. And we do it much faster. We have all the indicators there, Sl, TP, Break even, Magic number Forex, and all we needed.

So what you saw above is from where we have access to the code.

You can compile it, and this is the very same thing just what I have shown to you if you right-click over Expert Advisors and click on Refresh. Still, this forces Meta Trader to compile the Expert Advisors.

The 2nd thing I wanted to show you:

How you can change any of the parameters from the trading chart, and it’s better. So once you have any of the Expert Advisors, placed over the Meta Trader. You can right-click, go to Expert Advisors and go to Properties:

expert advisors set up
The tab from where you can change the Magic number Forex.

This is from where you have the inputs, and this is from where you can change any of the inputs much faster, much more comfortable.

No need to go into the code!

What can we set in the Expert Advisors?

  • The amount for a new position
  • How many lots you want to trade with
  • What is the maximum position amount
  • Magic number Forex

As I said already, you can add to the position on the next same entry signal. Below is the amount to add, and then you have amount to close on reduction. But for these strategies, I have selected to reverse. So when you have an opposite signal, they will close the existing trade, and they will reverse the position. Below you have Stop Loss, Take Profit, Break Even.

We don’t have it for this strategy, and then we have below the parameters for the indicators and the magic number Forex. You can write as well a log file, and if you click on True, you will be able to write a log file if you want for your Expert Advisors. And pretty much this is about the Expert Advisors. Nothing complicated.

How is the Magic number Forex useful?

  • Follows the performance of the Expert Advisor
  • the computer is discounted from the Internet
  • the platform is restarted it will detect the opened trades
  •  connection to the server is lost

And you reopen it after that, and you have already begun trade, just as I have, the Expert Advisors will recognize the opened trade with the magic number Forex. OK?

So they will not open a new trade. So if I restart my computer and I reopen the Meta Trader, these two Expert Advisors will recognize the open trades. They will not open another trade until these two are opened. So this is very, very useful because it happens that sometimes we disconnect from the Internet, or we disconnect from the server of the broker. All right?

And the last thing I wanted to mention

If I go one more time to the place where I have placed the Expert Advisors. This is in Open Data Folder, and I will go to MQL4, and I will go to Experts, and as you can see we have two types of files. One is the EX4 File, and the other one is the MQL4 Source File. This is what you will receive from me in the course – the source files:

The path to the files
The source files of the Expert Advisors.

This is from where you can access the code of the Expert Advisor and the Magic number Forex. Now when we click Expert Advisors, right mouse, and we go to Refresh, we compile the Expert Advisors. And this is how we got to the EX4 File.

So these are the compiled Expert Advisors. Most of the time, when you buy an Expert Advisor from the market, you will receive only these EX4 Files. So they don’t provide you the MQL4 Source File, but I prefer to offer it. If any of you, as the developer, wants to test something, wants to change something, want to learn from the code.

You’re very welcome to do it as well.

As I said, personally, I don’t touch anything in the code.

These are the things about the Expert Advisors and Magic number Forex. And below you have this tab that says Experts, and from here you can see kind of information what we had with the trade when it opened. We have the number of the order. What it did, at what price, Stop Loss, if there is one and the Magic number Forex:

Magic number Forex
Experts tab

So there is some information here about the actions with the Expert Advisors. Not a bad idea to have a look at those sometimes and as well in the journal. So you will see if there are any mistakes with the Expert Advisors. All right?

As a conclusion we can say:

Is it better to trade with Expert Advisors or manually?

  • trading with Expert Advisors removed the emotions which are part of manual trading
  • manual trading is suitable for experienced traders with massive capital in the account
  • with Expert Advisors, we can trade many strategies simultaneously in one trading account (up to 99EAs)
  • trading manually the trader can follow the market 8-10 hours, maximum 12 hours
  • the Expert Advisors follow the market 24 hours from Monday to Friday – more volume of trading
  • the Forex Magic number allows the trader to have a precise statistic for the trading

When trading manually, it is hard for the trader to decide if a strategy is profitable or not for many reasons. First, he can not take all trades during the day. Second, the entries are not precise as with algorithmic trading, and third, the trader always modifies the system according to their feelings at the moment and their expectations.

It is a personal choice if you want to trade manually or with Expert Advisors, but we have noticed that more traders lose when trading manually. Just because of the emotions. They cause the traders to lose money.

So this is about the Forex Magic numbers with the Expert Advisors.

Let me know if you have any questions, and write in OUR FORUM.

For more trading courses, please visit our website.

Thank you for reading.

What is the magic number in Forex?

This is a number in every Expert Advisor which displays as Comment in MetaTrader 4. It helps the algo traders to follow the results of Expert Advisors, especially when trading with more than 1 EA. 

How does Forex Expert Advisor work?

The Forex Expert Advisors are automated strategies that are coded normally in MQL and traded in MetaTrader 4 or MetaTrader 5. They open and close trades according to the trading rules inside the code.

How to set the Magic Numer in EA?

When you drag any Expert Advisor over the trading chart, you will see a small menu. Click on Inputs and you will find the field to enter the Magic number at the end.

Why Magic numbers are useful?

When trading many Forex Expert Advisors in one trading account it is hard to follow the trading results. There are many statistical websites that use magic numbers to identify orders and strategies.