Algo trading: How I mastered algorithms for my strategy
Ever wondered how traders turn algorithms into real results? In this guide, trading expert Christopher Tahir shares how he built his own algorithmic trading strategy—combining the basics of algo trading with hands-on experience.
As complicated as it sounds, the very first time I heard about algorithmic trading (also called automated trading or algo trading), I thought it was some kind of sorcery that trades the assets by itself. Fortunately, the internet dismissed this notion, and I was able to discover what algo trading was truly about.
After reading about algorithmic trading, my initial thoughts were about the system's accuracy and sustainability. At the same time, the complexity of producing a system can be very challenging. However, in this era of AI, there are plenty of LLMs (Large Language Models) that can assist us in production with a little bit of programming knowledge.
Having an algorithmic system helped me set aside my emotions when trading, ensuring repeatability. This is a challenge because emotions like greed and fear can ultimately affect even the most stoic trader, which is fundamental to human nature. Other than helping to remove the emotional aspect, another massive benefit of algo trading is the ability to test and iterate the system, enhancing it in line with the dynamism of the financial markets.
Content
- My first encounter with algorithmic trading
- Building my first algo trading system
- Lessons I learned from real-world execution
- The algorithmic trading strategies that worked for me
- Tools, platforms, and tech I rely on
- Frequently asked questions about algorithmic trading
- Key takeaways
- Final thoughts: What algo trading taught me about myself
My first encounter with algorithmic trading
From manual trades to market frustration
Manual trading may sound easier to create, as in most cases, manual traders create their systems by relying on the visuals from the charts. However, as I mentioned, human factors will give us certain biases that may overfit certain data, eventually creating a system that can’t execute. In short, it looks promising visually but doesn’t work in practice.
This condition led me down the rabbit hole, looking for the “Holy Grail”, which, as it turns out, is nonexistent. Manual trading also frustrates me when testing my system, as manually jotting down executions on spreadsheets can be very challenging, not to mention time-consuming and distressing to my mental and physical health. Hence, I decided to move into another rabbit hole of algorithmic trading.

Interested in currency trading?
Get market-beating conditions, available only at Exness.
Hearing about algo trading for the first time
I had been a skeptic of algorithmic trading systems, especially with those without any maintainers. I was particularly wary of traditional algorithmic trading approaches that relied heavily on rigid rules without adapting to changing market conditions. In my early trading years, I dived into algorithmic trading, but found the systems unrealistic and unsustainable, especially knowing that many systems rely purely on money management without any proper technical or fundamental trading strategies built in.
However, along the way, I collected the building blocks needed to create a proper algorithmic trading system of my own, starting with the required trade risk control, quantitative trading system development, and coding in the charting platforms (I used Amibroker in the past). However, the rise of web-based charting platforms changed everything, allowing traders to keep their studies wherever they are. This condition basically cemented the last building block needed for an algorithmic trading system.
This was the foundation of my algorithmic system…until I discovered ChatGPT. What a game-changer. However, despite having some experience coding on different charting platforms, things are not as easy as they look. So, I took the leap to learn a bit more about the platform’s code (programming language). Mastering it is not a must; understanding the logic behind it is sufficient for us to fix the code provided by the GPT platforms.
Building my first algo trading system
Why I chose to learn how to code
Before I could fully automate my trades, I had to learn the core components of a robust algorithmic trading system. When carving out the second building block of quantitative trading system development, I joined a two-day workshop that included the first (risk management) and third (coding) blocks. This gave me a jumpstart on the algorithmic trading system development process. Aside from that, there are no successful algorithmic trading system developers who share their secret recipe for building their systems. Hence, I decided to do it by myself. This approach allowed me to customize every aspect of the system, from risk parameters to broader portfolio management considerations.
There are plenty of trading platforms from where you can start your algorithmic trading journey. I tested TradingView, which is less technical despite its limitations. Python is also a good choice, given its popularity in Machine Learning (ML), but the technical setup is more complex. However, any code may work as long as the trading platform you use allows the connection with your code.
If you're considering algorithmic trading with a more flexible and well-supported trading platform, MetaTrader 5 (MT5) is another solid choice for algorithmic trading strategies. I personally prefer how MT5 allows you to build and run automated trading strategies—called Expert Advisors (EAs)—using MQL5 or even Python through its API. This opens up a lot of possibilities, especially if you want to integrate more complex logic or connect external systems. When trading with brokers like Exness, you can easily use MT5 to automate your strategy with minimal setup—just make sure algorithmic trading is enabled in the platform settings. Whether you're deploying a simple moving average system or a multi-layered strategy, MT5 gives you the flexibility to test, optimize, and execute trades with your own set of trading rules. Just remember, even with automation, proper trade risk control and trading account safeguarding are still the backbone of any sustainable trading system.

