Ich habe noch ein wenig für das Auge basteln lassen und z.B. mit Farbe spielen lassen ..
Wo trage ich das jetzt zum Test bei tw ein?
//
@version=5
indicator("ADX Signal mit SMA Kreuzung (mit Pfeilen, Sound und Farbhintergrund)", overlay=true)
// Eingaben
adxLength =
input.int(14, title="ADX Länge")
smaLength =
input.int(20, title="SMA Länge")
adxThreshold = input.float(30.0, title="ADX Schwellenwert")
// SMA berechnen
smaValue = ta.sma(close, smaLength)
// ADX berechnen
adx = ta.adx(adxLength)
// Bedingungen für Sell-Signal
falling_and_crossing_sma = close < open and open > smaValue and close <= smaValue and close[1] > smaValue[1]
adxSteigt = adx > adx[1]
adxUberSchwelle = adx > adxThreshold
sellSignal = adxSteigt and adxUberSchwelle and falling_and_crossing_sma
// Bedingungen für Buy-Signal
rising_and_crossing_sma = close > open and open < smaValue and close >= smaValue and close[1] < smaValue[1]
buySignal = adxSteigt and adxUberSchwelle and rising_and_crossing_sma
// Pfeile im Chart plotten
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=
color.green, style=shape.labelup, size=size.small, text="Buy")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=
color.red, style=shape.labeldown, size=size.small, text="Sell")
// Alarmbedingungen (mit Sound Message)
alertcondition(sellSignal, title="ADX Sell Signal Alarm", message="SELL-SIGNAL: ADX > Schwelle und Kurs unter SMA gefallen!")
alertcondition(buySignal, title="ADX Buy Signal Alarm", message="BUY-SIGNAL: ADX > Schwelle und Kurs über SMA gestiegen!")
// Farbhintergrund setzen
bgcolor(buySignal ?
color.new(
color.green, 90) : na) // 90 = sehr transparent
bgcolor(sellSignal ?
color.new(
color.red, 90) : na) // 90 = sehr transparent
// ADX zusätzlich plotten
plot(adx, title="ADX", color=
color.blue)
hline(adxThreshold, title="ADX Schwelle", color=color.gray)
// SMA plotten (optional)
plot(smaValue, title="SMA", color=
color.orange)