What Is Algorithmic Trading? Explained In Simple Terms.

It’s time to talk about it. What’s algorithmic trading?

I’ve been asked many questions related to algorithmic trading; here are some:

  1. Are there any advantages to trading with automated strategies? Why use algo trading?
  2. How can institutional and professional traders execute trades at super speed or make decisions based on complex mathematical models? Can I do the same? How? Is it expensive?
  3. How to code algo trading?
  4. How does algo trading software work?
  5. Is algorithmic trading free?
  6. Which algorithmic trading is best?

I am sure that you have many more.

In this comprehensive guide, I will explain in plain English the concept of algorithmic trading, its benefits, how it works, and a few practical tips to get you started. I will be leaving some trading strategies as examples for you to download at the end. Promise.

So, sit back, relax, open your mind and get ready to be transported to another dimension where we let the machine make decisions for us based on how we have trained them.

Let’s dive in!

Takeaways

Algorithmic Trading Definition: Algorithmic trading, also known as algo trading, automated trading, or systematic trading, is a method where trades are executed using pre-programmed instructions based on predefined rules and criteria. These instructions are typically written in specific programming languages like TradeStation EasyLanguage, MultiCharts PowerLanguage, Pinescript or Python, to mention just a few.

Advantages of Algorithmic Trading: The benefits of algorithmic trading include speed and efficiency, as computers can analyse and execute trades faster than humans. It also reduces emotional biases, allows for backtesting and optimization of strategies using historical data, offers diversification and risk management, and can lead to reduced transaction costs.

Risks in Algorithmic Trading: Despite its advantages, algorithmic trading comes with challenges, including market volatility and liquidity issues, which can lead to rapid price fluctuations and slippage. System failures and technology risks, such as technical glitches or software bugs, can also disrupt trading operations.

Common Algorithmic Trading Strategies: Some prevalent algorithmic trading strategies include:
+ Trend Following: Aims to capture profits by identifying and riding market trends.
+ Mean Reversion: Based on the idea that prices tend to revert to their average over time.
+ Arbitrage: Exploits price discrepancies across different markets or exchanges.

Tools and Resources: Success in algorithmic trading requires the right tools and resources. Essential elements include algorithmic trading software like TradeStation and MultiCharts, data providers and APIs for accessing real-time and historical market data, and continuous learning and adaptation to stay updated with market dynamics and technological advancements.

Algorithmic Trading: Understanding the Basics

Algorithmic trading, also known as algo trading, automated trading, mechanical trading or systematic trading, is a method of executing trades using pre-programmed instructions usually written with a specific programming language code.

For example, TradeStation EasyLanguage is a proprietary programming language created by TradeStation Security for its workstation platform.

These instructions are based on a set of predefined rules and criteria, which traders like you use to define trading strategies.

Now, let’s explore the fundamental aspects of algorithmic trading and its advantages.

Understanding the Basics

Simplifying the definition of how algorithmic trading works, let’s say that it involves using a computer program that executes trades on the basis of a set of rules predefined on your behalf automatically.

algotrading

These programs can utilize simple logic or more complex mathematical models, statistical analysis, historical data, time, etc., to execute trade orders in near real-time (if you don’t consider aspects like distance from the exchange where the trade is routed, for example).

The goal is to be more efficient in our trading activities and profit from market inefficiencies within a fraction of a second if you consider models like HFT (High-Frequency Trading). Something that only big institutional organisations with deep pockets have the luxury to benefit from. I am sure you’ve heard of HFT in the news or on the internet here and there.

For humans like me, the goal is to run a portfolio (multiple) of strategies automatically while I work on my 9to5 job.

The real edge (advantage) here is to increase your trading efficiency and take advantage of entering and exiting trades when the opportunity manifests itself. For example, while you sleep.

Manual intervention is minimized with algorithmic trading, and trades are executed automatically based on predetermined conditions. This has another advantage of reducing emotional biases often associated with humans, such as fear, greed or intuition and allowing for faster and more precise trade execution.

Advantages of Algorithmic Trading

Speed and Efficiency: One of the critical benefits of algorithmic trading is its speed.

Computers can analyze market data, identify trading opportunities, and execute trades faster than humans. It enables algorithmic traders to exploit more trading opportunities than manual traders can and leverage probability for a better monetary return.

