Pine code

Wait 5 sec.

Pine codeBRITISH POUND / U.S. DOLLARFX_IDC:GBPUSDBoyz123//@version=6 indicator("Ultra Trend Arrows (Non-Repaint)", overlay=true, max_labels_count=500) // ─── Inputs ────────────────────────────────────── len = input.int(2, "Swing Length", minval=1, tooltip="How many bars left/right to confirm swing high/low") atrMult = input.float(0.5, "ATR Filter Multiplier", minval=0.1, step=0.1, tooltip="Filter small swings by ATR size") atrLen = input.int(14, "ATR Length", minval=1) // ─── ATR Filter ────────────────────────────────── atr = ta.atr(atrLen) // ─── Swing Detection ───────────────────────────── isSwingHigh = ta.pivothigh(len, len) isSwingLow = ta.pivotlow(len, len) // Confirm swing only if move is large enough validHigh = not na(isSwingHigh) and (high - low) >= atrMult * atr validLow = not na(isSwingLow) and (high - low) >= atrMult * atr // ─── Plot Arrows ───────────────────────────────── plotshape(validLow, title="Up Arrow", style=shape.labelup, location=location.belowbar, color=color.lime, size=size.small, text="▲") plotshape(validHigh, title="Down Arrow", style=shape.labeldown, location=location.abovebar, color=color.red, size=size.small, text="▼") // ─── Alerts ───────────────────────────────────── alertcondition(validLow, title="Buy Signal", message="Ultra Trend: BUY signal") alertcondition(validHigh, title="Sell Signal", message="Ultra Trend: SELL signal")