Home

Should Automated Trading be for EVERYONE();

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

Documentation of MQL is pretty old looking and sometimes it’s pretty complicated for understanding, sometimes it can be even confusing.

Community

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?

First of all you have to find a broker which you’ll want to use. I’ve passed by a lot of scammy Market Makers and currently I’ve stopped on AdmiralMarkets and ThinkMarkets.

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.

Let’s jump!

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.

MetaTrader - MarketWatch setup in order the Expert Advisor to work properly with the Advanced-Bot developed by Gero Nikolov

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.

MetaTrader - Strategy Tester setup in order the Expert Advisor to work properly with the Advanced-Bot developed by Gero Nikolov

And finally the interesting part. What did the Backtest results presented?

Backtest results

MetaTrader - Backtests results of the Expert Advisor Advanced-Bot developed by Gero Nikolov

Backtest graph of wins and losses

MetaTrader - Backtests results graph of the Expert Advisor Advanced-Bot developed by Gero Nikolov

Disclaimer

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.

Closing remarks

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!

Original blog post was published in my LinkedIn profile, check it here.

The machine learning?

These days everyone is speaking about computers, about their super powers and the “fanciest” word around is machine learning. But did the people actually understand how the machine learning works?

In this post I’ll share with you what I’ve learned about it in the last couple of months. Before we’ve started you should know the answer of the question…

What is learning?

Simply learning is the process in which our brain is evolving and upgrading its knowledge base. That knowledge can be achieved by reading, by speaking with smarter people like science teachers & business owners, or simply by a lot of try{} catch ($e){}cases /*for the none developers that means to make a lot of attempts which would be a failure and to learn from your mistakes*/. Oookay…

But how could you teach the computer when it doesn’t have brain?

Actually the computers do have a brain. That’s the CPU chip!

Their brain is a lot more simpler than ours but it still can be taught from a good teacher. Teacher who is going to tell it what is good and what is wrong. What should be done in the specific cases of the different types of work.

How can you do that?

Very simple… With computer programs, which you’ve written by the years or with one single algorithm. Since we already know that the computer programs can do a lot of things here I’ll speak more about that algorithm thing.

What is it?

The algorithm is actually a computer program, which has something in its core which allows it to learn from you and predict what should be the end result, based on your actions.

There are two types of algorithms: Supervised and Unsupervised

Here I’ll share with you the secrets of…

The Supervised machine learning

Imagine that you have a little child, which you had to learn on the basics of life. For the kid you will be a teacher, a supervisor, the person who will navigate it trough the good and trough the hard times. The kid is the algorithm and the way in which it will grow up is the result. Sounds simple, right?

Let me give you an example:

If you want the kid to become a doctor you are going to tell it that doctors save lives, which helps the society with reducing the different kinds of diseases. But you won’t stop with that. You’ll tell it that there are also bad people, which are making bad things, such as robb*ries and m*rdering…

Only when the kid knows what are the difference between good & bad it will be able to make the correct choice. The choice to become a doctor! Then the result is the expected one and your supervising against the algorithm was correct.

The exactly same example is valid for the computer algorithm too!

Hmm… Are you sure?

Of course I am! When you are going to build you algorithm to do some job based on the user interaction, you are going to tell it which activities are good (drives to a positive result) and which are bad (hits an error). So when the supervisor (user) starts to use it, the algorithm will make correct predictions for him/her.

You still don’t believe me? Let me give you an example with the latest project of Dloober. which is based exactly on this algorithm…

Few words about the project

It is a WordPress plugin called AINOW. Its core idea is to track your users interactions with your blog posts, which are listed on a specific page. Based on those interactions the algorithm gets to know each of your readers and next time when they come back, they will see only those articles which are based on their interests!

How this helps you?

First it will remove the annoying administrative work from your shoulders. Second and mainly, it will leave you just to create those amazing stories, which you love to!

How it works?

It is very simple actually… You are the godfather of the whole track. You are the person who creates the stories which the reader will see. After that the reader becomes the supervisor who will tell the algorithm what he expects to see next time.

Okay… But how the computer will remember the information?!

There are two ways to do that. First you can keep the information into files on the hard drive of the user (if your app is desktop or mobile). On the second hand you can save the data in a remote database server (if your app is based on the web).

Both ways have their specifications and there isn’t a wrong way to do that! If you choose to keep the files locally, they will be available even the user is not connected to the internet. But the access to different information can be slower than the database server solution, because files are NOT optimized for complex queries!

That is pretty much the whole thing behind the supervised machine learning. If you have any question I would like to collaborate with you in the comments or on a cup of coffee in Starbucks sometimes.

Ooh one more thing… Keep the positive vibe & Dloobe. it up!

PS. The original post can be found in my LinkedIn profile here.