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.
//-------------------------------------------------------------------------
// 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.