The exported signature is the boundary
Exported function parameters require explicit types. Qualifiers control which arguments can reach them: const < input < simple < series. A simple parameter accepts weaker values, but rejects a changing series. Casting a series float to int does not make it simple. Return qualifiers follow the calculation, so a series input can produce a series result even when other parameters are simple.
- Exported functions cannot read non-const library globals or call input.*(). Have the consumer collect settings and pass them as arguments.
- Local request.*() calls require dynamic requests, and their expression cannot depend on exported parameters. Do not move an arbitrary request expression into an export.
- Library function results are simple or series, so they cannot fill a parameter requiring const or input. Keep plot titles and other compile-time settings in the consumer.
| Contract element | Example below | Consumer obligation |
|---|---|---|
| Name and argument order | relativeMove(current, reference, unit) | Preserve names if callers use named arguments. |
| series float | current and reference | Supply numeric values; either may change per bar. |
| simple float | unit defaults to 100 | Choose a fixed scale per execution; do not pass a bar-dependent scale. |
| Result | series float | Handle na before comparing or displaying the result. |
| Units | 100 means percent; 1 means fraction | Do not compare 10 percent with a 0.10 fraction threshold. |