// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
Once n=16
// Heikin Ashi setup
once xOpen = open
xClose = (open + close + high + low) / 4
if barindex > 0 then
xOpen = (xOpen + xClose[1]) / 2
endif
xLow = min(low,min(xClose,xOpen))
xHigh = max(high,max(xClose,xOpen))
//
Bullish = xClose > xOpen
Bearish = xClose < xOpen
indicator2 = RSI[n](Close)
// Bedingungen zum Einstieg in Long-Positionen
indicator1 = Average[n](close)
c1 = (Bullish AND Bearish[1]) and xClose Crosses Over indicator1 and indicator2 Crosses Over 20
IF C1 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// exit LONG trade on a Bearish candlestick
c2 = (Bearish and xClose Crosses Under indicator1)
IF c2 THEN
SELL AT MARKET
ENDIF
// SHORT trades when switching from bullish to bearish
c3 = (Bearish AND Bullish[1]) and xClose < indicator1 and indicator2 Crosses Under 80
IF c3 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// exit SHORT trade on a Bullish candlestick
c4 = (Bullish and xClose Crosses Over indicator1)
IF c4 THEN
EXITSHORT AT MARKET
ENDIF