OPEN-SOURCE SCRIPT

Fractal Time/Price Scaling Invariance

//version=6
indicator("Fractal Time/Price Scaling Invariance", overlay=true, shorttitle="FTSI v1.2")

// Zeitliche Oktaven-Konfiguration
inputShowTimeOctaves = input(true, "Zeit-Oktaven anzeigen")
inputBaseTime1 = input.int(8, "Basisintervall 1 (Musikalische Oktave)", minval=1)
inputBaseTime2 = input.int(12, "Basisintervall 2 (Alternative Sequenz)", minval=1)

// Preis-Fraktal-Konfiguration
inputShowPriceFractals = input(true, "Preis-Fraktale anzeigen")
inputFractalDepth = input.int(20, "Fraktal-Betrachtungstiefe", minval=5)

// 1. Zeitliche Fraktale mit skaleninvarianter Oktavstruktur
if inputShowTimeOctaves
// Musikalische Oktaven (8er-Serie)
for i = 0 to 6
timeInterval1 = inputBaseTime1 * int(math.pow(2, i))
if bar_index % timeInterval1 == 0
line.new(bar_index, low - syminfo.mintick, bar_index, high + syminfo.mintick, color=color.new(color.blue, 70), width=2)

// Alternative Sequenz (12er-Serie)
for j = 0 to 6
timeInterval2 = inputBaseTime2 * int(math.pow(3, j))
if bar_index % timeInterval2 == 0
line.new(bar_index, low - syminfo.mintick, bar_index, high + syminfo.mintick, color=color.new(color.purple, 70), width=2)

// 2. Korrigierte Preis-Fraktal-Erkennung
var fractalHighArray = array.new_line()
var fractalLowArray = array.new_line()

if inputShowPriceFractals
// Fractal Detection (korrekte v6-Syntax)
isFractalHigh = high[2] == ta.highest(high, 5)[2]
isFractalLow = low[2] == ta.lowest(low, 5)[2]

// Zeichne dynamische Fraktal-Linien
if isFractalHigh
line.new(bar_index[2], high[2], bar_index + inputFractalDepth, high[2], color=color.new(color.red, 80), style=line.style_dotted)

if isFractalLow
line.new(bar_index[2], low[2], bar_index + inputFractalDepth, low[2], color=color.new(color.green, 80), style=line.style_dotted)

// Array-Bereinigung
if array.size(fractalHighArray) > 50
array.remove(fractalHighArray, 0)

if array.size(fractalLowArray) > 50
array.remove(fractalLowArray, 0)

// 3. Dynamische Übergangszonen (Hesitationsbereiche)
transitionZone = ta.atr(14) * 2
upperZone = close + transitionZone
lowerZone = close - transitionZone

plot(upperZone, "Upper Transition", color.new(color.orange, 50), 2)
plot(lowerZone, "Lower Transition", color.new(color.orange, 50), 2)

// 4. Skaleninvariante Alarmierung
alertcondition(ta.crossover(close, upperZone), "Breakout nach oben", "Potenzielle Aufwärtsbewegung!")
alertcondition(ta.crossunder(close, lowerZone), "Breakout nach unten", "Potenzielle Abwärtsbewegung!")

免責聲明