Das Spiel heißt : 1 wird verlieren
//@version=5
strategy(“Heiliger Gral Wave”, overlay=true)
// === INPUTS ===
tf = input.timeframe(“1D”, title=“Timeframe für Berechnung”)
tradeDirection = input.string(“Long and Short”, title=“Trading Direction”, options=[“Long”, “Short”, “Long and Short”])
int backtest_end_date = timestamp(2035, 2, 14, 0, 0)
// === HEIKIN ASHI AKTUELLER TIMEFRAME ===
ha_close = (open + high + low + close) / 4
var float ha_open = na
ha_open := na(ha_open[1]) ? (open + close) / 2 : (ha_open[1] + ha_close[1]) / 2
ha_high = math.max(high, math.max(ha_open, ha_close))
ha_low = math.min(low, math.min(ha_open, ha_close))
// === HTF HEIKIN ASHI ===
ha_close_ext = request.security(syminfo.tickerid, tf, (open + high + low + close) / 4)
ha_open_ext = request.security(syminfo.tickerid, tf, (open + close) / 2)
ha_high_ext = request.security(syminfo.tickerid, tf, high)
ha_low_ext = request.security(syminfo.tickerid, tf, low)
// === ZONEN ===
a = request.security(syminfo.tickerid, tf, ta.highest(ha_high_ext, 3))
b = request.security(syminfo.tickerid, tf, ta.lowest(ha_low_ext, 3))
var float z1 = na
var float z2 = na
if time <= backtest_end_date
if ha_close_ext[1] > ha_open_ext[1] and ha_close_ext < ha_open_ext
z1 := a
if ha_close_ext[1] < ha_open_ext[1] and ha_close_ext > ha_open_ext
z2 := b
if tradeDirection == “Long” or tradeDirection == “Long and Short”
if not na(z1) and close > z1
strategy.entry(“Long”, strategy.long)
if tradeDirection == “Short” or tradeDirection == “Long and Short”
if not na(z2) and close < z2
strategy.entry(“Short”, strategy.short)
else
strategy.close_all()
// === z3 = HA OPEN AKTUELL ===
z3 = ha_open_ext
// === PLOTS ===
plot(z1, title=“z1 – Höchster Wert”, color=color.blue, linewidth=2, style=plot.style_stepline)
plot(z2, title=“z2 – Tiefster Wert”, color=color.red, linewidth=2, style=plot.style_stepline)
plot(z3, title=“z3 – HA Open Current”, color=color.orange, linewidth=2, style=plot.style_stepline)