// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = MACDline[12,26,9](close)
indicator2 = ExponentialAverage[9](indicator1)
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator3 = MACDline[12,26,9](close)
indicator4 = ExponentialAverage[9](indicator3)
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator5 = MACDline[12,26,9](close)
indicator6 = ExponentialAverage[9](indicator5)
c3 = (indicator5 CROSSES UNDER indicator6)
IF c3 THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator7 = MACDline[12,26,9](close)
indicator8 = ExponentialAverage[9](indicator7)
c4 = (indicator7 CROSSES UNDER indicator8)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET stop pLOSS 30