// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
DEFPARAM preloadbars = 0
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 080000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 190000
timeEnterAfter = time < noEntryAfterTime
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
Once PositionSize = 1
IF tradecount = 5 then
positionSize = positionsize + 1
tradecount = 0
endif
// Conditions to enter long positions
indicator1 = Average[5](close)
indicator2 = Average[20](close)
c1 = (indicator1 CROSSES OVER indicator2)
IF Not OnMarket and c1 AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
BUY positionsize PERPOINT AT MARKET
tradecount = tradecount + 1
ENDIF
// Stops and targets
SET STOP pLOSS 15
SET TARGET pPROFIT 30