defParam cumulateOrders = false
defParam preLoadBars = 10000
defParam flatAfter = 220000
positionSize = 1
//------------------------------------------------------------
timeframe(1 day, updateOnClose)
myMacd = average[12,1] - average[26,1]
c1L = myMacd crosses over 0
c1S = myMacd crosses under 0
//--------------------------------------------------------------
timeframe(15 minutes, updateOnClose)
mySAR = sar[0.02,0.02,0.2]
greenSar = close > MySAR
redSar = close < MySAR
changeColor = (greenSar and redSar[1]) or (greenSar[1] and redSar)
c2L = greenSar
c2S = redSar
if not onMarket and c1L and c2L then
buy positionSize contracts at market
endif
if longOnMarket and changeColor and redSar then
sell positionSize contracts at market
endif
if not onMarket and c1S and c2S then
sellShort positionSize contracts at market
endif
if shortOnMarket and changeColor and greenSar then
exitShort positionSize contracts at market
endif