// Parameters
defparam cumulateorders = false
TimeFrame(30 minutes)//,UpdateOnClose)
BeginTime = 083000 // 08:30 London time
EndTime = 203000 // 20:30 London time
Len = 18
Len2 = 28
OB = 71
OS = 20
BBSD = 1.5
emaLenLX = 27
emaLenSX = 28
adxLen = 5
minChng = 0.1
TakeProfit = 260
StopLoss = 140
MySize = 1
// Indicators
Avg=Average[Len](Close)
UpperBB = Avg+Std[Len](Close)*BBSD
LowerBB = Avg-Std[Len](Close)*BBSD
emaLX = ExponentialAverage[emaLenLX](close)
emaSX = ExponentialAverage[emaLenSX](close)
rsiVal = RSI[Len2](close)
mfiVal = MoneyFlowIndex[Len2]
rsiMFI = (rsiVal + mfiVal) / 2
adxVal = ADX[adxLen]
adxPrev = adxVal[1]
// Setup-condities
BuySetup = close[1] < LowerBB[1] and rsiMFI < OS
SellSetup = close[1] > UpperBB[1] and rsiMFI > OB
inTimeWindow = (time >= BeginTime and time <= EndTime)
// Entry Long
if not longonmarket and inTimeWindow and BuySetup then
if close > LowerBB and (adxPrev - adxVal) > minChng then
buy MySize contracts at market
EndIf
// Entry Short
if not shortonmarket and inTimeWindow and SellSetup then
if close < UpperBB and (adxPrev - adxVal) > minChng then
sellshort MySize contracts at market
EndIf
// Exit Long
if longonmarket and close > emaLX then
sell at market
EndIf
// Exit Short
if shortonmarket and close < emaSX then
exitshort at market
EndIf
// Order Management
set target profit TakeProfit * pointvalue
set stop Loss StopLoss * pointvalue
EndIf
EndIf
GraphOnPrice UpperBB
GraphOnPrice LowerBB
GraphOnPrice emaLX
GraphOnPrice emaSX
Graph rsiVal
Graph mfiVal
Graph rsiMFI
Graph adxVal
Graph BuySetup
Graph SellSetup