# Untitled

unknown
lua
a month ago
2.5 kB
2
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_threshold = input(25, title="ADX Threshold") // Ändere den Schwellenwert hier nach Bedarf

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]

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

// 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]