Guest post by 4xdev.
Want to know if you can code your trading strategy into MetaTrader 4 robot effectively?
Read on to find out more!
One of the most capable features of MetaTrader 4 is algorithmic trading (automated trading) which lets you develop, experiment, and apply Expert Advisors and technical indicators. Additionally, it removes any complications in methodical and trading action.
On this platform, you will find the MQL4 IDE (Integrated Development Environment) which can allow you to develop trading bots as it has an MQL4 object-oriented programming language core to develop trading strategies. It is very efficient, flexible, and functions at a distinctive level. It sports a debugger and lets you compilation via the editor. Once you have done that, it automatically moves your application to MetaTrader 4 where a test or optimization is run on it in one of the MQL4 IDE components, the Strategy tester.
Explaining further, this means that the MetaTrader 4 make the broadest chances for the development of Expert Advisors and technical indicators open to you. Aside from that, you will get extra services that let you put your programming skills in play when using MetaTrader 4.
Can any trading strategy be coded into MetaTrader 4?
The question we frequently receive from our clients is if any strategy can be coded into MetaTrader 4. This part of the article will provide a comprehensive answer to the question and clear the doubts you may be having. So, if you’re one of those who ask such questions, follow us as we explain this in detail:
On the MT4, you can code any trading strategy regardless of its complexity thought it will encompass various setups as related to indicators, price actions, candlestick patterns, visual manipulation of MT4 objects, e.g. trading based on trendlines, arrows, fibos and more.
You must possess a clear set of guidelines for opening, closing, and handling orders if you wish to generate an automated trading system. The advantages of using an EA to do your trades include being able to handle your trading with the physically unfeasible swiftness, precision, and frequency as well as carrying out your trades continually 24/5 a week.
Despite the fact that you can precisely code any strategy in Meta Trader4, some exceptions still exist. For instance, several basic strategies might be more sophisticated than just reading a news result from a news web site and acting on it, therefore it would need some physical input.
Nevertheless, you can code strategies based on complicated analytical methods. From our own research or encounter, we have found out that with an increase in the sophistication of the strategy, the more likely that it would be able to gain from moving intricate functions into a DLL accessed from the EA.
Hence, it is in most cases but if not, we will inform you too. And in those situations when it cannot completely automate, it is often likely that you can create semi-automatic tools that are very useful for the trade.
Wrapping UP
Although most trading strategies can be encoded in an MT4 Expert Advisor, some of them may contain features not supported by the platform. At 4xdev, we always warn the customer whether it is possible to implement the strategy or whether it is necessary to make changes to the specification, abandon some features, or change them.
To understand whether it is possible to implement a particular strategy, we need a description from which it is possible to select a set of rules that can be implemented programmatically for the strategy.
In terms of performance, almost any strategy can be created, but not everyone will work fast. For example, an advisor that will check all currency pairs will work much slower than several identical advisors working on the same currency pair.
For specific tasks that are beyond the scope of MQL capabilities, we can use third-party libraries that will add all the necessary functionality to the MT4 Expert Advisor.
The 4xdev team has extensive experience in creating tools for MT4 (more than 500 orders for MT) and will certainly cope with a project of any complexity.
Click the get a quote button to contact us for your project needs.
What is Metatrader 4? MetaTrader 4 is one of the leading platforms in the world…
In this MT4 tutorial, Rimantas explains how to download MetaTrader 4 and open Forex demo…
There you'll find video tutorials for the Equity Sentry software for MT4. (more…)
There you'll find video tutorials on how to install and use the Trader On Chart…
There you'll find video tutorials on how to install and use the Trendline Trader EA…
Installing and running multiple MT4 client terminal instances on the same machine is easier than…
View Comments
Great compilation of replies and minds Rimantas.
Very interesting question also. As fas as I can see MT4 has so many limitations compared to the human mind.
One good example of this is I have always wanted live dynamic calcs, but MT4 purely mostly functions on 'tick', and not milli/micro second calcs between ticks, mostly leading to intense CPU drain. Then you have bridging, server side handling etc.
The currency market is now so HFT based from 'the big guns', a lagging platform like Meta simply doesn't stand a chance from what I can see. My only solution to deal with this, is draw down which no retail trader can avoid from the second a position is opened.
Thanks for your feedback, Conway. MT4 does have lots of limitations for sure, but still I cannot complain about it that much at the level I need it. I think the same goes for many traders.
As for HFT and other things you mention, I agree. And draw downs really sucks, but I see that as a part of the trading plan.
Good luck with your trading ;-)
Great article Rimantas, many thanks!
I've been thinking about forex robots a lot lately as I've had periods when I've just been too busy to sit in front of the charts for several hours. And as I said once in a post "nothing beats the feeling of making money while you sleep!"
I agree with your comment about trend lines, as an example of what can't be coded well. Another one that I've always thought would be impossible is Fibonacci, for the reason that the decision to select points A and B to draw the fibs between is such an arbitrary one, even if we try to define it beforehand.
Cheers,
Erron
Erron, I agree with you on Fibonacci. You can definitely program EA to use it, but still, EA will not see and choose Fibo levels the way individuals see and feel.
Thanks for your comment.
Interesting. I'd like to get a handle on trading the strategy that I'm learning at present and in future perhaps take the time to code it if possible...
Great. I am sure you'll come to that, and now you have a good list of programmers to turn to ;-) Good luck!
Rimantas, I agree with you regarding subjective conditions such as trendlines. Tom DeMark is quite good at establishing rules on how they should be drawn (between two pivot points). For a high point, a pivot occurs when x number of highs to the left and right of the pivot are all lower than the pivot; the reverse is true for a low point. Too many traders draw subjective lines that tend to reinforce what they want to believe. One of the more difficult issues to address when programming for clients is to get them to understand the importance of specific, objective conditions.
That doesn't mean that everyone has to use DeMark's methods. It just means that they need a consistent, clearly defined method. That true for all aspects of trading strategy development. A programmer should be able help clients to identify methods when needed. That's part of the added value of hiring an experienced programmer who also trades.
Good point, Richard. I totally agree with you. Thanks for your comment.
"Can any trading strategy be coded into MT4 robot?"
Yes.
If that trading strategy can be successfully demonstrated/shown on MT4/MT5 manually, then it can be coded using MQL4 /MQL5.
Any hybrid strategy (which requires human input) can be coded.
A trading strategy which can be fully automated may not have a good return in future,
The problem is not in coding, but in thinking out the algorithm properly.
Of-course we *cannot* do HFT using MT4.
Dear Ray, thanks for your comment.
Hi, this might be a stupid question, but can an expert advisor encrypted with virus/ malware by any chance? If I "install" an EA from an unknown source will my computer/ MT4 account be compromised?
Thank you very much in advance to answer this noob question.
Cheers
Ki
Hi, if EA is using external DLL library, then yes, it is technically possible. But I never heard of such case yet in 7 years of my MQL4 programming career.
And if you run EA that does not use DLL, or you have it disabled for that EA, in such case there is no way to install any malware on your computer.
Hope this helps.