Variables, Lists, Pipes

Actions, Variables, and Data Pipes

Variables provide a way of labeling data with a descriptive name, so code can be understood more clearly.

myVariable = SPY.close

The notation “->” designates a data pipe used to send a time series or other data to an action.

Actions take data in and produce data out and are formatted as nameOfAction(parameters).

spyClose = SPY.close -> sma(20)

Multiple actions can be chained together in a single statement:

spyClose = SPY.close -> rsi(20) -> sma(20)

Comments

The characters "//" start a comment. Anything following on the same line is not executable EQL. There is no syntax for multi-line comments.

// This is a full-line comment
x = SPY.close    // this is also a comment

Parentheses

Parentheses can be used to control the order of execution of complex statements. For example, to sum rows and pass the sum to an action:

rowSum = (SPY.close + AMZN.close + ORCL.close) -> cume()

List Brackets [ ]

Brackets are used to group lists of items:

myList = [MSFT, AMZN, ORCL].close
myList= [ORCL.close, MSFT.close, SPY.close]

Ensembling Brackets @[:]

Brackets can be used to create a list (ensemble) from a set of consecutive rows.

This can be used to create a list of candidates for further operations.

fromHere:
MSFT.close -> sma(40)
SPY.close -> sma(40)
ORCL.close -> sma(40)
toHere:
listOfRows = @[fromHere : toHere]

Braces { }

  • Braces are used to denote a specific item in a list. The indexing is one-based.

  • They are most commonly used to address a specific TimeSeries in a list of TimeSeries

closeList = [MSFT,SPY,ORCL].close
thirdClose = closeList{3}

Symbols and Attributes

The symbol names of assets (cryptocurrency, security, ETF, etc) must always be capitalized

[MSFT, SPY, ORCL]

Attributes are values or metrics attached to a symbol or symbolList, using a period plus the attribute name.

The current list of attributes available:

  • open, high, low, close

  • ohlc

  • volume

// Price attribute (ohlc shows a candlestick chart with open/high/low/close): 
SPY.close
SPY.ohlc
  
// Price/volume attribute:
SPY.proxy

// Attribute applied to a list of symbols
[SPY, AMZN].close
[SPY, AMZN].proxy
// Attributes can be applied inside a list
[SPY.open, ORCL.close, MSFT.open, AMZN.close]

The ohlc attribute displays a candlestick chart of open, high, low, and close. When used in further calculations, ohlc is equivalent to the close attribute.

Last updated