Indicator.ReversePosition
method · Indicator · cAlgo.API
DesktopCLICloud
Modify the direction of trade at position
Overloads
| Signature | Description |
|---|---|
ReversePosition(Position position) | Modify the direction of trade at position |
ReversePosition(Position position, double volume) | Modify the direction of trade and volume of a position |
ReversePosition(Position position)
Modify the direction of trade at position
public TradeResult ReversePosition(Position position)
api.ReversePosition(position: Position) -> TradeResult
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
position | Position | Position | Position which is affected |
Returns TradeResult — Trade Result
Examples
ReversePosition(Positions[0]);
api.ReversePosition(api.Positions[0])
ReversePosition(Position position, double volume)
Modify the direction of trade and volume of a position
public TradeResult ReversePosition(Position position, double volume)
api.ReversePosition(position: Position, volume: float) -> TradeResult
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
position | Position | Position | Position which is affected |
volume | double | float | Volume (in units) of Trade |
Returns TradeResult — Trade Result
Examples
Example 1
ReversePosition(Positions[0]);
api.ReversePosition(api.Positions[0])
Example 2
ReversePosition(Positions[0], 10000);
api.ReversePosition(api.Positions[0], 10000)