Reduction of Emotional Biases: Emotions can significantly impact trading decisions.

By utilizing algorithms, traders can reduce human emotions in the trading process. This helps maintain a disciplined approach and stick to the predefined trading strategy without being influenced by market volatility or other external factors. Maintaining emotions under control needs some work, even in the world of automatic trading. The software assists us in dealing with dealing with emotional biases and does not eliminate the problem.

Backtesting and Optimization: Algorithmic trading systems allow traders to backtest their strategies using historical data.

This allows traders to test a trading strategy before risking real money and trading capital. Traders can also fine-tune their algorithms and optimize them based on the backtesting results to improve performance.

Important note on “backtesting results to improve performance”:

past performances are not indicative of future returns.

Diversification and Risk Management: Algorithmic trading enables us to diversify our trading portfolios across multiple instruments and markets.

By simultaneously trading in different assets, traders can spread the risk and reduce exposure to any single trade or market. Additionally, algorithms can be designed to incorporate risk management techniques – my favourite – such as stop-loss orders to limit potential losses or scaling in and scaling out methods to enter “gently” on certain trades before expanding your position only if possible.

Reduced Transaction Costs: Algorithmic trading can help minimize transaction costs by executing trades at optimal prices and volumes, potentially resulting in improved execution prices and reduced slippage.

The algorithms have the ability to “follow” the price more efficiently than a manual click for a trade execution. This is even more noticeable on lower trading timeframes, with charts on a minute bar, for example.

Keeping transition costs low is important for having overall healthy returns within your trading account.

Algorithmic trading is a powerful tool that leverages technology and data analysis to automate trading activities. By understanding the basics and learning how to take advantage of its benefits, traders like you can potentially enhance their trading strategies and improve their overall performance.

Getting Started with Algorithmic Trading

I want to explore and share what are the fundamental steps to get started with algorithmic trading.

Algorithmic trading, also known as algo trading or automated trading, refers to using computer programs to execute trading strategies.

What are the key components of getting started with algorithmic trading?

Choosing a Trading Platform

The first step in algorithmic trading is choosing a reliable platform with a trading strategy development environment.

This platform serves as the interface between you and the market. It should provide the necessary tools and features to test and execute your trading strategies effectively.

When selecting a trading platform, consider factors such as user-friendly programming language, robustness, availability of technical indicators, strategies and code examples and, most important of all, consider the compatibility and support that the platform has with the main brokers used by retail traders like us.

Below are some popular trading platforms that offer a wide range of features and are suitable for beginners, listed in order of friendliness [in my opinion]

I use the first two for my trading as I can code my strategies using EasyLanguage as the programming language and run on both platforms, allowing me to access more financial markets as I would be able to by choosing only one.

Setting Up a Trading Account

Once you’ve chosen your trading platform, setting up a trading account is next.

This involves creating an account with a brokerage firm that is compatible with your chosen trading platform. A brokerage firm acts as an intermediary between you and the market, executing trades on your behalf.

During the account setup process, you will typically need to provide personal information and financial details.

Choosing a reputable brokerage firm is a must, as it can reduce the risk of potential problems with brokerage firms going bust with our money, as happened with MF Global.

In the evaluation, offering competitive commission rates, reliable customer support, and a wide variety of financial instruments to trade are also important.

Building Your Trading Strategy

Now that you have a trading platform and a trading account (it is essential to have access to a paper trading account), it’s time to get crafting and start building our automatic strategies.

As said above, a trading strategy is a predefined set of rules determining when and how to enter or exit trades.

Where do I start? What would be the first thing I can do to get going?

Assuming that we have the necessary knowledge…

First, we should identify what edge (advantage) a trading instrument has and then choose a trading strategy that looks to take advantage of that edge. There are numerous trading strategies available, ranging from simple to complex.

As an example, let’s take the Forex pair GBP/USD.

Can we identify something that statistically repeats itself and take advantage of it, writing a trading system that follows those rules?

Yes, we can. And it’s not bad at all. This kind of edge is categorised as a BIAS in statistics. We’ll explore the strategy in the next section.

Alongside bias strategies, other common trading strategies include trend following, mean reversion, breakouts, and momentum trading.

