Why combine indicators and how to structure the merge
A merged script occupies one script instance, but still has limits on plot counts, execution time, data requests, and memory. Merge calculations only when you have editable source and permission to reuse it. Shared values can then feed an explicit combined condition. The example below requires price above an EMA, a close at or below the lower Bollinger Band, and RSI below a chosen threshold; it does not require an EMA crossover or establish that those conditions improve returns.
| Challenge during merge | Cause | Technical solution in Pine Script v6 |
|---|---|---|
| Variable name collision | Both scripts use identical names like len, ma, rsi | Prefix variables with indicator acronyms (e.g. ema_len, rsi_len) |
| Overlay conflict | One script is overlay = true, the other is an oscillator in a separate pane | Use overlay = false for the oscillator pane and force_overlay = true on supported price plots to place those on the main chart |
| Version mismatches | One script is v4 or v5, while the other is v6 | Migrate each script through the applicable version guides and compare behavior; namespace replacement alone is not a complete migration |
| Unorganized settings | Dozens of inputs appear mixed randomly in settings | Add group = "Indicator Name" to every input() call |