// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 100000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 200000
timeEnterAfter = time < noEntryAfterTime
// Conditions to enter long positions
indicator1 = ExponentialAverage[200](close)
c1 = (close > indicator1)
indicator2 = MACDline[12,26,9](close)
indicator3 = ExponentialAverage[9](MACDline[12,26,9](close))
c2 = (indicator2 CROSSES OVER indicator3)
indicator4 = MACDline[12,26,9](close)
indicator5 = MACD[12,26,9](close)
c3 = (indicator4 < indicator5)
IF (c1 AND c2 AND c3) AND timeEnterBefore AND timeEnterAfter THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to enter short positions
indicator6 = ExponentialAverage[200](close)
c4 = (close < indicator6)
indicator7 = MACDline[12,26,9](close)
indicator8 = ExponentialAverage[9](MACDline[12,26,9](close))
c5 = (indicator7 CROSSES UNDER indicator8)
indicator9 = MACDline[12,26,9](close)
indicator10 = MACD[12,26,9](close)
c6 = (indicator9 > indicator10)
IF (c4 AND c5 AND c6) AND timeEnterBefore AND timeEnterAfter THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 30
SET TARGET pPROFIT 45