When you are starting out, I’d advise you to adopt a “follow and learn” approach to get some experience in creating a strategy, testing it and running it live with real money.

Immediately, you will discover if you have a good feeling about the chosen strategy or if the strategy risk profile is right for you. An all-rainbow of emotions will surface as soon as you release your right-click button on your mouse to enable automatic trading on the platform.

At tradewithcode, we go deep into understanding and learning more about the different trading strategies with code examples and backtesting results – a benefit of joining the tradewithcode community.

After these initial steps of getting started with algorithmic trading, I hope you are ready to delve even deeper into algorithmic trading and explore more advanced topics such as backtesting, risk management, and optimization of trading parameters.

The Components of Algorithmic Trading

In algorithmic trading, three key components form the foundation of the trading process.

These components are essential for successful implementation and execution. Let’s explore each component in detail:

Data Analysis and Research

Data analysis and research play a crucial role in algorithmic trading. Traders must gather and analyze vast amounts of financial data to identify profitable trading opportunities. This involves studying historical price trends, market indicators, and economic data to make informed trading decisions.

This data-driven approach helps develop effective trading strategies that capitalise on market inefficiencies and generate profits.

Let’s continue with our GBPUSD example and find if any biases can be interesting to analyse.

Here at tradewithcode, we use a tool called data analyser to analyse huge quantities of data in a matter of minutes, giving us a sort of superpower.

If you are into Microsoft Excel and you know how to use it for data analysis, you can do those tests using Excel; it will take longer, but it is possible. A tool like Data Analyser speeds everything up and keeps things focused on what we need.

Below is the GBPUSD prices dataset analysis from the beginning of 2002 until mid-2013.

GBPUSD price data analysis with data analyzer

As we can see, there are two interesting bias windows between 2002 and 2013, where on a Monday and on a Thursday, for the 53% of the time, the price went up, and the price went down at a specific time of the day during the week.

It’s not as good as seeing the future, but we have a great advantage if we consider these terms.

Let’s validate if we can build a trading system with that information.

Building and Testing Trading Models

Once the necessary data has been collected, traders build and test trading models. These models serve as the backbone of algorithmic trading strategies.

EasyLanguage will be used to codify the trading model identified. Many other programming languages, such as Python or R, can be used to develop mathematical algorithms that execute trades based on predefined rules. I’m unsure for beginners if these are the right way forward.

I’ll stick with EasyLanguage for now as it’s more user-friendly and allows us to focus on other important aspects without being too worried about learning a complex programming language.

Before writing any code, I want to validate if what I have seen on the tool is sound! And it looks like it.

data analysis test

Our bias strategy has a win/loss ratio of 1.22 – this ratio indicates how many times a strategy will perform successful, money-making trades relative to how many times it will have money-losing trades.

During the testing phase, evaluating a trading strategy performance using historical data is a process known as backtesting. It helps assess the strategies’ profitability and robustness and allows us traders to refine and optimize trading models to maximize returns and minimize risks.

The backtesting of our GBPUSD Bias has a backtesting analysis with an uptrend result of the last 22 years, which means that the strategy in that period has made money.

data analysis backtesting performance

I very much like the results of this analysis, and now let’s code it and test it on a chart within the platform.

I used TradeStation for it.

The BIAS identified is defined in plain English as

Buy Monday @ 21:00, Sell Tuesday @ 01:00.

That’s it!

So if we bought 1 lot of GBPUSD currency pair every Monday at 9 pm EST and we had sold it back on Tuesday at 1 am EST every week for the last 20 and plus years, we could have seen the performance in the graph above for our strategy.

TIP: Be careful with the time zones as they change everything.

Here is the code in EasyLanguage:

//Buy Monday @ 21:00, Sell Tuesday @ 01:00

if dayofweek(date) = monday and time = 2000 then
buy nCon contract next bar at open;

if mp = 1 and dayofweek(date) = tuesday and time = 0000 then
sell nCon contract next bar at open;

Below is the equity curve result of the full strategy, combining both biases identified for the trading week of GBPUSD.

tradestation equity curve

The result shows a good potential for an interesting strategy in this category. More validation work is needed before putting it live with real money, but it’s a positive outcome.

If you’re interested in learning more about building and testing trading models, you can refer to our weekly workshop agendas, part of our premium membership, for comprehensive strategy development and techniques.