Smart trading starts with risk management
Safeguard your trades with unique price gap protections, and market volatility alerts.
Risk management comes first
Before confusing myself with other, more complicated moving parts, I always start with the simplest thing that allows my system to sustain my trading account as long as possible: risk management. Managing risk is the most overlooked factor in both manual and algorithmic trading. Effective portfolio management also plays a big role in ensuring your strategies align with your overall financial goals. The topic doesn’t excite traders, and it usually hinders traders from seeing explosive results.
In both manual and algorithmic trading, managing risk is the one component most traders tend to underestimate. Let me bring you deeper into the trading rules and risk control strategies I often apply:
Money management
- Deposit rule: I typically split deposits into equal batches. For example, if I set the batch size at 10,000 USD, each subsequent deposit follows that amount. This approach helps manage risk more effectively than depositing a large sum at once.
- One-shot deposits: When depositing a large amount in one go, I ensure it’s a small portion of my idle funds. If not, I must be prepared to accept the possibility of a total loss.
- Batch deposits: I prefer batch deposits, but this method requires a thoroughly tested system. Knowing how many times similar deposits were made in the past helps, but it’s not foolproof. Always assess your risk tolerance.
- Withdrawal rule: I set this trading rule before using any system to ensure I maintain discipline and consistency.
- Percent-profit based withdrawals: I withdraw only when profits reach a certain percentage threshold.
- Time-based withdrawals: Alternatively, I withdraw at regular intervals—such as weekly—regardless of the amount.
Trading risk management
- Order size: I always set my order sizes based on the risk and the equity left when opening orders. This ensures the position is not overly leveraged while maintaining the potential rewards I can get.
- Max open lots: Many systems do not apply this parameter, but I do. Setting the maximum aggregate positions will ensure our total positions are not overleveraged. In many cases, such systems burn the account by not limiting the maximum exposure.
- Snipe or average: I personally prefer to use a “sniper” system. However, due to limitations, many have to average their positions when the financial markets move adversely to their positions.
By combining these three things, I can ensure that my system will not overexpose my account. Limiting exposure will ensure the account's sustainability and scalability in the long run, allowing me to experiment with algorithmic trading strategies without worrying about exposing my capital to unnecessary risk.
Strategy follows
Before I start developing code, I usually start with the simplest form, manually drawing it on a piece of paper or in a notes app. I want to ensure clarity without the risk of creating something overly sophisticated by directly coding it.
I start with diagrams and create notes on what I want to pay attention to. These notes often include key technical indicators that help define when to enter or exit trades. By doing this, the system can be tested bit by bit, and fixed or optimized along the way. Starting with complicated requirements will ruin the usability, as the results may overfit the data.
Learning to backtest
Backtesting is a crucial part of developing any algorithmic trading system, as it validates how well your strategy could have performed historically. Even though most people are visual learners, looking at a finished strategy visually may deceive you. I personally depended on the visual results of the past (visual historical data). However, after learning about quantitative trading systems, I placed the systems into a suite of tests. One of the most common tests is backtesting.
Backtesting revealed the system's reality from the past data, which opened my eyes and became the initial indication of whether or not the system is usable. If the backtesting results are bad, the system is considered unusable. However, passing backtests does not guarantee that the system is completely usable. This is why you need to do follow-up tests to determine the system's usability when random movements happen.
Meanwhile, many system developers try to show good backtesting results by tweaking parts of the system or just tweaking parameters. These actions may produce false positives and also overfit the system to the past data. Hence, the results may not reflect the potential future performance.
Lessons I learned from real-world execution
Regardless of the test results, the next thing I did was to build my own belief in my system, because what was on paper never fully reflected the potential performance I could gain. This means I must maintain discipline when following the system to ensure that the real performance is not too far from the result on paper. Despite this precaution, you must bear in mind that systems can still fail
Besides that, there are some factors I overlooked in the past, which were not available in the test environment, such as latency, slippage, and infrastructure (mine and the brokers’). In the test environment, I always thought the position would open directly at the open price, assuming that at zero seconds, everything would kick in, and my position would open. In reality, systems can be slower due to the complexity of the code, the network burden on our side, or the slow execution on the broker’s side.
Not only that, sometimes when the market is very hectic, and orders are not executed accordingly right after the tickets are sent. These orders may be executed with slippages, which may impair our profitability and increase our costs. I will not discuss the infrastructure on the broker’s side, as I am not that well-versed on the topic. However, I will touch more on the infrastructure on the trader’s side. Many people believe that their computer can run things optimally, but in fact, computational power is often overlooked, which can disrupt execution. Hence, ensuring that your own infrastructure is capable is also important. Fortunately, most modern computers can run algo-trading codes relatively smoothly.
To optimize the overall experience, I ensure my connection is stable (not only fast) to avoid execution latency. At the same time, filters can be implemented to avoid executions during extremely busy hours (e.g., during news events). Lastly, I ensure my computer is only running my trading system, reducing the processing burden. Aside from that, system simplicity will also help to reduce the risk of slow execution. There are also some that manually override the system when there are unanticipated events, helping to avoid unnecessary volatility.
Summary of key lessons for real-world algorithmic trading
- Latency is real: Even the fastest algorithmic trading systems can lag when the market price moves quickly, so trades may not always execute where you expect.
- Slippage happens: In volatile conditions, orders can fill at less favorable levels, reducing the number of profitable trades your strategy can capture.
- Infrastructure matters: Your computer setup and internet connection have a direct market impact on how efficiently your orders are executed when using algorithmic trading.
- Keep it simple: A lean, well-tested system using clear technical indicators is often more reliable than overcomplicated code that causes delays or errors.
- Discipline beats perfection: No strategy wins every time, but following your plan helps you stay objective when the market behaves unpredictably.
The algorithmic trading strategies that worked for me
Unlike traditional algorithmic trading, which often focuses solely on predefined signals, I aimed to build systems that combined flexibility with clear strategy logic.
Trend-following and momentum
This kind of system is not suitable for everyone, because it tends to mimic how one trades. I usually swing-trade, meaning the frequency of opening new positions can be very boring. At the same time, the system can be tricky, and in many cases the success rate can be lower than scalping systems. However, when one trade works, it will erase all the losses with some profits. Developing a good trend-following system is very tricky because the system needs to be able to perform even when there is a lot of noise.
Mean-reversion strategies
Based on my observation, sideways movement tends to dominate around ⅔ of the overall price movements. Hence, solely using a trend-following system can be very boring. To fill the gap, mean-reversion strategies help catch opportunities during periods when the price takes an adverse turn. Combining Bollinger Bands and oscillators (MACD, RSI, MFI, etc.) helps to determine when to enter the opposing trend. However, ensuring strict trade risk control and trading account safeguarding ensures that I don’t end up being dragged by the main trend when my positions open adversely.
Combining strategies
Combining the trading strategies mentioned above is the most common approach I use. However, if you plan to do so, you need to measure whether the combination will bring more profit or costs. Ultimately, you do not want a system that performs worse than before you combined the two.

