Navigation: Realtest Script Language > Syntax Element Details >

Extern

 

 

 

 

Category

General-Purpose Functions

Description

Evaluate for a different stock/contract or strategy or bar size

Syntax

Extern(item_reference, expression)

Parameters

item_reference - a stock symbol, a strategy name, or a bar size

expression - formula

Notes

The default context in all formulas is the current stock for bar data items and the current strategy for daily stats items.

Extern allows you temporarily change context to a different stock or strategy or bar size.

To reference a stock, use a $ to prefix the symbol of the desired stock, e.g. Extern($MSFT, C)

To reference a Strategy, Benchmark or StatsGroup, use a @ to prefix the name of the desired strategy, e.g. Extern(@mr_short, S.Equity)

To calculate a formula using a specific bar size, use a ~ to prefix the name of the bar size, e.g. Extern(~Weekly, MA(C, 20))

Note that the expression referenced can be any formula, and it is most efficient to do as much as possible in a single Extern function. For example, Extern($SPY, C > MA(C,20)) would be preferable to Extern($SPY,C) > Extern($SPY, MA(C,20)) or, even worse, Extern($SPY,C) > MA(Extern($SPY,C), 20) -- though all would return the same result.

If a stock symbol already starts with a $, e.g. $SPX, you will have to add another $, hence Extern($$SPX, C). See Symbol Constants for more information about these.

There are also special types of Extern references available for individual futures contracts and corresponding industry index symbols.

It is also possible to refer to a dynamic (non-constant) external symbol, either by string or number, using SymNum.

 

 

 

 

 

Copyright © 2020-2022 Systematic Solutions, LLC