Hello there and welcome to the journey to the center of the Graph. But before we start let me clear few things for you.
The idea of this post is not related to any marketing campaign, affiliate program or anything that is supposed to generate profit from your time! In this post I’ll try to share as much as possible of my knowledge related to automated trading and why developers of Trading Robots should start to think in a more Open Source way.
Risk warning: Trading Forex (foreign exchange) or CFDs (contracts for difference) on margin carries a high level of risk and may not be suitable for all investors. There is a possibility that you may sustain a loss equal to or greater than your entire investment. Therefore, you should not invest or risk money that you cannot afford to lose.
Once you are well aware of those two things we are ready to start. Please take a cup of coffee and enjoy your travel to the center of the Graph.
What is the Graph?
At least once in your life you’ve seen a bar chart in an Excel document which represents some data related to the overall content of the document.
In the world of trading, graphs can look very similar to those bar charts but instead of static data, they are caring live information about the status of the market and the Worldwide Financial Movements. Knowing this I would say the Graph is basically the heart of the Financial World.
As a traders we have access to different graphs which are related to different instruments. Instruments can be Currency Pairs like EUR/USD, Commodities like Petrol and Gold, Company Shares or my personal favorite Indexes.
As every living being the Graph can be sometimes dynamic or numb before encountering a big wave. Those are the times when traders are losing most of their capitals, which brings us to the next chapter.
What is Automated Trading and why it’s always better?
As you can tell automated trading is something that is powered by a computer in the back scene. Here most of the people get scared and think that in order for it to work they have invest dozens of money in a powerful hardware configuration which is not always the case.
Automated Trading is powered mainly by strong logical algorithms which are specially designed for a specific instrument. Strategies which are meant to work for more than one, will most likely fail or in the best scenario, they’ll bring a lot less revenue in the end of the day. And of course this is not what we are aiming for.
Okay… But why it’s always better?
When numbers are speaking the machines will always be one step ahead.
Rule number one: Calculations are happening much faster in a computer CPU than in our brains.
Rule number two: Machines don’t have greed.
Oddly enough even the most shy person in the world will want more when the profit is growing. This sometimes can lead to a very successful trades, but in most of the times the human greed factor enters the scene and converts the little profit to a bigger loss.
Rule number three: We can’t stay 24 hours in front of the screen, computers can!
Keeping these rules in mind, it’s time for us to get a little bit techie.
What was learned and developed?
As every business niche, trading has its own specifics which you can learn only by experiencing them personally. Good news, they are only two.
You either win or loose money. Losing aka Gambling is the easy part, Winning is the part where actual knowledge comes handy.
What was learned?
One of the most useful lessons that were learned during the research was that not every good looking strategy will work for every instrument. Sometimes the logical decisions can bring you to a great loss. So sometimes you should play it the other way – Be impulsive.
Building an automated trader, trading robot or also called Expert Advisor. Is not as easy as they say. Even if you’ve been playing with different programming languages like PHP, Java or other, MQL is something else.
However MQL was built on C++ and its syntax is pretty similar to it with a bit of twitches and some disadvantages. One of the biggest issues with starting and developing on MQL is the community and the documentation.
Documentation of MQL is pretty old looking and sometimes it’s pretty complicated for understanding, sometimes it can be even confusing.
Since we are talking about the stock market here, there is nothing free. Every line of code and every simple explanation has to be paid.
I’ve confirmed the above for myself after I’ve spent hours in research of good trading strategies and good patterns of programming in MQL. That’s why I think MQL community should take the more Open Source and Friendly path.
This will not only make the language more popular, but it’ll save a lot of time and money to all of us in matter of developing and testing new strategies. Let’s be honest if there was a list of false strategies you would never waste time in trying to develop the first idea that comes to your mind.
What was developed?
Enough of blinking, let’s get even deeper. In the last few months I’ve been playing with an interesting idea which lately became a fully automated trading robot, whose results on the backtests are pretty promising. Before sharing from where you can get it for FREE and start twitching it, we have to know what’s the logical strategy behind it.
The very first thing that stays in the core of that Expert Advisor is the Tick signal (Tick signal is a signal for a price change). On every tick in the Graph, the bot knows what’s happening with the price of the specified instrument, is it going up or down. Knowing this the bot is waiting to see if the price will do a move of 10 pips in a specified direction in the timeframe of one minute.
The other crucial parts of this strategy are the RSI (Relative Strength Index) and the Bulls Power market indicators, combined with an inspection of the current hour movement and growth.
The RSI indicator is showing us the relative position of the price in the specified period. It can be Overbought, Oversold or Hanging. Overbought price means that the market was flooded with BUY (or Bullish) deals, which made the price of the instrument insanely high. In overbought situations the bot knows that the only possible deal is for SELL (or Bearish / Short). Same but mirrored logic goes for the oversold indication. The most problematic from the three of those is the Hanging indication. Hanging can be noticed when the indicator value is equal or close to 50. It’s problematic because when the price is hanging then there is no clean direction (or trend) on the market.
The Bulls Power indicator. This simple indicator is telling us when the price is Bullish (good for buying) and when the price is Bearish (good for selling) for the specified instrument. When the value of this indicator is above 0, the price is in a shape for potential growth. When the value of the indicator is bellow 0, the price is potentially going down.
The Current Hour Movement and Growth. Before deciding to open a new position bot checks two things. What were the movements in the hour? Were they big? What was the direction of that hour? That’s the key to check if the indicators from above and the last price movement (or tick) are correct or not.
Enough of theory, let’s get things done!
The Expert Advisor code can be found and twitched for FREE in my GitHub repository linked here. However I’ve decided to upload the whole MQL5 directory so you’ll see all of the stock things there plus a unique design of the chart that I’m using called MaterialTrader.
Where to find the code and the includes?
The Expert Advisor itself is placed in the Experts folder and it’s called Advanced-Bot.mq5.
All of the includes can be found in the Include folder and then in Actions.
What do you need to start it?
Both of them have their plusses and minuses. For example AdmiralMarkets provide a better quality of their history for backtesting and have the possibility to purchase 0.* trading lots of the Index instruments. On the other hand ThinkMarkets are more stable and their customer support is better, so maybe for bigger investment I would choose them instead.
Once you pick the broker of your choice, you’ll have to install the MetaTrader platform provided by your broker and login to your account and voala you are almost there.
One more thing in the setup. Depending on the currency of your account you may need to include the EUR/USD currency pair in the Market Watch in order to have a realtime and correct currency exchange rate.
When you make that preparation, open the Strategy Tester and make sure to pick the following settings. Note: Depending on your broker the Quality of the History can differ, from which your results may be different.
And finally the interesting part. What did the Backtest results presented?
Backtest graph of wins and losses
This Expert Advisor was only tested in DEMO Mode, so results may differ in live action, but it can be used as a solid backbone for further development of your strategy. I’ll be playing it live once the Nasdaq100 prices gets back to normal levels. The decision for when and how to use it, is up to you.
Thank you for getting till here! I hope this article was useful for you and you’ll have a good experience with the Automated Trading. It’ll be a huge pleasure for me to learn which is your broker of choice, why would you go with them and what are their advantages. Let’s make the MQL Community better, together!