Category

General-Purpose Functions

Description

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

Syntax

Extern(item_reference, expression)

Parameters

item_reference - either a stock symbol or a strategy name

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.

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

To reference a strategy, 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 an other $, hence Extern($$SPX, C).

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

 

 

 

 

 

Copyright © 2020-2021 Systematic Solutions, LLC