Skip to content
Algo Trade Analytics Docs
Pine library page — review pending. This page is preserved for compatibility but is not part of the reviewed search index. Check the official Pine Script v6 reference before relying on its explanation, signature, or example.

const - Pine Script Type

The const keyword explicitly assigns the “const” type qualifier to variables and the parameters of non-exported functions. Variables and parameters with the “const” qualifier reference values established at compile time that never change in the script’s execution.

  • To learn more, see our User Manual’s section on type qualifiers.
//@version=6indicator("can't assign input to const")//@variable A variable declared as "const float" that attempts to assign the result of `input.float()` as its value.//          This declaration causes an error. The "input float" qualified type is stronger than "const float".const float myVar = input.float(2.0)plot(myVar)