3 more trading strategies to level up your trading
Hey everyone! My name is Julian, and I’m an intern at lemon.markets 🍋. We’re a start-up offering an infrastructure to let developers create their own brokerage experience at the stock market. A while ago, we shared an article with three beginner-friendly trading strategies because we noticed that some of our users needed inspiration to get started. Today I want to dive into three additional trading strategies. In this article, we’ll cover Swing Trading, Intermarket Analysis and (Deep) Reinforcement Learning. Be ready to learn and enjoy reading this blog article. Let’s learn together!
The many facets of algotrading
Algorithmic trading is more relevant than ever: approximately 60–73% of overall US equity trading is powered by algorithms. While we cannot know exactly what’s behind every single algorithmic trading use case, we can still try to categorise different approaches.
Algotrading involves placing orders using automated, pre-programmed trading instructions accounting for variables such as time, price and volume. Harnessing the speed and computational power of computers is a huge advantage in algorithmic trading, especially compared to human traders. Algorithms can also be based on one or more well-known trading strategies. Common types of algorithmic trading strategies involve technical analysis, market correlations and/or machine learning.
Technical analysis allows you to predict the direction of prices by studying historical or current market data. It’s a flexible strategy because you can apply it to any trading instrument and any timeframe (long term/short term). Beware to not rely completely on predicted prices because the “real” future is not necessarily dictated by past data.
By studying market correlations, you can measure how certain assets move in relation to each other. Some traders choose to establish these relationships and base their future trades off of them.
And, finally, you’ve probably heard of machine learning. It’s a beloved field for data scientists. It furthers the automation of data processing by creating a model that outputs predictions of future price movements based on training data. In the trading context, this training data is usually historical market data, but it can also be based on fundamentals. Machine learning, once implemented, can be a huge timesaver and might identify patterns that the human eye cannot identify.
Of the following strategies, one is based on technical analysis, the other one is focused on market correlations and another one relies on machine learning. Can guess which is which? Be free to share your thoughts in the comments!
The first trading strategy we are going to tackle is swing trading. The idea is to focus on profiting out of changing trends in price action over short timeframes (= small gains, quickly). You literally swing from one value to another through the asset’s price, that is why it is called “swing trading”. These trends can be identified through technical analysis, in other words, looking for patterns in candlestick charts.
In the following figure, we can see several opportunities for swing trading. Those opportunities are based on ‘swing lows’ and ‘swing highs’, which form the trend of the chart, in other words: buy low, sell high. Usually this technical analysis is based on hourly candlestick charts, but other popular options are daily, weekly and monthly charts.
Buy low, sell high: Capture the bottom of pullbacks (‘swing lows’) and hold onto a position until ‘swing high’
Take a look at the evolution of Apple daily share prices from July 2021 to March 2022. I’ve annotated the chart below with blue lines, these represent the above-mentioned trends between swing lows and highs. It’s a good example of how swing trading can help you not fall completely down in the chart flow, but still continue to increase with new higher prices in the next swing. The gains might be smaller, but if done consistently over time they can compound into excellent annual returns.
Daily candlestick chart for Apple stocks, data collected from TradingView
Besides looking at price movements of an asset you’re trading, you can also employ different technical indicators to inform your swing trading decision. Technical indicators are usually mathematical calculations based on an instrument’s characteristics (e.g. price or volume) to predict future performance. There are tons of available indicators to choose from, but in a Swing Trading context the Stochastic Oscillator, MACD (Moving Average Convergence Divergence)or RSI (Relative Strength Index) are frequently used.
Why swing trade?
Imagine you’re Tarzan swinging through a jungle. The vines represent the instrument you follow, let’s say you want to buy Apple shares. You choose to buy the stock at its three-month low. Now you wait until the stock price achieves its three-month high. It’s time to sell and gain the most profit out of it. You’re the king of the jungle now. Swing trading would be a good start if:
- you’d like to trade without spending too much time looking at charts;
- your goal is to maximize short-term profit potential by capturing the bulk of market swings
- you want to rely on technical analysis & simplify the trading process.
The next trading strategy we want to look at is Intermarket Analysis. The analysis is done to help determine the strength or weakness of an asset class. This is done by analyzing the relationships between four asset classes including stocks, bonds, commodities and currencies. That’s also called cross market analysis. This concept was first introduced by financial market analyst John Murphy.
Again, you compare relationships between different markets or stocks e.g. in terms of financial crisis. There are relationships between stocks and bonds, bonds and commodities, and commodities and currencies. Using Intermarket Analysis can potentially help you predict the future direction of financial markets. It’s like a matchmaking process with stocks, your analysis is based on the evaluation you deliver in terms of the relationship between two stocks. The evaluation is done by categorizing stocks to different ‘strength stages’ like weak, medium or strong.
Strength depends on the economy cycle which is shown here
The strength of stocks depends on an economy cycle that typically repeats the Expansion-Peak-Recession-Trough process. The intermarket relationships change overtime and don’t last. With that in mind, the cross market analysis comes in. The relationships between certain stocks can provide insights into when a new trend is starting or help chartists determining the stage of the economy cycle. Investors get support in deciding whether they take existing positions or enter new positions to profit from a trend change. The change of economic conditions may lead to changing correlations.
Correlations in a nutshell
Correlations have positive and negative developments. Most investors use correlations to analyze the intermarket relationship between one variable (e.g. USD value) and a second variable (e.g. JPY value). If you open many positions that are positively correlated (+1.0), you’re increasing your risk exposure. The opposite happens if you open positions that are negatively correlated (-1.0). If the relationships of both markets move from positive to negative, it would show that the relationship between the two variables is unstable and cannot be relied upon providing trading direction. Not too complicated right?
Why do intermarket analysis?
Imagine using intermarket analysis like Tinder: you want to find the perfect match between two variables and you evaluate the strength of the relationship. If this match leads to a negative relationship/correlation, you’d like to swipe left for the profile. Intermarket analysis would be a good start for you if:
- you want to identify the stage of the economy cycle, along with best-performing and worst-performing asset classes;
- you’d like to compare two different data collection methods and see the benefits from looking at relationships between different classes of assets.
(Deep) reinforcement learning
The third strategy I want to discuss is called deep reinforcement learning and it’s a combination of reinforcement learning (RL) and deep learning. As a subfield of machine learning, deep learning is concerned with algorithms that form a neural network which is inspired by the structure and function of the brain. Reinforcement learning is another machine learning method which is based on maximizing rewards in particular situations to take behavioral actions. Combine artificial neural networks with a framework of reinforcement learning and you get ‘Deep Reinforcement Learning’.
Deep Reinforcement Learning incorporates deep learning into the solution, allowing agents to unite function approximation and target optimization, mapping states and actions to the rewards they lead to. A method to add deep & reinforcement learning is SAPT by including pairs trading as an add-on.
Introducing SAPT: a solution for deep reinforcement learning
This approach is made up of a two-phase pairs trading strategy optimization framework called SAPT (structural break-aware pairs trading strategy). Phase 1 shows a hybrid model extracting frequency- and time-domain features to detect structural breaks. In addition to that, Phase 2 is characterized by optimizing pairs trading strategy with sensing important risks, including structural breaks and market-closing risks, with a novel reinforcement learning model. The transaction cost is factored in a cost-aware objective to avoid significant reduction of profitability. See the stock market as a poker tournament, you don’t want to go home with empty pockets because of a bad strategy in these games.
Financial markets are complex without a doubt, the nonlinear characteristics of stock price may not meet the statistical assumptions or our general predictions. To this day, deep neural networks have been exploited to forecast stock prices or detect outliers. Several studies improved the tolerance by utilizing neural networks to alleviate the effect of noise and uncertainty. Especially reinforcement learning models have shown great performance in optimizing trading decisions in the financial domain. (You would get an unfair advantage in poker with machine learning skills.)
This topic contains a huge range of complex decision-making tasks that were previously out of reach for a machine. Pairs Trading can be indirectly associated with this method (we already talked about Pairs Trading in a previous article). However, due to rapid market changes it may break the relationship which further leads to tremendous loss in intraday trading (be careful!).
Why implement deep reinforcement learning?
Combining Deep Learning and Reinforcement Learning makes machine learning even more effective & precise in predicting future developments of financial instruments. If you know how to implement a Deep Learning bot with a neural network system and also think of reinforcement learning to maximize your rewards/values, you should at least try out to combine these both to get the best experience out in machine learning. Trying to combine both would be a good task for you if:
- you are curious about solving higher class problems;
- you are willing to achieve long-term results which are difficult to achieve;
- you are convinced that the only way to collect information about the environment is to interact with it.
Implementation with the lemon.markets API
Our API delivers the opportunity for you to implement the strategies mentioned above by actually using them with our data.
The lemon.markets API is the perfect tool to implement swing trading. You can try it out by retrieving historic market data on a per-minute (M1), per-hour (H1) or per-day (D1) basis and get the latest quotes for specific instruments. This information can be used as-is, or it can be processed with a relevant Python library, such as TA-Lib which can be used to compute 200+ indicators. You can then use the lemon.markets API to automatically place your order, or you can opt to send the signal directly to the user.
You can also implement Reinforcement Learning for Trading in Python or Jupyter Notebooks by working with a trading environment like lemon.markets or Gym Anytrading . For that, you need to train a trading bot with reinforcement learning which is part of the stable baselines package (research for more hints by visiting stable baselines’ documentation). If you want to analyze the data with a chart, you must know that libraries like numpy, pandas or matplotlib are necessary for the essentials in analyzing data through coding. In the end, you have to load trading data for training the bot.
After implementing the reinforcement learning, it’s now time to add deep learning into this context. Implementing deep learning with the Keras library would be a good first step if you’re new to machine learning.
Every first step into something unknown is always the hardest step. I hope I could inspire you & shared value in designing your first or next strategy. Perhaps try mixing them altogether in a similar way you would do in the kitchen by cooking a soup. 🥘
We’re looking forward to seeing what strategies you implement. If you have any questions or if you just want to share some thoughts (maybe about this article), do not hesitate to leave a comment or reach out to us via email@example.com. And if you haven’t signed up yet, do that now!
You might also be interested in
Blog 38 - The market maker explained
Market Makers are crucial to provide liquidity to stock exchanges. In this blog post, we talk about what Market Makers do and why they are useful.
5 (+1) YouTube channels for FinTech enthusiasts
YouTube is a great way to learn about new things, including financial education or coding. Therefore, in this article we’d like to introduce you to 5 YouTube channels to level up your trading literacy.
A short introduction to derivatives
In this article, we'd like to introduce you derivatives - they come up in finance and leave a lot of people scratching their heads, though it's totally worth it! Curious about hearing what's the difference between investing and trading, the coherence between finance and weather & why the Greeks even appear here? We'll discuss who’s using them, what they are and how they can be valued in the following.
Find more resources to get started easily
Check out our documentation to find out more about our API structure, different endpoints and specific use cases.
Join lemon.markets community
Join our Slack channel to actively participate in our community, ask questions to other users and stay up to date at all times.
Interested in building lemon.markets with us?
We are always looking for great additions to our team that help us build a brokerage infrastructure for the 21st century.