I’m building a lightweight TradingView study and need it coded in Pine Script v5. The core logic is straightforward: a single-length EMA (default 2, but freely adjustable in the settings panel) must plot continuously on the chart. The moment price pierces that EMA—whether up or down—I want the script to freeze the EMA value at that instant, project a horizontal line four candles backward and four candles forward, and leave that line locked in place until the next cross occurs. Only one such line should ever be visible; when a fresh cross happens, the previous line disappears and a new one is drawn at the latest locked level. Because I trade in real time, the alert for both “cross above” and “cross below” must trigger on the running candle, not only after it closes. I’ll handle notifications myself inside TradingView once the alert events exist. To keep future tweaks painless, please organise and comment the code clearly—especially the EMA length, the left/right span length, and any style settings—so I can adjust them without digging through the logic. Deliverables • Pine Script v5 source that compiles cleanly • Well-commented code with easily editable input parameters • A working .pine indicator file I can drop straight into TradingView and test immediately If you’re comfortable with Pine v5’s drawing and alert functions, this should be a quick project. Let me know any clarifications you need and your estimated turnaround.