Execution and Monitoring

The final component of algorithmic trading is the execution and monitoring of trades.

Once the trading models are developed, tested and validated, we can deploy them to our “live” environments to automatically execute trades based on predefined rulesets and parameters.

This eliminates the need for manual intervention and ensures timely execution in fast-paced markets. Or, as in our case, at 1 a.m. at night if you live in New York (USA).

Automation doesn’t mean run and forget – the contrary. We, as traders, also need to monitor our trading algorithms to ensure they perform as expected in every situation and be timely in addressing potential machine issues due to the million factors we have no control over.

This continuous monitoring helps in adapting to changing market conditions and maximizing profitability.

By understanding and effectively utilizing these components of algorithmic trading – data analysis and research, building, testing and validation of trading models, and closing the loop with execution and monitoring – we have the opportunity to enhance our trading strategies and potentially achieve consistent profitability in the financial markets.

Risks and Challenges in Algorithmic Trading

Market Volatility and Liquidity

With trading and also with algorithmic trading, one of the major risks that traders face is market volatility and liquidity. This refers to the rapid and unpredictable changes in market prices and the ability to execute trades quickly and, more importantly, at desired prices.

During periods of high market volatility, such as economic crises or major news events, prices can fluctuate significantly within seconds. This can lead to slippage (the real enemy here), where trades are executed at prices different from the intended ones.

It is crucial for mechanical traders to have robust risk management systems in place to mitigate and handle potential losses properly during volatile market conditions.

I believe that risk management is probably the first element that every beginner should learn when they get into trading. I made the mistake of not caring too much about it, and I paid for it.

Today, it is a different story; my trading systems are set not to enter trades if volatility is too high for my trading account to handle if anything goes wrong.

That keeps me and my trading account on the safer side from extinction from trading.

Liquidity is another important factor to consider. It refers to the ease with which traders can buy or sell securities without causing substantial price movements. In illiquid markets, it can be challenging to execute trades as you won’t have anyone on the other side of the trade to buy at the price you want to sell, which may significantly impact the take-home profitability.

A very important aspect that we must carefully analyse when we decide to trade a financial instrument is its market liquidity and adjust our algorithms accordingly to avoid any negative effects on our trading strategies… or, more sensibly, don’t trade that market if the effects of slippage reduce the risk-reward ratio to a point that is not worth it the risk anymore.

We want to get in and get out easily from a trade and quickly transform the gains into cash so we can efficiently re-utilise it on new market opportunities.

System Failures and Technology Risks

Algorithmic trading heavily relies on sophisticated systems and advanced technologies. However, with all these techs involved come potential risks and challenges.

System failures can occur due to technical glitches, software bugs, or hardware malfunctions. These failures can disrupt trading operations and lead to financial losses. It is essential for algorithmic traders to have robust backup systems and disaster recovery plans to minimize the impact of system failures.

As crazy as it may seem to think in this way, it can be what can make the difference between surviving and getting your trading account wiped out because you couldn’t access your trading platform to manage the current open positions, or moreover, not being able to enter new trading opportunities because our systems are down. This can make a big difference in the year-end account review.

This is one of the most overlooked areas of algorithmic trading; it’s like an insurance premium…you hate paying it until the one time you ever need it saves you from a disaster.

Best Practices in Algorithmic Trading

Risk Management Strategies

Implementing effective risk management strategies in algorithmic trading is crucial to protect your investment and minimize losses.

One common approach is to set stop-loss orders, which automatically trigger the exit from a trade if its price reaches a predetermined level, for example. This helps limit potential losses and prevent emotional decision-making when market conditions are volatile.

Another risk management strategy is diversification. By spreading your investments across different asset classes, markets, and trading system correlations, you can reduce the impact of losses in one area. This ensures that your portfolio is not overly exposed to the performance of a particular security or sector.

Also, my favourite one is incorporating position sizing techniques, which can help manage risk.

You can control the potential downside by determining the appropriate allocation of capital for each trade based on factors such as risk tolerance, volatility and market conditions.

Risk management strategies protect your capital and add discipline to your trading approach.

Continuous Learning and Adaptation

