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