- Accounts & Connection Management
- Data Management & Analysis
- Price Monitoring
- Charting
- Trading
- Scanners
-
Builders
-
Manual Strategy Builder
- Main Concept
- Operand Component
- Algo Elements
-
Use Cases
- How to create a condition on something crossing something
- How to create an indicator based on another indicator
- How to calculate a stop loss based on indicator
- How to submit stop order based on calculated price
- How to calculate a current bar price using a price type from inputs
- How to Use a Closed Bar Price
- Automatic Strategy Builder
-
Manual Strategy Builder
- Autotrading
- FinScript
- Trade Analysis
- Media Feeds
- Logs & Notifications
- UI & UX
OnPositionUpdate - a handler to handle a position update events.
Position is a class that describes current open position for specific instrument. Each Position instance is generated by broker. Pay attention that all properties of position are read-only and cannot be changed in instance after its creation.In other words, position is immutable and, consequently is thread-safe. That's why Position has no any change events. Once you get the reference to the position object, you can be sure that all its properties won't change. It means that each time a position is changing a broker adapter creates a new instance, so each position changed event is accompanied by new instance. Also, each position list request may generate new instances of positions (depending on broker adapter implementation).So, never compare positions by object references. Use Instrument or Order.OrderId instead. Pay attention that constructors of position are hidden and the class is abstract. It is impossible to create position outside. The position can be created by broker only. And each broker must create its own derived classes to be able to create position instances.
protected override void OnPositionUpdate(TradeManagerClass tradeManager, Position position)
{
//Write your code here
}
- Accounts & Connection Management
- Data Management & Analysis
- Price Monitoring
- Charting
- Trading
- Scanners
-
Builders
-
Manual Strategy Builder
- Main Concept
- Operand Component
- Algo Elements
-
Use Cases
- How to create a condition on something crossing something
- How to create an indicator based on another indicator
- How to calculate a stop loss based on indicator
- How to submit stop order based on calculated price
- How to calculate a current bar price using a price type from inputs
- How to Use a Closed Bar Price
- Automatic Strategy Builder
-
Manual Strategy Builder
- Autotrading
- FinScript
- Trade Analysis
- Media Feeds
- Logs & Notifications
- UI & UX