Introduction
As aspiring traders, we eventually encounter the term “edge” in our trading journey. Many people talk about it and claim it is the foundation and condition for being profitable in the long term. But what exactly does this term mean? When exploring the landscape of trading influencers on social media, the concept of “edge” often remains vague, frequently lacks real evidence, and is sometimes used so extensively that it’s challenging for new retail traders to develop a clear understanding of it.
To help you, we will delve into our understanding of a trading edge and illustrate the process of generating a real edge using a practical example.
Basic Understanding of Markets and the Role of a Retail Trader
Before we can discuss the trading edge, we need a fundamental understanding of how markets operate and, more importantly, what role you, as a retail trader, play. We need to accept a series of facts that we must take for granted. The sooner we come to terms with these, the better.
Hard Facts About Trading
The Market is Partially Random
You can be the best trader in the world, yet there will always be trades where you end up on the losing side despite perfect analysis and execution. Unlike many trading influencers might admit, the dynamics of markets include a myriad of inputs and information that a retail trader can never fully grasp and process. Additionally, as a retail trader, you’re at a disadvantage and constantly at risk of becoming a pawn to the big players. When a big institution suddenly decides to market dump, your trade, even if based on one of your A-setups, will be shattered.
“Trading is a game of probabilities, not certainties.”
The Market Doesn’t Care About You or Your Feelings
The first fact leads us to the second. Trading, especially for new and aspiring traders, is exciting but often incredibly frustrating. The reality is, you will get knocked down repeatedly. The market does not care at all. Some traders fail to accept this reality because they become emotional. It’s crucial to accept the relentless nature of the market and not let it affect your emotions. Emotional involvement will lead to the biggest losing days. We all know how it goes. Accept the market for what it is: it just does what it does. It has no obligation to give you anything back and can take more than you have.
“The market can remain irrational longer than you can remain solvent.”
Defining and Generating a Trading Edge
These market facts are important because they shape our understanding of an edge. If markets are somewhat random and one of the biggest threats is emotional involvement, it makes sense to have a trading strategy that addresses these issues. This strategy is what we describe as an edge. Specifically, we believe in a statistical edge that combats market randomness and human emotional involvement.
Battling Market Randomness and Emotional Involvement with a Statistical Edge
Randomness implies both winning and losing. There is no way around this fact, so we need to ensure we come out on top of this equation—meaning more wins than losses. We achieve this by analyzing probabilities of repeatable patterns. This process can be described as follows:
- Observing the markets for repeatable patterns
- Backtesting detected patterns over a long period and large data sets
- Implementing the edge into a trading strategy
Observing and Backtesting Market Patterns
We have all noticed patterns in the markets where we think: “Hey, that pattern seems to work; it might be an edge. Let’s try it for a bit.” This is a naive way of thinking about an edge. To truly develop an edge, you need to backtest it. Not just by looking back a few days manually but with extensive data to confirm it is a valid edge. Otherwise, you might fall into the trap of an observation that is a statistical anomaly—it might work for a few days but fail over a longer period.
There are multiple ways to backtest. At boostyourcharts, we use the Sierra Chart environment with our ACSIL coded backtesting strategies. For the sake of this article, let’s dive into a practical example of backtesting a statistical edge which you can use for your trading strategies.
Example: Backtesting Pattern – Breach Probability of Double Tops in Crude Oil
Suppose you are an intraday trader and have observed that double tops on a 5-minute chart in Crude Oil early in the session often get breached within a single trading day. You want to backtest this to develop a valid statistical edge. This way, you would know it isn’t a good idea to go short when there is a double top formed—valuable information to minimize errors and losers, thereby maximizing winners.
Our first step in coding the backtesting strategy to run over large data sets (2000 days) is to ensure our logic is correct:
- When there is a potential double top formed (the highs of two 5-minute bars are equal to the recent high of the day) within a preset time range (we will examine double tops in the early session from 09:00:00 to 10:00:00 RTH).
- Check if the price retraces a certain amount. If it does, confirm the potential double top as a valid double top.
We implement the retrace condition because, otherwise, double tops would be counted as valid when the price is still hovering a few ticks below the recent high. Our intention is to see a retrace that gives us room to potentially profit from it. In our example, we set the retrace to 0.3 basis points. To put it into perspective, the average daily range for Crude Oil in the last 90 days is 1.34. Therefore, we are backtesting a 22.4% retrace of the average daily range.
Here is a snippet of that logic:
Now that we have coded our strategy, let’s go into the charts and check if everything works as intended.
- Yellow bars mark potential double tops, meeting our first condition inside the logic.
- Green dots mark confirmed double tops, meeting all of our conditions inside the logic.
- Orange dots mark breached confirmed double tops. All double top events marked with dots are used for our breach probability calculations.
You notice that on June 24th, we also have some yellow bars without dots. These potential double tops don’t meet our conditions. None of them meet the retrace condition nor the time range condition and therefore are not included in our calculations.
After manually confirming our logic inside the charts, we can let it run over bigger sets of data and start our probability calculations. Later in the code, we implement the logic of detecting breaches of double tops to conduct a statistical analysis by counting the total number of double tops versus the total number of breached double tops within a day. Here are the results our backtesting study outputs in the message log:
2024-07-01 07:22:50.692 | Chart: CLU4.NYMEX [CBV] 5 Min #22 | Study: Oil Double Tops | Double Tops: 99, Breaches: 72, Breach Percentage: 72.73%
Reflecting on the Backtesting Results
Now we know that double tops formed on a 5-minute Crude Oil chart from 09:00:00-10:00:00 New York Time with a retrace of at least 0.3 points have a 72.73% chance of getting breached within the same trading day (2000 days backtested).
How can we use this information? Well, you shouldn’t just immediately go long every time there is a double top. To utilize this kind of statistical edge, we need to understand a few things.
The breach percentage of 72.73% includes all double-top events with a retrace higher than 0.3. Therefore, the probability for retraces exactly at 0.3 is likely higher, while retraces higher than 0.3 will have a lower probability of breaching the double top. The 72.73% result is the average of all retraces ≥ 0.3. We backtest this way because there wouldn’t be enough data otherwise. As you can see, the sample size of 99 days (for retraces ≥ 0.3) is not the highest considering we are backtesting over 2000 days. While 99 is sufficient for statistical analysis, the larger the sample size, the better.
Further Considerations
To increase the sample size, we could extend the time range in which we backtest for double tops. Instead of 09:00-10:00, we could test 09:00-11:00. We could also examine probabilities for different times of the day. For example, is it more likely to breach tops during the lunch break? What about tops formed near the end of the session? One might argue that double tops near the end of the session are less likely to be breached because there’s not enough time left in the trading day. However, by backtesting, we can determine until what time of the day the statistical probability remains significant for an expected breach.
We could even apply the same logic to double bottoms, simply mirroring the conditions. These are just some further considerations but won’t be covered in this blog post as it would be too extensive. The primary focus here is on describing the process of generating a statistical edge.
Implementing Statistical Edge into Your Trading Strategy
Knowing how to use these backtesting results and implement them into your trading strategy is the final step where the money is made. At boostyourcharts, we are primarily contextual day traders utilizing statistical edge for our trade ideas. Of course, there’s much more to it than relying on a 72.73% probability and immediately going long. Not only are there many more statistics to track other than double tops. Also, when actively acting on these statistics in the markets you will have to make sure everything you do is sticking well inside your risk parameters. In other words, you will have to have a clear trading plan with defined risk. This is the part where the statistical edge meets trading IQ and decides how much you will be able to make out of the edge.
Also, these statistics don’t necessarily mean you need to get active in the market immediately. Most often, these stats simply tell you not to do anything foolish. For new, young, and aspiring traders, this is immensely helpful. Let’s explain this with an example.
Practical Example
Being in an uptrend and seeing a double top within the parameters of our backtested example literally screams: Don’t short. (Although many popular Twitter trading influencers might do so to prove they can predict final tops and bottoms. And therefore teaching bad trading habits to new traders.)
In this scenario, you have two valid options: either do nothing, which won’t make you a loser, or start looking for long entries. But very important: Don’t force it. If your analysis doesn’t align with the idea of a breached double top in the near future, don’t act on it.
At least you know that you’re statistically on the right side by not shorting. Shorting will make you a loser in the long run in this particular example.
At its core, this also highlights our philosophy of winning by minimizing losses. Or as a wise person once said:
“Trading isn’t always about winning, it’s much more about not losing.”
Conclusion
By understanding and implementing a statistical edge, we can better navigate the inherently random and emotionally taxing world of trading. This disciplined approach not only increases our chances of success but also helps in maintaining emotional stability. Through careful observation, backtesting, and strategic implementation, we can develop a robust trading strategy that stands the test of time.
For more insights on trading strategies and analysis, follow us on social media or explore our other articles on boostyourcharts.
Keep learning, stay disciplined, and trade smart.