Hello everyone. This strategy is the inverse of the mean reverting strategy on sp 500 I posted some time ago. It waits for candle who open and close above/below the bollinger bands to enter in the same direction. 2 parameter are optimized. Walk Forward analysis is attached.
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 |
//------------------------------------------------------------------------- // Main code : meanreverting_boll_gbpjpy //------------------------------------------------------------------------- // Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated //optimized parameters bollingerperiod = 30 exitaverageperiod = 120 ///trend indicator fastavperiod = 10 slowavperiod = 100 slowav = average[slowavperiod](close) fastav = average[fastavperiod](close) // Conditions to enter long/short positions bollup = BollingerUp[bollingerperiod](close) bolldown = BollingerDown[bollingerperiod](close) cl = (close >= bollup) cl = cl AND (open >= bollup) cl = cl and close >max(fastav,slowav) cs = (close <= bolldown) cs = cs AND (open <= bolldown) cs = cs and close <min(fastav,slowav) IF cl THEN buy 1 PERPOINT AT MARKET ENDIF if cs then sellshort 1 perpoint at market endif // Conditions to exit long/short positions exitaver = Average[exitaverageperiod](close) c1 = (close CROSSES under exitaver) c2 = (close CROSSES over exitaver) IF c1 and longonmarket THEN sell AT MARKET ENDIF if c2 and shortonmarket then exitshort at market endif |
Hope you will like it.
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 :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials