Trading strategies originate from some kind of the past experience accompanied with ideas for the future. Let's think of the challenge of building a strategy in the following terms
- Data. There's a list of historical candles. For each candle, we already know how the price has changed after.
- Labels. For each candle of the data set, we already know whether we'd want to enter the market back then. So we know where our “ideal signals” existed in the past.
- Inputs. There's a list of numeric parameters (like values of RSI, or "1 candle price change%" and such) which we suspect to be relevant when describing whether a candle should be an entry signal or not.
If base terms are defined like that, then the goal of building a strategy boils down to discovering something which can take p.1-p.3 and generate you instructions for what to do and when. In its simplest form, these isntructions are signals for entries and exits.
The way traders typically solve this challenge is by figuring out the strategy based on rules, explicit or vague. That is, a strategy which is somehow originating from past experience and which is somehow defining whether “now” is the time for entering or exiting the market. This article is limited to strategies with explicit rules. Moreover, for simplicity, this article is also focusng on fixed Reward/Risk strategies only, which means that we can skip questions of "when to exit" completely.
Algorithmic strategies: rules of a play stated clearly
Algorithmic strategies strictly define rules for when you enter and when you exit. Hence the word “algorithmic”. However simple or complex is, the set of rules of such a strategy is finite and defined. MA golden/death cross strategy is one example, when you buy on short MA crossing over the long MA and sell at the opposite.
Challenges of designing an algorithmic strategy are plenty. Imagine an average trader in their second year of trading, which is when people typically discover that they need a strategy (and that what they called a “strategy I follow” was neither a strategy nor a following). Here’s what they will go through.
The first step of designing a strategy might look like defining what are the market conditions you would want to benefit from. Buying the dips? Catching reversals? Riding established trends? You name it.
Next, you’d typically use indicators or other metrics as a medium, for the purpose of formalizing “when to enter”. For example, if you’ve decided to ride established trends, then you’ll need a way to define whether there’s an established trend at a given candle. How would you do it? Short MA above the long one? Momentum climbing? 7 higher lows in a row? The challenge of formalizing your expectations is significant.
Once done, you need to make sure that your formalized conditions actually identify the right cases on your charts. You also need to estimate how often they are wrong. Overall, you need to assess the quality of your definition of when you want to participate in the market.
And we don’t even talk about designing the exit conditions. These can double the complexity of the task at hand.
Machine learning: save labor, get a black box
Machine learning strategies should still be strategies, meaning they define when to enter and exit. In order to apply a broad concept of machine learning to trading and make it practical, we’ve made quite some opinionated decisions. The text below should not be taken as an ultimate truth applicable to everyone. It’s just about how TrendSpider does it.
Challenges of designing an AI strategy are plenty. But they are all different from challenges of designing an algorithmic strategy. You should simply pick your poison. In general, running experiments using AI strategies costs you less effort and happens faster. But you pay for that with being unable to know why exactly every signal is generated.
In algo strategies, you decide what you should use for your signals (like, SMA) and how exactly should it be used to yield signals (like, SMA20 crossing SMA50). This costs you labor but gives you control. With an AI strategy, you skip the How” part. You don’t have to define what exactly should happen to a given set of indicators in order for you to get a signal. But in exchange, you typically don’t know why exactly your AI model gives you a signal at a given candle.
This limits your capabilities for improving your AI strategies. For example, with an algorithmic strategy which gets chopped on a sideways market, you might introduce an additional filter to your entry conditions, to simply avoid entering during the sideways market. With a pure AI approach you can’t do that. On TrendSpider, you can work around that if you want, by combining AI and algo, but that’s for later.
This kind of a difference dictates a slightly different workflow with the AI strategies. Think of AI strategies as cheap experiments. If an experiment is bad then you either build up on it and try a slightly different option, or forget about it and you’ve just wasted 3 minutes. If an experiment seems promising then you build up on it, trying slightly different input parameters, or trying different model types, hoping for discovering a model which generates "more of good signals" or "signals of higher quality".
Workflow of building strategies
Here’s the comparison table illustrating the difference in some key moments.
Algorithmic strategies | AI strategies |
---|---|
Decide for yourself, what are the market conditions you would want to benefit from. Example: "I want to ride an established trend". | Show examples of cases when you'd want to participate in a given market. Example: "Here are 10 examples from the past where I'd want to enter". |
Identify mediums (indicators) and also define how exactly to use them in order to figure whether it's time to enter. Example: "Enter when SMA(20) crosses up SMA(50)". | Identify mediums (indicators) which might be relevant to when it's time to enter. Some of them might be not relevant, that's ok. Example: "Let's see whether RSI(14) and RSI(7) help to identify my desired signals". |
Define exit as a fixed set of a take profit and a stop loss (we assume fixed R/R strategies). | Define exit as a fixed set of a take profit and a stop loss (we assume fixed R/R strategies). |
Run backtests or eyeball charts in order to see whether the rules you've formalized actually identify the moves you wanted to identify. | Run the machine learning process in seconds to minutes, in order to figure whether your assumption concerning predictive power of your indicators is horribly wrong or not. |
If your conditions seem to make sense, then backtest the strategy in order to figure its personality. | If your inputs seem to make sense, then backtest the strategy in order to figure its personality. |
Weed out bad entries. Either avoid them by tweaking entry criteria, or kill your losers early by manipulating your stop loss, but it might be a bad idea for a fixed R/R strategy. | You can't weed out bad entries, in any way other than building a new AI strategy or adding algo conditions to your strategy. You still can kill losers early though, by manipulating your stop loss, but it might be a bad idea for a fixed R/R strategy. |