Algorithmic trading is a dynamic field that requires continuous learning and adaptation. The more you acquire knowledge and experience, the more your way of trading changes and evolves, and the quicker you will become to adapt to market trends, strategies and technological changes.

Engaging in continuous learning involves reading books, attending workshops and webinars, participating in online forums and engaging with other members of the tradewithcode community to expand your knowledge. Understanding different trading theories, analysis tools, and market indicators and how to refine your trading strategies and make more informed decisions are fundamental skills that serious traders need to have.

Embracing a mindset of continuous learning and adaptation ensures that you stay ahead of the curve in algorithmic trading and maximize your potential for profitability.

[join the community]

Monitoring and Evaluation Techniques

To achieve success in algorithmic trading, it’s important to monitor and evaluate the performance of your trading strategies regularly. This allows you to identify any shortcomings or areas for improvement.

One way to monitor your strategies is through backtesting, which involves simulating your trading algorithms using historical data to assess their effectiveness. Backtesting helps determine if your strategies have a positive edge and if they can generate consistent profits over time.

Real-time monitoring is also crucial. By tracking the performance of your algorithms in live trading, you can identify any issues or anomalies that require immediate attention. This includes monitoring important factors such as order fill rates and slippage.

Remember, success in algorithmic trading is a continuous process of monitoring, evaluating, and making necessary adjustments to achieve optimal results.

Now that we’ve covered best practices in algorithmic trading let’s delve into another important aspect – developing effective trading strategies.

Common Algorithmic Trading Strategies

Algorithmic trading has revolutionized the way we approach the financial markets.

Advancements in technology and automated processes have opened up opportunities for traders to maximise profits and minimise risks.

In this section, I’d like to introduce three of the most common algorithmic trading strategies: Trend Following, Mean Reversion, and Arbitrage.

Trend Following

Trend following is a popular strategy in algorithmic trading that aims to capture profits by identifying and riding trends in the market.

The basic concept behind trend following is that once a trend is established, it is likely to continue in the same direction. Trading algorithms implementing this strategy will enter into long positions when the market is trending upwards and short positions when the market is trending downwards.

One effective tool in trend following is to use momentum indicators to identify trends as moving averages. For example, a 200-period moving average on a daily chart indicates where the trend is heading, even if the trend is lateral.

eurusd currency pair with 200 period moving average indicator to identify trends

By following trends, trading algorithms can potentially enter trades to profit from the momentum of the market.

Mean Reversion

The mean reversion strategy is based on the concept that prices tend to move back to their average or mean over time.

Algorithms implementing this strategy evaluate the prices when they deviate too far from their average, entering into positions with the expectation that prices will revert to their mean, allowing traders to profit from the price correction.

This strategy often involves monitoring the price movements of specific assets and identifying instances where the price has deviated significantly from its average.

AUDCAD MACD indicator to identify mean reversion signals

Usually, indicators that are in the oscillator category are used to detect the price divergence. The RSI and the MACD are the most common indicators in this category.

Arbitrage

Arbitrage is a strategy utilized by algorithmic traders to take advantage of price discrepancies across different markets or exchanges.

Algorithmic trading strategies simultaneously buy and sell assets in the same market (inter-market) or in different markets (intra-market) to profit from the price differences. This strategy requires quick execution and advanced algorithms to identify and exploit arbitrage opportunities.

Arbitrage opportunities can arise due to various factors, such as differences in supply and demand, exchange rate fluctuations, or inefficiencies in market pricing. By capitalizing on these price differences, traders can generate profits, spreading the risk across the entire arbitrage trade.

For example, we can automatically run arbitrage strategies on two different expirations of the same commodity future, such as crude oil (CL), and benefit from the price difference as I would sell the closest expiration contract and buy the in-the-future expiration contract.

Crude Oil CL arbitrage

Implementing these algorithmic trading strategies requires a solid understanding of the market dynamics, robust technical analysis tools, and efficient execution systems.

Tools and Resources for Algorithmic Trading

Having the right tools and resources at your disposal is essential for being successful with algorithmic trading.

In this section, I want to share some of the key elements you need to consider when it comes to algorithmic trading software, data providers and APIs, as well as online communities and forums.

Algorithmic Trading Software

When it comes to algorithmic trading, the software you use plays a crucial role in executing your trading strategies effectively. Numerous algorithmic trading software options are available in the market, each with unique features and capabilities.

