Coding your own trading algorithm

Many traders aspire to become algorithmic traders, but find it difficult to properly code their trading robots. These traders will often find disorganized and misleading algorithmic coding information online, as well as false promises of prosperity overnight. However, a potential source of reliable information is from Lucas Liew, creator of the online algorithmic trading course AlgoTrading101. The course has gathered more than 30,000 students since its launch in 2014.

Liew’s program focuses on presenting the fundamentals of algorithmic trading in an organized way. He is adamant about the fact that algorithmic trading “is not a get-rich-quick scheme.” Below are the basics of what it takes to design, build and maintain your own algorithmic trading robot (excerpted from Liew and his course).

Rise of the Robo Advisors

What is a trading robot?

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

Key takeaways

  • Many aspiring algorithm traders have a hard time finding the right education or guidance to properly code their trading robots.
  • AlgoTrading101 is a potential source of trusted instruction and has earned over 30,000 since its launch in 2014.
  • A trading algorithm or robot is a computer code that identifies buy and sell opportunities, with the ability to execute entry and exit orders.
  • To be profitable, the robot must identify regular and persistent market efficiencies.
  • While examples of get-rich-quick schemes abound, aspiring algorithm traders are best served if they have modest expectations.

Obviously, you will need a computer and an internet connection to become an algorithmic trader. After that, a suitable operating system is needed to run MetaTrader 4 (MT4), which is an electronic trading platform that uses MetaQuotes Language 4 (MQL4) to code trading strategies. Although MT4 is not the only software that can be used to build a robot, it does have a number of important benefits.

One advantage is that while MT4’s main asset class is currency exchange (FX), the platform can also be used to trade stocks, stock indices, commodities, and Bitcoin using contracts for difference (CFDs). Other benefits of using MT4 (as opposed to other platforms) are that it is easy to learn, has numerous sources of FX data available, and is free.

Algorithmic Trading Strategies

One of the first steps in developing an algorithmic strategy is to reflect on some of the core features that every algorithmic trading strategy should have. The strategy must be market prudent as it is fundamentally sound from an economic and market point of view. In addition, the mathematical model used in developing the strategy must be based on robust statistical methods.

Next, determine what information your robot intends to capture. To have an automated strategy, your robot must be able to capture persistent and identifiable market inefficiencies. Algorithmic trading strategies follow a rigid set of rules that take advantage of market behavior, and the occurrence of a single market inefficiency is not enough to build a strategy. Also, if the cause of the market inefficiency is not identifiable, there will be no way of knowing whether the success or failure of the strategy was due to chance or not.

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

  • Macroeconomic news (eg, Nonfarm Payrolls or changes in interest rates)
  • Fundamental analysis (eg, using earnings data or earnings release notes)
  • Statistical analysis (eg, correlation or cointegration)
  • Technical analysis (for example, moving averages)
  • The market microstructure (e.g. arbitrage or trading infrastructure)

Preliminary research focuses on developing a strategy that is tailored to your own personal characteristics. It is important to think about factors such as personal risk profile, time commitment, and business capital when developing a strategy. Then you can start to identify the lingering market inefficiencies mentioned above. Once a market inefficiency has been identified, you can start to code a trading robot that is tailored to your own personal characteristics.

Backtesting and optimization

Backtesting focuses on validating your trading robot, which includes checking the code to make sure it is doing what you want it to be and understanding how the strategy is performing in different time frames, asset classes or market conditions, especially in events. of the black swan type like 2007. -Financial crisis of 2008.

Now that you’ve coded a working robot, maximize its performance and minimize overfitting bias. To maximize returns, you must first select a good performance measure that captures the elements of risk and reward, as well as consistency (eg, Sharpe Index). Meanwhile, overfitting bias occurs when your robot relies too heavily on previous 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 performance

Now you are ready to start using real money. However, in addition to being prepared for the emotional ups and downs you may experience, there are some 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.

Key takeaways

Before going live, traders can learn a lot through simulated trading, which is the process of practicing a strategy using live market data but not real money.

It is also important in this step to verify that the performance of the robot is similar to that experienced in the test stage. Lastly, monitoring is necessary to ensure that the market efficiency for which the robot was designed still exists.

The bottom line

Considering that Richard Dennis, the legendary commodity trader, taught a group of students his personal trading strategies that then made more than $ 175 million in just five years, it is plausible that inexperienced traders are taught a set. strict guidelines and succeed. . However, while there are extraordinary examples, aspiring traders should definitely remember to have modest expectations.

Liew emphasizes that the most important part of algorithmic trading is “understanding what types of market conditions your robot will operate in and when it will break down” and “understanding when to intervene.” Algorithmic trading can be rewarding, but understanding is the key to success. Any course or teacher that promises great rewards without sufficient understanding should be a major warning sign to steer clear.

READ ALSO:  Top 9 Tricks to Lower Your Property Tax Bill
About the author

Mark Holland

Leave a comment: