PositionsProvider Class (Component)

The PositionsProvider allows access to updated information about positions held for specified symbols and order types from a list of TradeStation accounts. This information is similar to that found on the Positions tab of the TradeManager. The Position class describes the properties available for a specific position.

Typically, you will use the Toolbox to add a component to your EasyLanguage document. Click and drag the name PositionsProvider into your document from the Toolbox.  By default, the name of the provider appears in the component tray at the bottom of your document followed by a number (to help identify multiple instances of the component).  

Open the Properties editor and locate the Accounts, Symbols, or Types properties under "Filters". By default, these fields are blank so all position objects will be available. A comma delimited list of account numbers, symbols, or types  (e.g., "SIM12345, SIM67890") specifies that only those listed are to be included in the Positions collection queried by the PositionsProvider.  

To reference property values for a specific position object in EasyLanguage code, use PositionProvider1 followed by a 'dot operator' and the collection name Position[parameter] followed by a 'dot operator' and the position property name. Parameter can be a numeric index (zero-based) that represents a Position object within the positions provider collection or a string containing a specific symbol and a string containing the AccountID.  Available positions properties will appear in the autocomplete list as soon as you type the 'dot' after position[parameter].  Properties are also listed under Position class in the dictionary and help.

Value1=PositionsProvider1.Position[0].MarketValue;      // gets the actual market value for the first position [0] in the collection.

  The provider can only access positions that are associated with the current TradeStation logon.

For general information about providers, refer to Provider Classes.

Namespace: tsdata.trading

Properties

   Additional properties, methods, and events are described in the classes listed under Inheritance Hierarchy (see below).

  Name Type Description
Public property Accounts list Specifies an optional comma-delimited TokenList of trading accounts you want to query and monitor for positions. When blank, no account filtering takes place.
Public property Count int The number of available positions based on the filter criteria.
Public property Data object

Gets the Positions collection associated with the current instance. The Position objects included in the collection may be filtered based on items specified in the Accounts, Symbols, and Types properties.

Public property ExtendedFilter object The DynamicProperties object filter that may be applied to the data provider to select retrieved data based upon ExtendedProperties.
Public property Position[index] object Gets a Position object for the specified index Position.
Public property Position[symbol,account] object Gets a Position object for the specified symbol name and account id strings.
Public property Position[positionId] object Gets the Position object for the specified positionid string.
Public property Position[symbol,account,postype] object Gets a Position object for the specified symbol name and account id strings strings of PositionType.
Public property Symbols list Specifies an optional comma-delimited TokenList of symbol names whose positions you want to query and monitor. When blank, no symbol filtering takes place.
Public property TryPosition[symbol,account] object Gets the Position object, if present, based on the specified symbol and account, otherwise return a null.
Public property TryPosition[positionID] object Gets the Position object, if present, based on the specified positionID string, otherwise return a null.
Public property Types list Specifies an optional comma-delimited TokenList of position types associated with positions you want to query and monitor. When blank, no position type filtering takes place. Possible position types include: "any", "long", and "short".
Methods
  Name Description
Public property Create() Initializes a new instance of the class.
Public property Contains(pos) True if the specified Position is contained in the provider.
Public property Contains(symbol,account) True if the specified Symbol and Account strings are contained in the provider.
Events
  Name Description
 Public event Updated Occurs whenever a Position is updated in the provider. See PositionUpdatedEventArgs for the properties returned by the handler's args parameters.
Example

The following RadarScreen example uses a PositionsProvider to display updated position information for any symbol row for which you have a position.  By default, this example shows positions from all accounts and for any type of position.  

Import Example

PositionsProvider indicator for RadarScreen

  1. Click on the Import Example link to import the example into TradeStation.   
  2. Go to the TradeStation platform and create a RadarScreen window containing symbols with positions.  Use the Insert - Indicator menu sequence and Add !ex_PosProvider to the RadarScreen window at the selected column location.
  3. To review or modify the example code, go to the TS Development Environment and open indicator !ex_PosProvider in the EasyLanguage Editor.