개발
pinescript: Identifiers
pip1
2023. 6. 2. 01:25
identifier: name that you give to an element in the code
such as variable,function,constant,etc
For example,int fastLength = 7, fastLength is an identifier for a variable.
-Begin with uppercase or lowercase or and underscore(_)
-case sensitive
e.g.
myVar
_myVar
my123Var
functionName
MAX_LEN
max_len
maxLen
3barsDown // NOT VALID!
-recommends using uppercase SNAKE_CASE for constants and camelCase for other identifiers
SNAKE_CASE: all letters are uppercase,use underscore(_)to separate
camelCase: First letter lowercase,subsequent uppercase
-These are not rules just conventions
GREEN_COLOR = #4CAF50
MAX_LOOKBACK = 100
int fastLength = 7
// Returns 1 if the argument is `true`, 0 if it is `false` or `na`.
zeroOne(boolValue) => boolValue ? 1 : 0