//-------------------------------------------------------------------------
// Codice principale : nn si sa m.a. colorata bull
//-------------------------------------------------------------------------
//SPEAD = 2.5
//Capital = £500
//Trading hours from DAX open until NYSE close. No after hours trading.
//Time is UTC +2 (South Afica time)
DEFPARAM CumulateOrders = false // Cumulating positions deactivated
a=average[z] (close)
if a[1]<a then
alex=100
endif
if a[1] > a then
alex=50
endif
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 090000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 173000
timeEnterAfter = time < noEntryAfterTime
// Conditions to enter long positions
indicator1 = WeightedAverage[x](totalPrice)
c1 = (High CROSSES OVER indicator1)
indicator2 = WeightedAverage[y](totalPrice)
c2 = (low CROSSES OVER indicator2)
IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter and COUNTOFPOSITION=0 and alex=100 THEN
Buy 1 CONTRACT AT MARKET
ENDIF
indicator3 = WeightedAverage[x](totalPrice)
c3 = (low CROSSES UNDER indicator3)
indicator4 = WeightedAverage[y](totalPrice)
c4 = (High CROSSES UNDER indicator4)
IF (c3 AND c4) AND timeEnterBefore AND timeEnterAfter and COUNTOFPOSITION=0 and alex=50 THEN
SellShort 1 CONTRACT AT MARKET
ENDIF
// Stops and targets
SET TARGET $PROFIT 10
SET STOP $LOSS 200