ScriptingReferenceQuestions we get asked

Common questions

These are the questions the language’s own shape raises. Each one has an answer in the grammar or in the interpreter, rather than in a matter of taste.

Why does each logical operator have two spellings?

Because the grammar accepts both, and both produce the same token. and and && are one operator, not two. The same holds for or and ||, and for not and !.

Nothing in the language chooses between them. Pick one spelling and keep to it across a script. The house style page picks the word forms.

What is the difference between = and :=?

They are two different operators. = declares. := reassigns.

length = 20
length := 30

Why does ^ not raise to a power?

There is no exponentiation operator. A script containing ^ does not parse, so the failure arrives when you check the script rather than while it runs.

Why must step be passed by position?

Because step is a reserved word. The grammar uses it in the counted loop, so it cannot also be an argument name, and naming it is a parse error. The step parameter of the integer and float input functions has to be passed positionally.

This is worth knowing because it is the commonest reason a script fails to compile.

Why are arrays and some orderflow names unavailable?

Because neither is part of the v1 language.

No array library, function or type is exposed, and the array diagnostics cannot be reached from a script. Eight further orderflow names are not part of the v1 language and cannot be used.

My script will not compile. Is it me or the language?

Usually the script, and step is worth ruling out first.

If yours does not compile, start from something that does and add to it a piece at a time.

indicator("Close")
plot(close)
Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade