Hi everyone,
I’m sharing this strategy I’ve been working on recently. It’s a mean reversion setup designed for the DAX working on M30 (with proper optimization it gives algo great results on the Nasdaq). The strategy targets reversals using a combination of indicators:
– Bollinger Bands for volatility and price extremes
– VWAP for intraday price reference
– EMAs for trend direction
– Higher Highs pattern confirmation
The strategy looks for oversold conditions near the lower Bollinger Band, waiting for a VWAP breakout to confirm the reversal. It includes automatic position closure before US market open.
While testing this strategy, I noticed the trade frequency is lower than expected. Although the logic behind seems to be great, I believe there’s room for improvement. Rather than keeping it to myself, I decided to share it as it could serve as a good foundation for further development for those who are interested in dedicating some time.
Potential areas for enhancement:
– Fine-tuning the BB parameters
– Adding volume filters
– Implementing more sophisticated exit rules
Feel free to modify and build upon this base (and share the final result if you want).
P.S: As always, please backtest thoroughly before using with real money.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
//——————————————// // Reversal Catcher — Thibauld Robin — FOR DAX M30 //——————————————// // Initialization ONCE pos = 0 BBlength = 20 BBmult = 1.5 fastEMA = 21 slowEMA = 50 rsiLength = 14 overbought = 70 oversold = 30 // Bollinger Bands bbMA = AVERAGE[BBlength](close) bbDev = SQRT(SUMMATION[BBlength]((close – bbMA)*(close – bbMA))/BBlength) BBupper = bbMA + (bbDev * BBmult) BBlower = bbMA – (bbDev * BBmult) // EMAs ema21 = TEMA[21](close) ema50 = TEMA[50](close) // VWAP IF day<>day[1] THEN d=1 VWAP=typicalprice ELSE d=d+1 IF volume > 0 THEN VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume) ENDIF ENDIF // Trend upTrend = ema21 > ema50 // HH/LL hhLLong = low > low[1] AND high > high[1] AND close > high[1] // Entries vwapBreakout = close crosses over VWAP longCond = Low[1] < BBlower[1] AND close > BBlower AND close < BBupper AND hhLLong AND upTrend AND vwapBreakout // Exits exitLong = (close > BBupper) OR (ema21 crosses under ema50) // Trading Orders IF longCond AND pos = 0 THEN BUY 1 SHARES AT MARKET pos = 1 SET STOP LOSS low[1] ENDIF // Exits IF pos = 1 AND exitLong THEN SELL AT MARKET pos = 0 ENDIF // Close before US open IF TIME >= 150000 AND pos <> 0 THEN IF pos = 1 THEN SELL AT MARKET ENDIF pos = 0 ENDIF |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
thanks for sharing. Is it only long? Why you didn’t consider short too?
You’re welcome! Yes, it’s only long, I believe it’s (maybe a bad) habit with the indices…