A popular software is TradeStation, the creators of EasyLanguage, which provides a user-friendly programming language that includes a wide range of built-in technical indicators, strategies and charting tools. There are many advantages to choosing TradeStation as the trading platform is directly connected with their brokerage services, offering platform and trading accounts an all-in-one solution. The disadvantage is that they don’t support trading the Forex market anymore.

Another notable option is MultiCharts, which offers an EasyLanguage platform compatible with their own implementation called PowerLanguage – I’d say that 80% of the strategies you run on TradeStation can run on MultiCharts. The model of this platform is that you purchase a licence of it, and you can connect almost any broker of your choice. I use Interactive Brokers and connected with the MultiCharts platform. If you are into cryptos, the crypto broker Binance is an option to do that. The list of supported brokers is long.

The disadvantage is that you need to have a data provider and pay for it, a different broker and connect all of them together using the MultiCharts platform. It’s a less straightforward setup compared to TradeStation, for sure.

Data Providers and APIs

Access to high-quality and reliable data is paramount to making informed trading decisions. Data providers offer a wide array of financial data, including historical price, fundamental, and news sentiment data.

One prominent data provider is Bloomberg, which is very expensive and very well-known for its comprehensive financial data offerings.

Other data feed providers, iQFeed and TradeStation offer the same data feeds used in the TradeStation platform through their own APIs for accessing real-time and historical market data.

Conclusion

Let’s conclude with a bold statement.

Algorithmic trading is a fascinating and powerful tool that can greatly enhance the trading experience for beginners.

By leveraging advanced logic models and automated systems, algorithmic trading allows for faster, more accurate decision-making and execution of trades. It reduces emotional biases and human errors that often are the reason for many mistakes in manual trading.

I can stress this enough, and I will be repeating myself: successful algorithmic trading requires continuous learning, testing, and optimization. It is a dynamic and evolving field, and staying up-to-date with the latest trends and techniques is essential.

Please let me know what you would like me to cover in more detail from this beginner’s guide in the comment, and I wish you happy trading!

How Can Community Actually Empower You And Transform Your Trading The Right Way?

The Background Story…

Hey, I’m Gianluca. For the last 20 years, I have been writing software code for a living. Now I am here writing words explaining the reason why tradewithcode.com exists.

Also, I’ve been trading on and off for the last 12 years. I wanted to make money quickly and thought I was very good at it. 

Around March 2017, I bought $3K of Ethereum priced at $19 and sold it two months later, making a whopping 233% – what an idiot 😒. Patience wasn’t my best quality; the “quickly” part of why I was trading didn’t help either. 

I had to find a way to keep my urge to tinker, change, and adjust my trades only to what was happening at that specific moment. The need to keep following my trading plan without me and my emotions being involved in the action, was a MUST. 

Long story short. I started trading with code. I have been doing it for the last six years.

Takeaways

Emotional Trading: Many traders make impulsive decisions based on emotions, leading to significant losses. Emotional control and discipline are crucial for success.

Education is Key: A lack of knowledge and understanding of the market often results in poor decision-making. Continuous learning and seeking education in trading strategies, risk management, and market analysis are essential.

Risk Management: Not managing risk appropriately can result in substantial financial losses.

Realistic Expectations: Many traders enter the market with a gambling mentality and unrealistic hopes of quick profits. A long-term perspective and understanding that trading requires patience, strategy, and time is essential.

Community-Led Learning: Engaging with the tradewithcode.com community allows traders to share experiences, learn from one another, and get support. Being part of a community can fast-track the learning process, provide valuable insights, and reduce feelings of isolation often felt by solo traders.

I’ve chosen to learn EasyLanguage for coding my trading strategies. It looked simple and supported, with a forum where to ask questions behind it – and one of the people I respect and admire as a trader uses it for everything trading.  

So let’s get into it. Here is what happened. 

I bought a couple of training courses to understand the language’s gist and what to do with it. Somehow, it worked. I could write simple strategies and make them do something on the chart. I learned about Mean Reverting strategies and how to code them.

I still have the code for those strategies on my hard disk.

EasyLanguage code with a revearsal strategy

