PROTECTED SOURCE SCRIPT

AlgoRanger FlowState

75
//version=5
indicator("AlgoRanger FlowState", overlay=true)

// === INPUTS ===
atrPeriod = input.int(10, title="ATR Period")
factor = input.float(3.0, title="Multiplier")

// === ATR & BASIC BANDS ===
atr = ta.atr(atrPeriod)
hl2 = (high + low) / 2
upperBand = hl2 + factor * atr
lowerBand = hl2 - factor * atr

// === SUPER TREND LOGIC ===
var float supertrend = na
var bool isUpTrend = true

if na(supertrend)
supertrend := hl2
else
if close > supertrend
supertrend := math.max(lowerBand, supertrend)
isUpTrend := true
else
supertrend := math.min(upperBand, supertrend)
isUpTrend := false

// === TREND REVERSAL SIGNALS ===
buySignal = isUpTrend and not isUpTrend[1]
sellSignal = not isUpTrend and isUpTrend[1]

// === PLOT SUPER TREND ===
plot(supertrend, title="Supertrend", color=isUpTrend ? color.green : color.red, linewidth=2)

// === PLOT COLOR-CODED BARS ===
barcolor(isUpTrend ? color.new(color.green, 0) : color.new(color.red, 0))

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.