CS2302
error A history offset must be a whole number of 0 or more.
#What it means
The number inside [ ] after a series is how many bars back to look. It must be a whole number (int) of 0 or more.
#Typical cause
- A negative offset such as
close[-1]: future bars cannot be read. - A fractional or float offset such as
close[1.5].
#How to fix it
Use a whole number of 0 or more. Convert a float with int(x). See Execution model.
#Example
//@chartscript 1
indicator("Change")
plot(close - close[-1])Fixed
//@chartscript 1
indicator("Change")
plot(close - close[1])