Here is a quick explanation of the code:

  • The line at the top: buys the financial instruments (underline) next bar (on a daily chart) at the highest price of the day before,
  • The line at the bottom is the exact opposite: sells the underline instruments next bar (daily) at the lowest price of the day before
  • PS: don’t worry about the “limit” word for now. We’ll talk about it soon. I didn’t understand it either back then.

I picked the Forex market to test if the code was working as expected, and as I live in London (UK), I went for the British Pound and the Japanese Yen (no reason) currency pair – or “Guppy” in short 🤔.

Yes, currency pairs in the forex market have nicknames! Who knew?

Data-driven Discovery

Assuming that everybody knows or understands what a reversal movement is, I won’t dive deep into it, only to say that it’s a zig-zag movement with or without a trend. 

Simplistic definition, but I hope that’ll do. Look at the shape of the movement below.

infographic that shows the zig-zag movement of a reversal movement with trends

Below is the GBP/JPY Chart up to December 2018. 

Do you see the same?

This is what I saw from left to right:

  1. Significant uptrend at the beginning,
  2. A massive downtrend in the middle, 
  3. Almost no trend at the end. 
  4. In all these three phases, reversal movements throughout.
Tradestion Security Chart for GBPJPY currency pairs

Testing my simple reversal strategy would be a walk in the park.

Here it is. 

Every white mark is a trade that the strategy has done in that timeframe (from January 2011 to December 2018), and the platform I used has done all the heavy lifting for me in seconds. 

I use the TradeStation platform with the TradeStation Development Environment (TDE) to code with EasyLanguage (EL). 

MultiCharts is another platform that correctly interprets and runs the EasyLanguage code structure and reserved words due to its PowerLanguage coding framework (as it is based on EL). 

gpbjpy graph with a trading strategy result on Tradestation Security Platform

Now what? What do I do with it? Does it work? Will I be able to make money trading? Lots of questions.

It didn’t work.

Tradestation performance grapth of the reversal strategy written in EasyLanguage

The simulation result on a daily chart from 2011 to 2018 shows what I believed I saw on the chart was utterly wrong. 

The trading system has lost money in the last four years, which aligns with points b) and c) when looking at the chart. Massive downtrend and flat direction at the end.

Mmmm, okay. 

I decide to go nerdy and look into the data I have available from the platform, lots and lots of data from average winning trades to gross profit and info about profit factors and the number of trades.

8,527 trades in 4 years 😱 – can a human manage and handle that number of trades in such a short period? I doubt it. [the machine can]

Tradestation Performance Summary of an EasyLangauge reversal strategy on GBPJPY with number of trades

Here is the problem. 

This is not high-frequency trading, where trades are open and close in seconds, if not milliseconds. That way of trading is so far away and expensive for what I can do.

I kept digging deeper into the data. 

This problem is a good learning exercise and understanding of what we are dealing with. 

If I want to put those strategies live with real money, I need to have control of what’s going on, and I want to know the why of my strategies’ behaviour.

I spent days trying to make sense of the available data. The majority of the time was spent “scavenging” the internet and forums for good pieces of information that could give me answers to the million questions I had – a very challenging task.  

For a beginner like me, it was like drinking from the firehose. Too much-unstructured information that made no sense, and it was painful trying to understand all of that alone. 

Am I not the only one who has felt frustrated and overwhelmed while learning something new?

Is there a better way to learn all this, taking the frustration away?

little girl struggling to drink water from the hose

As a software developer, I knew the drill and what to expect. 

I had experience unpacking similar situations with my day job and started debugging the strategy components in isolation. Not everybody is a software developer. So what do we do? More on that soon.

As a result, I found lots of trades were entering and exiting within the same day (🚩red flag) and at the same price (another 🚩) within the data of my performance report.

Trade list of the EasyLanguage Strategy that shows the problem with trade entries and exits

The code I wrote was wrong! 😭🤬

My coded strategy was telling the machine to buy today – rather than sell for reversal – at yesterday’s highest price. The opposite was on the sell side of the command. I told the machine through code to do it – my fault.

The corrected code is below.

EasyLanguage code with a revearsal strategy

Did it work, then? 

Is GBPJPY currency pair tradable with reversal strategies?

No. Reversal strategies don’t work on GBPJPY, was my finding. 

