// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = SAR[0.02,0.02,0.2]
c1 = (indicator1 CROSSES UNDER close)
IF c1 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator2 = SAR[0.02,0.02,0.2]
c2 = (indicator2 CROSSES OVER close)
IF c2 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator3 = SAR[0.02,0.02,0.2]
c3 = (indicator3 CROSSES OVER close)
IF c3 THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
indicator4 = SAR[0.02,0.02,0.2]
c4 = (indicator4 CROSSES UNDER close)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pTRAILING 40