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
Additional
properties, methods, and events are described in the classes listed
under Inheritance Hierarchy (see below).
|
Name |
Type |
Description |
|
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. |
|
Count |
int |
The number of available positions based on the filter criteria. |
|
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.
|
|
ExtendedFilter |
object |
The DynamicProperties object filter that may be applied to the data provider to select retrieved data based upon ExtendedProperties. |
|
Position[index] |
object |
Gets a Position object for the specified index Position. |
|
Position[symbol,account] |
object |
Gets a Position object for the specified symbol name and account id strings. |
|
Position[positionId] |
object |
Gets the Position object for the specified positionid string. |
|
Position[symbol,account,postype] |
object |
Gets a Position object for the specified symbol name and account id strings strings of PositionType. |
|
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. |
|
TryPosition[symbol,account] |
object |
Gets the
Position object, if present, based
on the specified symbol and account, otherwise return a null. |
|
TryPosition[positionID] |
object |
Gets the
Position object, if present, based
on the specified positionID string, otherwise return a null. |
|
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". |
|
Name |
Description |
|
Create() |
Initializes a new instance of the class. |
|
Contains(pos) |
True if the specified Position is contained in the provider. |
|
Contains(symbol,account) |
True if the specified Symbol and Account strings are contained in the provider. |
|
Name |
Description |
 |
Updated |
Occurs whenever a Position is updated in the provider. See PositionUpdatedEventArgs for the properties returned by the handler's args parameters. |
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.
- Click on the Import Example link to import the example into TradeStation.
- 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.
- To review or modify the example code, go to the TS Development Environment and open indicator !ex_PosProvider in the EasyLanguage Editor.