Opens a position of the specified type.

Namespace: RightEdge.Common
Assembly: Common (in Common.dll) Version: 2010.1.0.0 (2010.1.0.0)


public Position OpenPosition(
	Symbol symbol,
	PositionType positionType,
	OrderType orderType,
	double price
Visual Basic
Public Function OpenPosition ( 
	symbol As Symbol,
	positionType As PositionType,
	orderType As OrderType,
	price As Double
) As Position
Visual C++
Position^ OpenPosition(
	Symbol^ symbol, 
	PositionType positionType, 
	OrderType orderType, 
	double price
member OpenPosition : 
        symbol : Symbol * 
        positionType : PositionType * 
        orderType : OrderType * 
        price : float -> Position 


Type: RightEdge.Common..::..Symbol
the Symbol to open the position for.
Type: RightEdge.Common..::..PositionType
the PositionType. See the PositionType enumeration
Type: RightEdge.Common..::..OrderType
the type of order. See the OrderType enumeration
Type: System..::..Double
the price that must be met to open a limit or stop style order

Return Value

Type: Position
A newly created Position object.


This function is used for all order types.


If the OpenPosition call succeeded, the Error property of the returned position will be null. If the call failed, then this property will contain a description of the error.

Note that success does not mean that the order was filled by the broker, just that an order was successfully sent to the broker. When this method returns successfully, the PositionState of the returned position will be Pending. If and when the order is filled, the state will change to Open.


Opening a Position on a band violation (C#)
 Copy imageCopy
// Use NewSymbolBar to detect when a new bar has come in.
public override void NewSymbolBar(Symbol symbol, BarData bar)
    // Retrieve the latest Widner Lower band value.
    IIndicator widnerLower = Indicators["WidnerLower"][symbol];
    double targetPrice = widnerLower[widnerLower.Count - 1];

    // Send an order to open a position when the targetPrice is reached (limit order).
    baseSystem.OpenPosition(symbol, PositionType.Long, OrderType.Limit, targetPrice);

See Also