Navigation: Realtest Script Language >

Symbol Constants

 

 

 

 

The Symbol syntax element returns the alphabetical ordinal number of the current symbol in the currently loaded DataFile.

The main use of this number is to compare it to a specific symbol.

For this purpose, every symbol in the current data set can be referenced as a constant beginning with a dollar sign, e.g. $MSFT.

Symbol constants simply return the ordinal number of the specified symbol if it exists in the current data, or 0 if not.

The most common use of symbol constants is when constraining a strategy to only trade a specific symbol, as in this example:

Note that if a symbol already begins with a dollar sign, e.g. $SPX, then it must be stated with a double dollar sign, i.e. $$SPX, when used as a symbol constant. The first $ tells RealTest that you're looking for a symbol, and the second $ is literally part of the symbol.

See also:

?Symbol - returns the current symbol as a string (without the leading $)

SymNum - looks up a symbol string (without the leading $) and returns the Symbol number

If the current symbol is MSFT, then any of the following will return its symbol number:

$MSFT

Symbol

SymNum(Symbol)

SymNum(?Symbol)

SymNum("MSFT")

 

 

 

 

Copyright © 2020-2024 Systematic Solutions, LLC