Untitled

mail@pastecode.io avatar
unknown
lua
a year ago
2.5 kB
4
Indexable
Never
//@version=5

indicator("AnGe335 G-Force PA Indikator", shorttitle="AnGe335.- G-Force PA", overlay=true)

// EMA-Periode als Einstellungen
ema1_period = input(10, title="EMA 1 Period")
ema2_period = input(20, title="EMA 2 Period")
ema3_period = input(50, title="EMA 3 Period")

// Farben mit Transparenz festlegen
ema1_color = color.new(#067f0a, 35)
ema2_color = color.new(#ff0000, 35)
ema3_color = color.new(#1a2095, 35)

// Berechnung der EMA-Werte
ema1 = ta.ema(close, ema1_period)
ema2 = ta.ema(close, ema2_period)
ema3 = ta.ema(close, ema3_period)

// Plot der EMA-Linien im Hauptchart
plot(ema1, color=ema1_color, title="EMA 1")
plot(ema2, color=ema2_color, title="EMA 2")
plot(ema3, color=ema3_color, title="EMA 3")

// ADX-Filter Einstellungen
adx_filter_enabled = input.bool(false, title="Enable ADX Filter")
adx_length = input(14, title="ADX Length")
adx_threshold = input(25, title="ADX Threshold") // Ändere den Schwellenwert hier nach Bedarf

// Berechnung des ADX-Werts
dirmov(len) =>
    up = ta.change(high)
    down = -ta.change(low)
    plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
    minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
    truerange = ta.rma(ta.tr, len)
    plus = fixnan(100 * ta.rma(plusDM, len) / truerange)
    minus = fixnan(100 * ta.rma(minusDM, len) / truerange)
    [plus, minus]

adx(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    sum = plus + minus
    adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)

adx_value = adx(adx_length, adx_length)

// Berechnung der Bedingungen für LONG-Einstiege
long_condition = ema1 > ema2 and ema2 > ema3 and low[0] < low[1] and close[0] >= close[1]

// Berechnung der Bedingungen für SHORT-Einstiege
short_condition = ema1 < ema2 and ema2 < ema3 and high[0] > high[1] and close[0] <= close[1]

// Bedingung für den ADX-Filter
adx_condition = adx_filter_enabled ? adx_value > adx_threshold : true

// Alarme für LONG- und SHORT-Einstiege
alertcondition(long_condition and adx_condition, title="LONG Entry", message="LONG-Signal erkannt")
alertcondition(short_condition and adx_condition, title="SHORT Entry", message="SHORT-Signal erkannt")

// Zeichnen der Pfeile
plotshape(series=long_condition and adx_condition, title="LONG Entry", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(series=short_condition and adx_condition, title="SHORT Entry", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)