// Lift up and down DAX 5M
// Code-Parameter
DEFPARAM FlatAfter = 113000
// trading window
ONCE BuyTime = 84500
ONCE SellTime = 113000
// money management
// variable position size - thanks Adolfo :-)
ONCE Capital = 10000
ONCE Risk = 0.01
ONCE StopLoss = 10
ONCE equity = Capital + StrategyProfit
ONCE maxrisk = round(equity*Risk)
ONCE PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
// fixed position size
// ONCE PositionSize = 10
// manage number of trades
IF Time = BuyTime THEN
LongTradeCounter = 0
ShortTradeCounter = 0
ENDIF
// long on Monday until Thursday with filter close is above MA(14) and max 2 trades per day
indicator1 = CALL RenkoTrend[7, 20, 10]
IF Not LongOnMarket AND Time >= BuyTime AND close CROSSES OVER DHigh(1) AND close > indicator1 AND LongTradeCounter < 2 AND CurrentDayOfWeek <> 5 THEN
BUY PositionSize CONTRACT AT MARKET
LongTradeCounter = LongTradeCounter + 1
ENDIF
// Fermeture long
If LongOnMarket and (indicator1 < indicator1[1]) THEN
Sell at market
// short on Monday and Tuesday with filter close is under MA(9) and max 2 trades per day
IF Not ShortOnMarket AND Time >= BuyTime AND close CROSSES UNDER DLow(1) AND close < indicator1 AND ShortTradeCounter < 2 AND CurrentDayOfWeek < 3 THEN
SELLSHORT PositionSize CONTRACT AT MARKET
ShortTradeCounter = ShortTradeCounter + 1
ENDIF
// Fermeture short
If ShortOnMarket and (indicator1 > indicator1[1]) THEN
EXITSHORT AT MARKET
// exit
IF LongOnMarket AND Time = SellTime THEN
SELL AT MARKET
ENDIF
IF ShortOnMarket AND Time = SellTime THEN
EXITSHORT AT MARKET
ENDIF
// stop and target
SET STOP pLOSS sl
SET TARGET pPROFIT tp