///Spread set to 0.6 points
defparam preloadbars = 10000
defparam CUMULATEORDERS = false
possize = 5
pointsp = 35 //points where profit is to be locked in //20 SP500
pointsb = 45 //points where stop is to be taken //36 SP500
fast = average[20,0](close) //11,4 20,0
medium = average[200,0](close) //13,4 200,0
myRSI = RSI[2](close)
RSIlong = myRSI crosses over 90 //90...95
RSIshort = myRSI crosses under 10 //5...10
long = fast > medium
short = fast < medium
// trading window
ONCE BuyTime = 150000
ONCE SellTime = 220000
// position management
IF Time >= buyTime AND Time <= SellTime THEN
If countofposition = 0 then
If long then
BUY possize CONTRACT AT market
EndIf
EndIf
If countofposition = 0 then
If short then
sellshort possize CONTRACT AT market
EndIf
EndIf
endif
//Umkehr
If longonmarket and close >= positionprice + pointsp then
If close < close[1] then
SELL AT MARKET
EndIf
ElsIf longonmarket and close <= positionprice - pointsb then //and short
SELLSHORT possize*2 CONTRACT AT MARKET //*2
EndIf
If shortonmarket and close <= positionprice - pointsp then
If close > close[1] then
EXITSHORT AT MARKET
EndIf
ElsIf shortonmarket and close >= positionprice + pointsb then //and long
BUY possize*2 CONTRACT AT MARKET //*2
EndIf
//SET STOP pLOSS b
SET TARGET pPROFIT 45 //50
SET STOP %LOSS 2.6
IF Time >= 10000 AND Time <= 150000 THEN
If longonmarket and (PositionPerf * PositionPrice / PipSize) >= 30 then //35 and time=90000
sell at market
endif
If shortonmarket and (PositionPerf * PositionPrice / PipSize) >= 25 then //5 and time=90000
exitshort at market
endif
endif
////morgens
//If longonmarket and time=90000 and (PositionPerf * PositionPrice / PipSize) >= 30 then //35
//sell at market
//endif
//If shortonmarket and time=90000 and (PositionPerf * PositionPrice / PipSize) >= 15 then //5 and dayofweek=x11
//exitshort at market
//endif
//
////mittag
//If longonmarket and time=120000 and (PositionPerf * PositionPrice / PipSize) >= 30 then //35
//sell at market
//endif
//If shortonmarket and time=120000 and (PositionPerf * PositionPrice / PipSize) >= 25 then //5 and dayofweek=x11
//exitshort at market
//endif
//abends
If longonmarket and time=220000 and (PositionPerf * PositionPrice / PipSize) >= 30 then //35
sell at market
endif
If shortonmarket and time=220000 and (PositionPerf * PositionPrice / PipSize) >= 1 then //5 and dayofweek=x11
exitshort at market
endif