How to write an advisor for metatrader 4
The dynamic development of the market and constant computer progress simply forces the trader to keep up with the times. If earlier writing advisors for your trading strategy was considered as a trader’s whim to make his life easier, now it is more of a necessary measure in order to be competitive in a given market.
Yes, precisely competitive, because it was robots that completely flooded the exchange, and if earlier pipsing and scalping strategies were easy to apply manually, now it is quite difficult to remain effective against the backdrop of high-speed robots.
Therefore, sooner or later, each of us asks ourselves a completely logical question: “How to write an advisor for MetaTrader 4?”
In order to write an advisor for MetaTrader 4 or any other platform, you must first of all have knowledge of programming, and as our practice shows, each platform has its own language, which can be easily learned from the textbook for this program.
How to write an advisor yourself?
Naturally, if you are not familiar with programming, you can use various constructors. As a rule, all constructors divide important functions into blocks, so all work with the program comes down to a summary of these blocks depending on your trading strategy.
By the way, we previously gave an example of working and creating an advisor for MetaTrader 4 using the Forex Strategy Builder . The advantage of using this program is that it is completely Russified, so almost everyone involved in trading can understand it.
Preparation of technical specifications for a programmer
Often, the difficulty in writing an advisor does not lie in ignorance of programming, but in the banal difficulty of describing one’s own wishes. It doesn’t matter whether you write the advisor yourself or order it from a programmer, but if you are not able to clearly state the rules of the strategy on paper, then naturally you will never get what you want.
Therefore, in order to get exactly what you want from the contractor, you must clearly state your requirements. So, let's start in order.
1. Inform that the advisor will be used for real trading.
This point may seem funny, but the advisor for testing a strategy in the MT4 tester is usually very different from the expert who will actually trade. If you do not clearly indicate this, you may end up with an Expert Advisor that will not open positions in real time or, if the connection is lost, will not track its orders.
You must understand that these two types of Expert Advisors are very different in terms of labor intensity, so if you do not clearly indicate this, the programmer may take the easiest path of resistance.
2. Specify the rules for entering a position.
Clear rules for entering a position are very important for a programmer to write an Expert Advisor. Don’t forget about such simple little things as entering using a closed candle or a signal, placing a pending order from the current price or from a closed candle.
All these childish mistakes lead to the programmer finishing everything as he wants, and in the end this can greatly affect the result.
Also, do not forget that the performer may be at a completely different level in trading, so you should not use slang. Always support your wishes with a picture, and remember the word “mashka” and “ Moving Average ” can have different meanings for the performer, although you are talking about a moving average.
3. Specify the algorithm for exiting the position
Very often, traders forget to indicate this point, so their experts close and open a position when a signal in the opposite direction appears, or, on the contrary, do not react to market changes until a stop or profit is triggered. Pay special attention to this point, because if you don’t indicate this right away, no one will redo the expert for you for free.
4. Rules for position calculation and transaction support.
If you are used to seeing that almost every expert has a trailing stop or calculates the lot depending on the risk percentage, this does not mean that the programmer will do the same.
Remember, it doesn’t matter whether you are going to write an advisor personally in the designer or give the task to a programmer, your main task is to clearly think through all the elements of the strategy down to the smallest detail.