Adds a price-level setting to the script and returns the chosen number.
input.price returns a decimal number meant as a price level, starting at defval. Use it for manual support and resistance lines or alert levels.
The value is fixed for the whole run, so it can be passed straight to hline or compared with close.
Syntax
input.price(defval: const int/float, title: const string (optional), tooltip: const string (optional), inline: const string (optional), group: const string (optional), confirm: const bool (optional), display: const plot_display (optional), active: input bool (optional)) -> input floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| defval | const int/ | required | Price the setting starts with, in the symbol's quote currency. |
| title | const string | na | Name shown in the Settings dialog, the legend and the Data Window. |
| tooltip | const string | na | Text shown in a tooltip beside the input in the Settings dialog. |
| inline | const string | na | Entries sharing the same inline text sit on one row of the Settings dialog. |
| group | const string | na | Heading the input is listed under in the Settings dialog. |
| confirm | const bool | false | When true, the script asks for this value when it is first added to the chart. |
| display | const plot_display | display. | Where the value appears: a display.* constant or a combination of them. |
| active | input bool | true | When false, the input is greyed out and cannot be edited. |
Returns
input float: the chosen price level.
Remarks
- On Sidechair: the setting is a number box; there is no click-on-chart picker.
- On Sidechair: confirm, display and active are accepted and ignored.
Example
//@version=6
indicator("Manual level", overlay = true)
level = input.price(150.0, "Level")
plot(level, "Level", color = color.orange, linewidth = 2)
bgcolor(close > level ? color.new(color.green, 92) : na)See also
Runs on Sidechair