Navigation: Realtest Script Language > Syntax Element Details >

Shares or Contracts

 

 

 

Category

Current Position Information

Description

Returns the number of shares or contracts held in the current position

Notes

This element can be referred to as either Shares or Contracts, regardless of the type of instrument being traded.

The number returned is the number of shares (or contracts) held in the current position for the current strategy only.

To get the number of shares of the current symbol held in a different strategy, use Extern(strategy_name, Shares).

To get the number of shares of the current symbol held in all strategies, use Combined(Shares).

One typical use of Shares is to enforce a rule that only one strategy at a time can hold a position in a stock. This can be done by adding and Combined(Shares) == 0 to every strategy's EntrySetup condition, or (more conveniently) by using a Template EntrySkip condition of Combined(Shares) > 0.

Another common usage of Shares is in the standard IB commission calculation: Max(1.0, 0.005 * Shares).

 

 

 

Copyright © 2020-2021 Systematic Solutions, LLC