---
id: "M:cAlgo.API.Indicator.ExecuteMarketRangeOrderAsync(cAlgo.API.TradeType,System.String,System.Double,System.Double,System.Double,System.Action{cAlgo.API.TradeResult})"
kind: "method"
type: "T:cAlgo.API.Indicator"
url: "https://help.ctrader.com/ctrader-algo/references/General/Indicator/ExecuteMarketRangeOrderAsync/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Indicator.ExecuteMarketRangeOrderAsync

Member of [Indicator](https://help.ctrader.com/ctrader-algo/references/General/Indicator/index.md).

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLossPips: float | None, takeProfitPips: float | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLossPips` (`double?`, Python `float | None`): Stop loss in pips
- `takeProfitPips` (`double?`, Python `float | None`): Take profit in pips
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", 10, 20, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", 10, 20, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLossPips: float | None, takeProfitPips: float | None, comment: str, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLossPips` (`double?`, Python `float | None`): Stop loss in pips
- `takeProfitPips` (`double?`, Python `float | None`): Take profit in pips
- `comment` (`string`, Python `str`): Order comment
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", 10, 20, "order comment", result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", 10, 20, "order comment", lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `comment` (`string`, Python `str`): Order comment
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `comment` (`string`, Python `str`): Order comment
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLossPips: float | None, takeProfitPips: float | None, comment: str, hasTrailingStop: bool, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLossPips` (`double?`, Python `float | None`): Stop loss in pips
- `takeProfitPips` (`double?`, Python `float | None`): Take profit in pips
- `comment` (`string`, Python `str`): Order comment
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", 10, 20, "order comment", true, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", 10, 20, "order comment", True, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, hasTrailingStop: bool, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `comment` (`string`, Python `str`): Order comment
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", true, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", True, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, hasTrailingStop: bool, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `comment` (`string`, Python `str`): Order comment
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", true, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", True, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLossPips: float | None, takeProfitPips: float | None, comment: str, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLossPips` (`double?`, Python `float | None`): Stop loss in pips
- `takeProfitPips` (`double?`, Python `float | None`): Take profit in pips
- `comment` (`string`, Python `str`): Order comment
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", 10, 20, "order comment", true, StopTriggerMethod.Trade, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", 10, 20, "order comment", True, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `comment` (`string`, Python `str`): Order comment
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", true, StopTriggerMethod.Trade, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", True, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ExecuteMarketRangeOrderAsync(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(tradeType: TradeType, symbolName: str, volume: float, marketRangePips: float, basePrice: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `tradeType` (`TradeType`, Python `TradeType`): Direction of trade
- `symbolName` (`string`, Python `str`): Symbol name of trade
- `volume` (`double`, Python `float`): Volume (in units) of trade
- `marketRangePips` (`double`, Python `float`): The market range (slippage) in Pips
- `basePrice` (`double`, Python `float`): Base price to calculate relative slippage price
- `label` (`string`, Python `str`): Label representing the order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `comment` (`string`, Python `str`): Order comment
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Event raised when position is opened

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol.Name, 10000, 2, Symbol.Bid, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", true, StopTriggerMethod.Trade, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ExecuteMarketRangeOrderAsync(TradeType.Buy, api.Symbol.Name, 10000, 2, api.Symbol.Bid, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", True, StopTriggerMethod.Trade, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