Now what? Keep going, my friend.

I wrote another strategy to test if the nature of this currency pair has more of a trend-following or breakout nature. It is just the opposite of having a reversal behaviour. (I then later learned that it’s the nature of these currency pairs to be predominately breakout instead than reversal)

What do you think? 

Tradestation Performance Graph of a breakout strategy on GBPJPY

The equity curve is not pretty, but it goes up; we are not losing money at the end of the eight years. Even the number of trades comes down to less than 1800. It’s a start. It took time. 

Now the actual work of strategy development can start.

We have some data-driven information to help us to define the context and narrow down what we are dealing with. No technical analysis, no underline fundamentals, and no macroeconomic research. 

I was unlearning what I knew about trading and shifting to a new paradigm based on pure data. All were based on a financial instrument’s behaviour. 

My view of the trading world has changed since then. I never looked back.

I could share at least fifteen more other experiences like this one, and every one of those has something in common:

  1. I was alone in figuring out how to solve my problems – lots of trial and error involved. I asked a few questions on solving an issue with the platform and got an answer two years later 😱. Not very helpful.
  2. The amount of information that I found online was staggering, daunting even. The tiny amount of what was actually valuable to me, was even more scary.
  3. I had to put the work in to master it; I couldn’t just buy a similar strategy and run it. I wasn’t in control, which didn’t work for me.

Transforming Challenges into Opportunities with Tradewithcode.com Community. 

As algorithmic trading newbies, we face challenges. 

Stacking a few of them up… 

  1. the learning of a new programming language to perform trades with real money (that we don’t want to lose);
  2. trusting the algorithm that we have built to do what we wanted it to do;
  3. making sure that our trading theory/idea about the strategy has an edge (advantage) that we can “exploit”.

…are nothing we can master by reading a book or watching a youtube video.

It requires time, dedication, and a method that works for you. We can do it ourselves and go through the long and painful process, or perhaps here is an alternative??

You can actively be part of a community of people that can support and share knowledge with others along the way. 

No matter where you are on this journey.

There is no guru here, just people willing to learn from one another and share taken notes and experiences while having each other’s back.

Tradewithcode.com empowers and enables individuals to create financial freedom by fusing trading and code. 

Together.

This is a tremendous opportunity to jump-start on the right path to trading with code mastery and avoid at least the costly common mistakes other before you have made.

My commitment? I am here to set up and serve the community. Your active contribution will make it a success.

A Crazy Statistic to Wrap Things Up.

You have heard it already. 90% of traders lose money in the first year.

Not the statistic everybody likes to read. 

I am not a fool. Trading the financial market is a sum zero game; one side of the trade wins while the other loses. 

According to data compiled by VandaTrack Research, the average retail investor portfolio (this is us) has experienced a downturn of around 27% since November 2021, despite four double-digit bear market rallies and two significant rallies in tech stocks.

Emotional trading is a common reason for traders losing money, as the highly emotional nature of trading makes it challenging for many to remain objective and disciplined in the face of market volatility. 

☝️ One of the many reasons to go automatic. 

We won’t be able to remove the emotions from it. I wasn’t able to. We are humans, and we have emotions. 

To control our emotions better, we need to build confidence in what we do and what we know through data-driven research, testing, debugging, discussions and building a comprehensive trading method that fits your need and your personality. 

This community has been built with that in mind.

Also, you’ll have access to the following:

  • live workshops with practical and actionable topics, online courses and discussion spaces to give you the best education about writing your strategies using EasyLanguage,
  • a trading blueprint process to build confidence and address overtrading and lack of discipline,
  • an in-depth risk and money management section to be ready to handle crazy market volatility and potential loss of money,
  • A behind-the-scenes view of what it means to be an algo trader to have more aligned and realistic expectations and avoid a gambling mentality.

Now, in pure community spirit, it’s your time to share.

A Question For You.

Almost every blog post finishes with a call to action that offers readers a button to subscribe to something and offer any special promotions for events to new members.

I won’t do it here on this post – the first one.

I am asking you a question instead. Please use the comment section below to share your thoughts, or if you wish, contact me directly at gianluca@tradewithcode.com.

What would be the one thing you wish or wished to know to make your trading learning curve more gentle? What could our community do to support and help you better on that journey?