Enhancing the Alternating Body Color Pattern: Adding an ATR Filter for Better Performance
To further refine the strategy, I introduced a new filter: the signal bar (the second bar in the alternating body color pattern) must be bigger than the ATR of the last 60 bars. I chose the last 60 bars because, in the game, I observed that when the signal bar is bigger, the results seem better.
Introduction
At TradingDJ, we continuously strive to refine and enhance our trading strategies to achieve better performance. Recently, I revisited the Alternating Body Color pattern and shared my initial findings. Despite the simplicity of the pattern, the results were promising but highlighted the need for more sophisticated filters. Today, I'm excited to share a new variation of this strategy that incorporates an Average True Range (ATR) filter to improve its effectiveness.
The Genesis of the Strategy
The Alternating Body Color pattern is straightforward: a green candlestick followed by a red one signals a sell, and a red candlestick followed by a green one signals a buy. Although I had known about this pattern for a long time, I initially dismissed it as too simple and in need of more filters. However, I recently incorporated this pattern into a trading game on my website, TradingDJ (https://game.tradingdj.com), to see how it performs in a simulated environment. The simplicity of the setup allowed me to focus on the context and build my intuition.
Initial Observations
As I engaged with the TradingDJ game, I noticed an encouraging trend: even when taking all trades based on the Alternating Body Color pattern, the overall results were positive. However, the performance significantly improved when I applied filters to select trades more selectively. This observation sparked the idea of automating this strategy using NinjaTrader 8, specifically on the ES 5-minute chart.
Automation with NinjaTrader 8
With the promising results from the TradingDJ game in mind, I decided to automate the Alternating Body Color strategy in NinjaTrader 8. The goal was to validate its effectiveness in a backtesting environment and potentially refine it for real-time trading.
Adding an ATR Filter
To further refine the strategy, I introduced a new filter: the signal bar (the second bar in the alternating body color pattern) must be bigger than the ATR of the last 60 bars. I chose the last 60 bars because, in the game, I observed that when the signal bar is bigger, the results seem better. I implemented this new filter as the Min ATR Multiplier parameter, which I optimized from 1 to 3 with a step of 0.2.
Optimization and Results
The optimization results revealed some interesting insights. Here are the key metrics for different values of the Min ATR Multiplier:
- Total Net Profit: 6,175.00 $
- Gross Profit: 43,562.50 $
- Gross Loss: -37,387.50 $
- Profit Factor: 1.17
- Max. Drawdown: -4,337.50 $
- Total # of Trades: 164
- Percent Profitable: 51.22%
- # of Winning Trades: 84
- # of Losing Trades: 79
I noticed that the bigger the multiplier, the higher the profit factor. The results are overall positive, although not spectacular. With a multiplier of 2, the short side performed better, while with a multiplier of 3, the long side showed better results.
Comparison with Previous Results
Compared to the initial strategy without the ATR filter, this new variation showed an improvement in the profit factor and a more balanced performance between long and short trades. The previous strategy had mixed results and highlighted the limitations of taking new trades only after closing the current one. By adding the ATR filter, the strategy became more selective, leading to better profitability.
Challenges and Insights
One key challenge observed in the previous tests was the discrepancy between the manual trading results from the TradingDJ game and the automated backtest results in NinjaTrader 8. In the game, the results are expressed in R, representing the risk taken per trade, whereas the automated strategy used a fixed contract size. Despite these differences, the winning percentages were expected to remain similar, but they did not. This highlighted the need for further refinement.
The introduction of the ATR filter aimed to address some of these discrepancies by ensuring trades are taken only during periods of significant market movement. This adjustment improved the strategy's performance, but further refinements are still necessary.
Future Directions
The initial backtest results with the ATR filter provide valuable insights for further improvement. Moving forward, I plan to refine the strategy by introducing additional filters and adjustments. These enhancements aim to align the automated performance more closely with the promising manual trading results observed in the TradingDJ game.
Encouragement to Stay Tuned
This journey of exploring and automating the Alternating Body Color pattern with an ATR filter is just beginning. I am committed to developing more refined versions of this strategy and sharing the results with you. Stay tuned to the TradingDJ blog for updates on new tests and improvements.
Conclusion
The Alternating Body Color pattern, despite its simplicity, holds significant potential for automated trading strategies. By adding an ATR filter, we improved its performance, but there is still room for enhancement. I invite you to join me on this journey as we continue to explore and refine this strategy.
Join the TradingDJ Community
I encourage you to try out the TradingDJ game and share your feedback on this pattern. Subscribe to the TradingDJ blog and become part of our community to stay informed about new strategies and updates. Together, let's uncover the full potential of automated trading strategies.