If you are interested in trading forex with robots, then probably you are aware of their pros and cons. There are many ways to use a trading robot and here are some of them:
- to trade without human intervention: this is a complete trading robot. It opens trades, it closes them, it has rules for every possible situation.
- to open trades only: in this case, this robot is used as a very complex conditional order. In some cases pending orders are not enough and you need to place additional rule. For example, if the hour is 15 and the price is above 1.0010 open buy position. After the order is opened it is left to the trader to close it.
- to close trades only - such robots usually perform custom trailing stop (custom because most of the platforms offer integrated trailing stop and you need a robot for that only when it differs from the original) but also can be used for other complex rules when stop-loss and take profit are not enough.
- to test a strategy - sometimes you have an idea for trading, you have clear rules when to open and close, and you want to see how this works. You can see several cases, but only a trading robot can test all cases and give you a result of what will happen if those rules were applied in the past. This can help you analyze the strategy, making changes if necessary, and then backtest that changes ...
The platform
Now when we are aware of what is the most common usage of the robots, let's talk about how to use them. The most simple way is to use a trading platform that has integrated robots support. The most popular forex trading platform is MetaTrader. It has its own script language for creating robots, good tutorials, example expert advisors, and... almost unlimited possibilities. You can create a very very complex expert advisor.
How to start
After we have chosen the platform (we will talk for MetaTrader, but the principles are the same for every other software) now it is the time for the strategy. We are not going to speak for using ready trading robots which you can find on our website, but for creating your own.
When you are trading manually, you can have a strategy, but sometimes it is not that clear. Many decisions are done by sixth sense or depend on the mood. When you want to use a robot, all rules must be crystal clear. You must have rules for every possible situation.
Every forex trading robot has 2 basic elements - entry and exit. Sometimes the exit is just a stop-loss and take-profit but this is still an exit rule, it is just integrated into the position and there is no need for coding.
Open position
Opening a position may look simple for a human, but there are many things to take care of if you are using a trading robot.
1. Check for already opened positions. If you leave a robot to open position when it meets some criteria, it will open position every time when he gets it, and very soon there will be thousands of positions. To take care of that we must first check for opened positions and pending orders. How many, what type, what is their magic number (the magic number is a native way to run several systems at the same pc- every system will put its own magic number and each system knows which are its orders), when are the orders opened, etc... Having that info we can create some logic that makes a decision if we can open new order or not.
2. Check for the entry rules. When we have checked the positions and we know that we can open positions we can check if the entry rules are met. Sometimes the rules are very simple, but sometimes they are very complex and include a huge amount of code. Here we must also make sure that we are checking the right shifts and prices for the indicators.
3. Check for market conditions. When we create a trading robot for backtesting, we can skip that test, but when we work in real conditions we need to check what is going on.
-free margin - the broker can change your leverage for some reason
- what is the spread - sometimes during news, or specific events the market spread is widening a lot. Instead of 1 point, you are getting 50 or even more. You must decide if you open in such a market, or wait until the spread is in a certain range. Not checking that can result in opening positions and getting instant stops.
- make sure that the timestamp of the last trading bar corresponds correctly to the time on the computer. In some rare cases, there can be a problem and the system can build the wrong bar or not build it for some time.
-check if the current bar or previous is too big -in some extreme cases there can be thousands of points bars and probably you don't want your trading robot to work in such an environment.
-what is the swap, if your robot is going to keep the position overnight it is good to see if the broker didn't change it to extreme values
- check the closed positions of the trading robot. In some cases, your robot can become in a situation when it opens a position, makes a loss, then opens another, makes another loss, and so on. You need to make sure that this will not happen, and it will not generate a huge amount of losses for some reason. There are many ways to protect your robot from that, but the most simple one is to limit the orders to 1 or 2 per bar.