Coding Your Own Algo Trading Robot

JUPIT.RE
5 min readMay 12, 2019

Ever wanted to become an algorithmic trader with the ability to code your own trading robot? And yet, are you frustrated with the amount of disorganized, misleading information and false promises of overnight prosperity?

Outlined below are the basics of what it takes to design, build and maintain your own algorithmic trading robot.

What an Algorithmic Trading Robot Is and Does

At the most basic level, an algorithmic trading robot is a computer code that has the ability to generate and execute buy and sell signals in financial markets. The main components of such a robot include entry rules that signal when to buy or sell, exit rules indicating when to close the current position and position sizing rules defining the quantities to buy or sell.

Algorithmic Trading Strategies

It is important to begin by reflecting on some core traits that every algorithmic trading strategy should have. The strategy should be market prudent in that it is fundamentally sound from a market and economic standpoint. Also, the mathematical model used in developing the strategy should be based on sound statistical methods.

Next, it is crucial to determine what information your robot is aiming to capture. In order to have an automated strategy, your robot needs to be able to capture identifiable, persistent market inefficiencies. Algorithmic trading strategies follow a rigid set of rules that take advantage of market behavior and thus, the occurrence of a one-time market inefficiency is not enough to build a strategy around. Further, if the cause of the market inefficiency is unidentifiable, then there will be no way to know if the success or failure of the strategy was due to chance or not.

With the above in mind, there are a number of strategy types to inform the design of your algorithmic trading robot. These include strategies that take advantage of the following (or any combination thereof):

  • Macroeconomic news (e.g. non-farm payroll or interest rate changes)
  • Fundamental analysis (e.g. using revenue data or earnings release notes)
  • Statistical analysis (e.g. correlation or co-integration)
  • Technical analysis (e.g. moving averages)
  • The market microstructure (e.g. arbitrage or trade infrastructure)

Designing and Testing Your Robot

There are essentially four steps needed to build and manage a trading robot:

Preliminary Research

This step focuses on developing a strategy that suits your own personal characteristics. Factors such as personal risk profile, time commitment and trading capital are all important to think about when developing a strategy. You can then begin to identify the persistent market inefficiencies mentioned above. Having identified a market inefficiency you can begin to code a trading robot suited to your own personal characteristics.

Backtesting

This step focuses on validating your trading robot. This includes checking the code to make sure it is doing what you want and understanding how it performs over different time frames, asset classes, or different market conditions, especially in black swan type events such as the 2008 global financial crisis.

Optimization

Now that you have coded a robot that works and at this stage, you want to maximize its performance while minimizing the overfitting bias. To maximize performance you first need to select a good performance measure that captures risk and reward elements, as well as consistency (e.g. Sharpe ratio). An overfitting bias occurs when your robot is too closely based on past data; such a robot will give off the illusion of high performance, but since the future never completely resembles the past, it may actually fail.

Live Execution

You are now ready to begin using real money. However, aside from being prepared for the emotional ups and downs that you might experience, there are a few technical issues that need to be addressed. These issues include selecting an appropriate broker and implementing mechanisms to manage both market risks and operational risks such as potential hackers and technology downtime.

It is also important at this step to verify that the robot’s performance is similar to that experienced in the testing stage. Finally, continual monitoring is needed to ensure that the market efficiency that the robot was designed for still exists.

The Bottom Line

Considering that Richard Dennis, the legendary commodity trader, taught a group of students his personal trading strategies who then went on to earn over $175 million in just five years, it is completely possible for inexperienced traders to be taught a strict set of guidelines and become successful traders. However, this is one extraordinary example and beginners should definitely remember to have modest expectations.

In order to be successful, it is important to not just follow a set of guidelines but to understand how those guidelines are working. The most important part of algorithmic trading is “understanding under which types of market conditions your robot will work and when it will break down,” and “understanding when to intervene.” Algorithmic trading can be rewarding but the key to success is understanding.

Are successful traders somehow more special than you ?

Of course not. They just have the right strategy. Any one can learn to find low-risk, high-potential investment opportunities in an uncertain market, so long as they have the right skillset. At online Trading Academy, you can learn the secrets of the pros and learn how to make money like they do, no matter which way the market turns.

--

--

JUPIT.RE

Life, Self-Improvement, Philosophy, Science, A.I., Web3, Business, Finance, FinTech, Innovation