// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = Average[5](close)
indicator2 = Average[21](close)
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 THEN
BUY 2 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator3 = Average[5](close)
indicator4 = Average[21](close)
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator5 = Average[5](close)
indicator6 = Average[21](close)
c3 = (indicator5 CROSSES UNDER indicator6)
IF c3 THEN
SELLSHORT 2 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator7 = Average[5](close)
indicator8 = Average[21](close)
c4 = (indicator7 CROSSES OVER indicator8)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 15