Series Type

QuantScript's Series type is a container type. Additionally, it is the only type which can use [] Time travel to actually get a different (past) value from the current one it contains.

Container types contain within them a single value of one of the following types: Number, Boolean, Day or Time.

Whenever [] Time travel is used on a series, the result is still a series, however its contained type and value may be different.

Though discouraged, it is possible to have a series which contains different types at different points in time, e.g:

1 series dontDoThis:
2 once: 0
3 # Some times a Number, other times a Boolean...
4 then: 50 if close > close[1] else true

Additionally, a value of type Series is linked to exactly zero or one dataset.

For example:

1 # Let's say this code executes in the context of a EURUSD:1h dataset
2
3 # mySeries1 is linked to the EURUSD:1h dataset
4 mySeries1 = open + close
5
6 # mySeries2 is linked to the Gold:4h dataset
7 Gold:4h mySeries2 = open + close
8
9 # mySeries3 is not linked to any dataset
10 series mySeries3:
11 once: 0
12 then: mySeries3 + 1

Unary Operand Behaviour

Anything not listed here results in an Unknown

OperatorOperandResult
-Series<Number>Series<Number>
notSeries<Boolean>Series<Boolean>
isknownSeries<Any>Series<Boolean>

Binary Operand Behaviour

Anything not listed here results in an Unknown

Left OperandOperatorRight OperandResult
Series<Number>+, -, *, /, %, **, //NumberSeries<Number>
Series<Number>+, -, *, /, %, **, //Series<Number> same datasetSeries<Number>
Series<Number>+, -, *, /, %, **, //Series<Number> diff. datasetMultiDataset<Number>
Series<Number>+, -, *, /, %, **, //MultiDataset<Number>MultiDataset<Number>
Series<Number>>, >=, <, <=, ==, !=NumberSeries<Boolean>
Series<Number>>, >=, <, <=, ==, !=Series<Number> same datasetSeries<Boolean>
Series<Number>>, >=, <, <=, ==, !=Series<Number> diff. datasetMultiDataset<Boolean>
Series<Number>>, >=, <, <=, ==, !=MultiDataset<Number>MultiDataset<Boolean>
Series<Day>>, >=, <, <=, ==, !=DaySeries<Boolean>
Series<Day>>, >=, <, <=, ==, !=Series<Day> same datasetSeries<Boolean>
Series<Day>>, >=, <, <=, ==, !=Series<Day> diff. datasetMultiDataset<Boolean>
Series<Day>>, >=, <, <=, ==, !=MultiDataset<Day>MultiDataset<Boolean>
Series<Time>>, >=, <, <=, ==, !=TimeSeries<Boolean>
Series<Time>>, >=, <, <=, ==, !=Series<Time> same datasetSeries<Boolean>
Series<Time>>, >=, <, <=, ==, !=Series<Time> diff. datasetMultiDataset<Boolean>
Series<Time>>, >=, <, <=, ==, !=MultiDataset<Time>MultiDataset<Boolean>
Series<Boolean>and, orBooleanSeries<Boolean>
Series<Boolean>and, orSeries<Boolean> same datasetSeries<Boolean>
Series<Boolean>and, orSeries<Boolean> diff. datasetMultiDataset<Boolean>
Series<Boolean>and, orMultiDataset<Boolean>MultiDataset<Boolean>
Series<Any>[] Time travelAnySeries<Any>
Series<Any>() Function callAnyError