//================================================
DEFPARAM CUMULATEORDERS = false
defparam preloadbars = 10000
//Risk Management
PositionSize=5
timeframe(4hour, updateonclose)
//barCount = barIndex
myhigh = high
myclose= close
mylow = low
bullish = close > open
bearish = close < open
stronglong = close > close[1]
strongshort = close < close[1]
MA1 = Average[2,1](close)
MA2 = Average[30,1](close)
MA3 = Average[8,1](close)
MA4 = Average[10,1](close)
//MylongH4 = MA1 > MA2 and MA2 > MA3 and MA3 > MA4
MyshortH4 = MA1 < MA2 and MA2 < MA3 and MA3 < MA4
MAlong = Average[2,1](close)
MAshort = Average[2,1](close)
mylongH4 = MAlong > MAlong[1] and MA1 > MA2
Trendlongexit = MAlong < MAlong[1]
//myshortx = MAshort < MAshort[1]
Trendshortexit = MAshort > MAshort[1]
//RSI
myRSIH4 = RSI[2](close)
rsisteigtH4 = myRSIH4 > myRSIH4[1]
rsisteigtH4cross = myRSIH4 crosses over 90
rsisinktH4 = myRSIH4 < myRSIH4[1]
rsisinktH4cross = myRSIH4 crosses under 10
//myADX = ADX[14] > 10
timeframe(1hour, updateonclose)
//RSI
myRSIH1 = RSI[2](close)
rsisteigtH1 = myRSIH1 > myRSIH1[1]
rsisteigtH1cross = myRSIH1 crosses over 90
rsisinktH1 = myRSIH1 < myRSIH1[1]
rsisinktH1cross = myRSIH1 crosses under 10
timeframe(15minute, updateonclose)
bullishM15 = close > open
bearishM15 = close < open
stronglongM15 = close > close[1]
strongshortM15 = close < close[1]
//RSI
myRSIM15 = RSI[2](close)
rsisteigtM15 = myRSIM15 > myRSIM15[1]
rsisteigtM15cross = myRSIM15 crosses over 90 //90
rsisinktM15 = myRSIM15 < myRSIM15[1]
rsisinktM15cross = myRSIM15 crosses under 10
/////////////////////
//BOLLINGER
A = 20 // période
B = 2 // déviation
BollInf = Average[A](close)–B*std[A](close)
BollSup = Average[A](close)+B*std[A](close)
// INDICATEUR %BOLLINGER : pB
pB = (close – BollInf) / (BollSup – BollInf)
//Bolllong = (pB < 0) and (pB[1] > 0)
//Bollshort = (pB > 1) and (pB[1] < 1)
Bolllong = (pB > 1) and (pB[1] < 1) //Ausbruch
Bollshort = (pB < 0) and (pB[1] > 0) //Ausbruch
//timeframe(5minute, updateonclose)
///////////////////////
////BOLLINGER
//A = 20 // période
//B = 2 // déviation
//BollInf = Average[A](close)-B*std[A](close)
//BollSup = Average[A](close)+B*std[A](close)
//// INDICATEUR %BOLLINGER : pB
//pB = (close – BollInf) / (BollSup – BollInf)
//
////Bolllong = (pB < 0) and (pB[1] > 0)
////Bollshort = (pB > 1) and (pB[1] < 1)
//Bolllong = (pB > 1) and (pB[1] < 1) //Ausbruch
//Bollshort = (pB < 0) and (pB[1] > 0) //Ausbruch
timeframe(default)
mylong = mylongH4 and rsisinktH1 and rsisteigtM15
mylong2 = mylongH4 and rsisteigtH1 and rsisteigtM15
mylong3 = mylongH4 and rsisteigtH1 and Bolllong
mylong4 = mylongH4 and rsisteigtH1 and rsisinktM15cross
mylong5 = mylongH4 and rsisteigtH1 and rsisteigtM15cross //and rsisteigtH4
mylong6 = mylongH4 and rsisteigtH1cross
mylong7 = mylongH4 and rsisteigtM15cross
myshort = MyshortH4 and rsisteigtH1 and strongshortM15
// trading window
ONCE BuyTime = 130000
ONCE SellTime = 210000
// position management
IF Time >= BuyTime AND Time <= SellTime THEN
If mylong5 Then
Buy PositionSize CONTRACTS AT MARKET
//SET STOP %LOSS hl //0.8
//SET TARGET %PROFIT gl //1
ENDIF
//If myshort Then //and myshort3
//sellshort PositionSize CONTRACTS AT MARKET
////SET STOP %LOSS hs //0.8
////SET TARGET %PROFIT gs //1
//ENDIF
endif
if longonmarket and Trendlongexit then //or close crosses under dlow(1)
sell at market
endif
if shortonmarket and Trendshortexit then //myshortexitx or close crosses over dhigh(0)
exitshort at market
endif