Sometimes I like to start testing a strategy starting with a specific candle stick pattern in mind. I use candlestick patterns to some extent in almost all algos, mostly added in the end of the development process to fine tune entries and exits - but there are edges to be found by actually starting from the candle stick pattern itself. And that's what I've done today on the Swedish OMXS30 index with the Bullish Engulfing pattern.
First, let's just let ChatGPT tell us what a Bullish Engulfing Pattern is:
A bullish engulfing pattern is a two-candlestick formation signaling a potential bullish reversal in a downtrend. It consists of a small bearish candle followed by a larger bullish candle that completely engulfs the first candle's body, indicating a shift from selling to buying pressure. This pattern suggests that buyers have overtaken sellers, potentially leading to a trend reversal. Its effectiveness increases when accompanied by high trading volume and when occurring at support levels.
So this is what I started with. And I just randomly picked the 10 minute timeframe to work with. Developing algos isn't like a following a recipe, it's improvisation. You just test a few conditions, indicators, etc and see what happens.
The key to success is to not overwork it as that increases the risk of curve fitting. If you find yourself adding more filters and codes a few hours into developing an algo, without finding a viable edge, then you've gone too far and you need to scrap the idea. Start over and start with something completely new.
Anyway my improvisation led me to add a MACD filter and a Month filter. And that's it, nothing else! I didn't even bother changing the default exit condition which is to exit the trade after one bar. (As I run this algo on the 10 minute timeframe, all trades are for only one 10 minute candlestick)
So, what is this strategy? I wouldn't call this strategy a mean reversion strategy as this strategy enters most of it's trades with the direction of the current trend. It's not a trend following strategy either as it's not really "following" a trend, the strategy is making fast entries and fast exits within trend. It's more similar to a scalper but with less trades. If something, I would call it a sniper strategy: Fiiring on bullish engulfing patterns in the trend direction.
Here are the detailed conditions, results and code:
Conditions needed to enter trade
A Bullish Engulfing candlestick
MACD[9, 26, 12] must be below 1.8
It's September - January
Conditions to exit trade
Exit trade after 1 bar (after 10 minutes)
The equity curve from April 2011 until today
Statistics (April 2011 until today)
61.93% winrate (total 197 trades)
Time in Market 0.16%
Gain/Loss ratio: 2.36
Max consecutive wins: 9
Max consecutive losses: 5
Max Drawdown / Gain: 8.85%
The total gain must be put in comparison to the time in market. The time in market with this strategy is 0.16% which means the algo is rarely binding any capital in security margin. Add a few similar strategies to the same algo, and you have a fulfilled scalper!
Please note that this strategy catches scalping size moves in the index and requires using a instrument with low spreads.
Backtest report
The ProRealTimeâ„¢ code
IF close > open AND close > high[1] AND open < low[1] and MACD[9, 26, 12] < 1.8 and (month >= 9 or month = 1) THEN
Buy 1 contract at market
ENDIF
if OnMarket AND (BarIndex - TradeIndex) >= x Then
Sell at Market
Endif
コメント