// RS 30.6.19
// Idde 1. Stufe entscheiden ob long or Short
//
DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
DEFPARAM FlatBefore = 090000
DEFPARAM FlatAfter = 173000
myKeltnerMA, myBandaSupKeltner, myBandaInfKeltner = CALL "Keltner_Channel_RS"[1, 0, 0, 52]//10
EGD = ExponentialAverage[30](close)//9
GD = Average[18](close)//11
//Menge an Kontrakten
mk = 1
//erkennen Marktzustand
IF Close[1] <= myBandaInfKeltner then
Marktlong = 1
elsIF Close[1] > myKeltnerMA then
Marktlong = 0
endIF
IF Close[1] > myBandaSupKeltner then
Marktshort = 1
elsif Close[1] < myKeltnerMA then
Marktshort = 0
endif
//erkennen ob Kauf oder Verkauf
if EGD CROSSES OVER GD then
golong = 1
elsif EGD CROSSES UNDER GD then
golong = 0
endif
if EGD CROSSES UNDER GD then
goshort = 1
elsif EGD CROSSES OVER GD then
goshort = 0
endif
// darstellen im Graf
//GRAPH Marktlong COLOURED (0,255,0) AS "Marktlong"
//GRAPH Marktshort COLOURED (255,0,0) AS "Marktshort"
//GRAPH goshort COLOURED (0,0,255) AS "goshort"
// Bedingungen zum Einstieg in Long-Positionen
IF NOT LongOnMarket AND (Marktlong = 1 and golong = 1) THEN
BUY mk CONTRACTS AT MARKET
ENDIF
// Bedingungen zum Ausstieg von Long-Positionen
If LongOnMarket AND (golong = 0) THEN
SELL AT MARKET
ENDIF
// Bedingungen zum Einstieg in Short-Positionen
IF NOT ShortOnMarket and Marktshort = 1 and goshort = 1 THEN
SELLSHORT mk CONTRACTS AT MARKET
ENDIF
// Bedingungen zum Ausstieg aus Short-Positionen
IF ShortOnMarket AND goshort = 0 THEN
EXITSHORT AT MARKET
ENDIF
// Stops und Targets: Legen Sie hier schützende Stops und Profit Targets fest
SET STOP pTRAILING 10
//SET STOP pLOSS 100
IF STRATEGYPROFIT < -500 THEN
QUIT
ENDIF