Your trading toolkit matters
We offer advanced trading tools to enhance your efficiency and precision.
Tools, platforms, and tech I rely on
The essential stack
The development of algorithmic trading has entered the tech space, involving more mainstream tech stacks. However, it may be trickier as mainstream tech might need you to collect quality historical data while increasing the latency.
Hence, I usually use MQL5 (for MT5) for development. MQL5 (the successor to MT4’s MQL4) is the most common MetaQuotes Language among CFD brokers, which makes sense given that MetaTrader is a common trading platform used by retail traders, both manual and algorithmic traders for trading CFDs. However, the code can be a bit techie, making it less user-friendly for a non-developer strategist. Additionally, coding in MQL also limits the code to the MT ecosystem, which is less favorable. Hence, developers nowadays prefer to code in Python or similar programming languages and connect them with MQL or PineScript.
Choosing the right broker
Brokers are the partners with whom we trade. However, before building the code, I usually check what kind of tech stacks the broker supports.If I develop without this knowledge, I will not know whether my system will be useful later. However, more modern brokers have started to offer API connections to allow trading directly with the price access.
Aside from the coding considerations, you must account for the location of the broker's servers. The distance of the servers relative to your own will determine the latency of the trades. At the same time, using the historical data provided by the broker will also help to ensure that the provided data allows your system to trade accordingly, because each broker has their own way of pushing data to their clients. If you plan on trading CFDs, it’s also important to confirm whether the broker offers reliable trade execution and fair margin policies.
When looking for a broker that supports fast execution and low spreads even during market instability, I chose Exness because it offers a risk-free demo account. The demo account has been invaluable for practicing strategies and testing how my systems handle real-time market impact without risking actual funds. Whether trading CFDs or experimenting with different technical indicators, the Exness platform provides precise execution, flexible leverage, and access to stable spreads. This combination made it easier for me to build confidence before going live, fine-tuning my trading logic, and optimizing my approach for more consistent results.
Frequently asked questions about algorithmic trading
What is algorithmic trading?
Algorithmic trading is the use of coded rules and logic to automatically execute trades in the financial markets. Instead of relying on real-time human intervention, the system analyzes data and makes trading decisions based on predefined parameters such as price levels, indicators, or specific triggers. This form of automated trading allows traders to reduce emotional bias, maintain consistency, and adapt to varying market conditions. While often associated with high frequency trading (HFT), algorithmic systems can also be designed for swing trading, mean reversion, or trend-following strategies, depending on what the strategy aims to accomplish.
What’s the difference between algorithmic trading and manual trading?
The key difference is how trades are executed. When trading manually, every buy or sell action is made by a human based on observation, experience, as well as emotional and psychological factors. With algorithmic trading, these trading decisions are translated into code, allowing the system to automatically execute trades when certain conditions are met. Manual trading is more subjective and prone to human error, while algorithmic systems enforce discipline and reduce the impact of market noise or emotional interference. The result is a more structured approach to navigating the financial markets.
Is algo trading profitable
Yes, algorithmic trading can be profitable when paired with a solid, well-tested strategy and proper trade risk control. The biggest advantage lies in its ability to consistently execute trades according to rules, free from emotion-driven decisions. However, like any other method—manual or active trading—profitability depends on how well the system adapts to real-time market conditions, trade execution latency, slippage, and system maintenance. A good algorithmic trading setup should be backtested, monitored, and regularly optimized to keep up with market volatility and structural changes.
Can beginners get started with algorithmic trading?
Absolutely. While algorithmic trading might seem complex at first, beginners have access to tools that make it more accessible. Platforms like MetaTrader 5 (MT5) or Python-based setups help new algorithmic traders build and test their first strategies—even without a full development background. Many start with simple systems that buy or sell based on basic indicators and gradually expand their skills. What's important is to focus on understanding the logic behind the system, start small, and test thoroughly before going live in the financial markets.
What kind of traders benefit from algorithmic trading?
Algorithmic trading is especially beneficial for traders who value consistency, data-driven logic, and reduced emotional involvement. Those who build strategies around swing trading, mean reversion, momentum, or even active trading can automate their trading decisions to eliminate second-guessing. Traders who manage multiple financial instruments or monitor different timeframes also gain efficiency by letting algorithms handle the execution. In fast-moving market conditions, algorithms respond quicker than humans, which is critical when trying to capitalize on short-lived opportunities. Overall, algorithmic trading benefits both experienced strategists and methodical beginners looking to scale their systems with discipline.
Key takeaways
- Algorithmic trading helps automate the trading process and reduce emotion. By using coded rules, algorithmic trading systems can execute trades automatically, removing the need for manual trading decisions during fast market movements.
- Building an algo trading system requires understanding both coding and trading logic. Whether you use an algorithmic trading platform like MT5 or a custom Python setup, you need to grasp how algorithmic trading works to generate profits sustainably.
- Backtesting with historical data is critical before going live. Testing your algorithmic strategies on past historical data helps uncover flaws and ensures your strategy aims are realistic under different market conditions.
- Algorithmic trading can operate across multiple markets and asset classes. Advanced systems can monitor price differences in various financial instruments and asset classes, such as in stock trading, forex, indices, and more. This isuseful in high frequency trading setups that require quick reactions to market shifts.
- Even simple trend-following strategies can benefit from automation. Many traders start by automating straightforward trend following strategies to improve discipline and consistency in their trading decisions.
- High frequency trading (HFT) demands robust infrastructure and capital. Engaging in high frequency trading or any form of HFT means accepting high development costs and investing in reliable technology to maintain market stability during rapid market movements.
- Risk management and order sizing are the backbone of algorithmic trading success. Controlling position sizes and defining clear exit rules allows algorithms to execute trades without exposing your account to unnecessary risks when market conditions change.
- Algorithmic trading platforms simplify deployment. Platforms such as MetaTrader 5 (MT5) make it easier to build, test, and run automated trading strategies, even for beginners learning how algorithmic trading works.
- Automated trading can reduce errors compared to manual systems. By relying on code rather than emotions, algorithmic trading provides a structured way to buy or sell based on objective rules rather than subjective trading decisions.
- Consistent maintenance is key to long-term success in algorithmic trading. As market price dynamics evolve, your system must be optimized to adapt to new market conditions, ensuring that such trades continue to execute effectively over time.
Final thoughts: What algo trading taught me about myself
Trading system development has taught me to think in a clearer and more structured way before diving into the financial markets. Learning to approach algorithmic trading with a clear structure has made me a more disciplined and data-driven trader. Discipline is one of the most overlooked traits in trading, which most people fail to do, including myself at the beginning. Lastly, ensuring quality data in testing will also help to build a quality system, because the principle of ‘garbage in, garbage out’ also applies in the system development.
Once I had this system, I found that I traded less emotionally when following my chosen algorithmic trading strategies. This made every trade very mechanical and with less personal discretion. However, systems can break from time to time, so we still need to maintain them and tweak them as needed.
Ready to start developing a system for trading? I suggest you think like an empty glass of water because manual trading and experience may make us overrate ourselves. However, when we develop it in a mechanical way, it may disregard our skills and experience, as no personal judgment is involved. Finally, learning along the way will help to improve the system from time to time.