Skip to content

Robot

Summary

Base class for all cBots.

Remarks

Provides a convenient framework for creating cBots including methods to create, modify, cancel orders and close positions, methods triggered by each tick and each bar, access to built-in Indicators and more.

Signature

1
public class Robot : Algo

Namespace

cAlgo.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 namespace cAlgo.Robots
 {
 [Robot]
 public class myCBot : Robot
 {
     protected override void OnStart()
     {
         //This method is called when the cBot is being started, once.
     }
     protected override void OnBar()
     {
         // Called on each incoming Bar.
     }
     protected override void OnTick()
     {
         // Called on each incoming tick.
     }
     protected override void OnError(Error error)
     {
         Print("There has been an Error");
     }
     protected override void OnStop()
     {
         //This method is called when the cBot is being stoped.
     }
}

Methods

Stop

Summary

Stops the cBot. cBot will be completely stopped and will not send/receive any signals.

Signature

1
public void Stop()

Return Value

void

Examples

1
2
3
4
5
 // Will stop the cBot if the balance of the account goes under 1000
 if(Account.Balance < 1000)
 {
     Stop();
 }

ToString

Summary

Returns the cBot class name

Signature

1
public string ToString()

Return Value

string

Examples

1
2
3
4
 protected override void OnStart()
 {
     Print(ToString());
 }

PlaceLimitOrder (19)

PlaceLimitOrder (1 of 19)

Summary

Place a Limit Order

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled

Return Value

TradeResult

PlaceLimitOrder (2 of 19)

Summary

Place a Limit Order

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
label string Label representing the order

Return Value

TradeResult

PlaceLimitOrder (3 of 19)

Summary

Place a Limit Order

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

PlaceLimitOrder (4 of 19)

Summary

Place a Limit Order

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time

Return Value

TradeResult

PlaceLimitOrder (5 of 19)

Summary

Place a Limit Order

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time
comment string Order comment

Return Value

TradeResult

Examples

1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 100000,
                 Symbol.Bid - 2*Symbol.PipSize);
1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 200000,
             Symbol.Bid - 2*Symbol.PipSize, "myLabel");
1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 Symbol.Bid - 5*Symbol.PipSize, "112", 10, 10);
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry);
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry, "first order");

PlaceLimitOrder (6 of 19)

Summary

Place a Limit Order

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position

Return Value

TradeResult

Examples

1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 100000,
                 Symbol.Bid - 2*Symbol.PipSize);
1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 200000,
             Symbol.Bid - 2*Symbol.PipSize, "myLabel");
1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 Symbol.Bid - 5*Symbol.PipSize, "112", 10, 10);
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry);
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry, "first order");
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry, "first order", HasTrailingStop);

PlaceLimitOrder (7 of 19)

Summary

Place a Limit Order

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss

Return Value

TradeResult

Examples

1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 100000,
                 Symbol.Bid - 2*Symbol.PipSize);
1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 200000,
             Symbol.Bid - 2*Symbol.PipSize, "myLabel");
1
2
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 Symbol.Bid - 5*Symbol.PipSize, "112", 10, 10);
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry);
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry, "first order");
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry, "first order", HasTrailingStop);
1
2
3
4
 double targetPrice = Symbol.Bid - 5*Symbol.PipSize;
 DateTime expiry = DateTime.Now.AddMinutes(30);
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000,
                 targetPrice, "112", 10, 10, expiry, "first order", HasTrailingStop, StopTriggerMethod.Trade);

PlaceLimitOrder (8 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume of trade
targetPrice double Target price (or better) at which the order is filled

Return Value

TradeResult

PlaceLimitOrder (9 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled

Return Value

TradeResult

PlaceLimitOrder (10 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order

Return Value

TradeResult

PlaceLimitOrder (11 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order

Return Value

TradeResult

PlaceLimitOrder (12 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
stopLossPips double? Stop loss in pips from target price
takeProfitPips double? Take profit in pips from target price

Return Value

TradeResult

Examples

1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel");
1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10,10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000, Symbol.Bid, LimitOrderOnPlaced);
 }
 private void LimitOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Limit order placed {0}", tradeResult.PendingOrder.Label);
 }

PlaceLimitOrder (13 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
stopLossPips double? Stop loss in pips from target price
takeProfitPips double? Take profit in pips from target price

Return Value

TradeResult

Examples

1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel");
1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10,10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000, Symbol.Bid, LimitOrderOnPlaced);
 }
 private void LimitOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Limit order placed {0}", tradeResult.PendingOrder.Label);
 }
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", HasTrailingStop);

PlaceLimitOrder (14 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
stopLossPips double? Stop loss in pips from target price
takeProfitPips double? Take profit in pips from target price
expiration DateTime? Order expiry date and time

Return Value

TradeResult

Examples

1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel");
1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10,10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000, Symbol.Bid, LimitOrderOnPlaced);
 }
 private void LimitOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Limit order placed {0}", tradeResult.PendingOrder.Label);
 }
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", HasTrailingStop);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", HasTrailingStop, StopTriggerMethod.Trade);

PlaceLimitOrder (15 of 19)

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?

Return Value

TradeResult

PlaceLimitOrder (16 of 19)

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string

Return Value

TradeResult

PlaceLimitOrder (17 of 19)

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string

Return Value

TradeResult

PlaceLimitOrder (18 of 19)

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool

Return Value

TradeResult

PlaceLimitOrder (19 of 19)

Signature

1
public TradeResult PlaceLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?

Return Value

TradeResult

PlaceLimitOrderAsync (19)

PlaceLimitOrderAsync (1 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
callback Action The action when the position closes

Return Value

TradeOperation

PlaceLimitOrderAsync (2 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
callback Action The action when the position closes

Return Value

TradeOperation

PlaceLimitOrderAsync (3 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
callback Action The action when the position closes

Return Value

TradeOperation

PlaceLimitOrderAsync (4 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
callback Action The action when the position closes

Return Value

TradeOperation

PlaceLimitOrderAsync (5 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
stopLossPips double? Stop loss in pips from target price
takeProfitPips double? Take profit in pips from target price
expiration DateTime? Order expiry date and time
comment string Order comment
callback Action The action when the position closes

Return Value

TradeOperation

Examples

1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel");
1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10,10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000, Symbol.Bid, LimitOrderOnPlaced);
 }
 private void LimitOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Limit order placed {0}", tradeResult.PendingOrder.Label);
 }

PlaceLimitOrderAsync (6 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
stopLossPips double? Stop loss in pips from target price
takeProfitPips double? Take profit in pips from target price
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
callback Action The action when the position closes

Return Value

TradeOperation

Examples

1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel");
1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10,10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000, Symbol.Bid, LimitOrderOnPlaced);
 }
 private void LimitOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Limit order placed {0}", tradeResult.PendingOrder.Label);
 }
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", HasTrailingStop);

PlaceLimitOrderAsync (7 of 19)

Summary

Place limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Target price (or better) at which the order is filled
label string Label that represents the order
stopLossPips double? Stop loss in pips from target price
takeProfitPips double? Take profit in pips from target price
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
callback Action The action when the position closes

Return Value

TradeOperation

Examples

1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel");
1
2
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10,10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000, Symbol.Bid, LimitOrderOnPlaced);
 }
 private void LimitOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Limit order placed {0}", tradeResult.PendingOrder.Label);
 }
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", HasTrailingStop);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceLimitOrderAsync(TradeType.Buy, Symbol, 10000,
                     Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", HasTrailingStop, StopTriggerMethod.Trade);

PlaceLimitOrderAsync (8 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (9 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (10 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (11 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (12 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (13 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (14 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (15 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (16 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (17 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (18 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
callback Action

Return Value

TradeOperation

PlaceLimitOrderAsync (19 of 19)

Signature

1
public TradeOperation PlaceLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?
callback Action

Return Value

TradeOperation

ExecuteMarketOrder (18)

ExecuteMarketOrder (1 of 18)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, string symbolName, double volume)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade

Return Value

TradeResult

ExecuteMarketOrder (2 of 18)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, string symbolName, double volume, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Representing label

Return Value

TradeResult

ExecuteMarketOrder (3 of 18)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

ExecuteMarketOrder (4 of 18)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string order comment

Return Value

TradeResult

Examples

1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000);
1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000, "Robot1");
1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, "myLabel", 10, 10);
1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000, "Robot1", 10, 10, 2);
1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment");

ExecuteMarketOrder (5 of 18)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string order comment
hasTrailingStop bool Enable/disable TrailingStop for position

Return Value

TradeResult

Examples

1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000);
1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000, "Robot1");
1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, "myLabel", 10, 10);
1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000, "Robot1", 10, 10, 2);
1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment");
1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment", HasTrailingStop);

ExecuteMarketOrder (6 of 18)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss

Return Value

TradeResult

Examples

1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000);
1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000, "Robot1");
1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, "myLabel", 10, 10);
1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000, "Robot1", 10, 10, 2);
1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment");
1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment", HasTrailingStop);
1
2
 ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, 
 "this is a comment", HasTrailingStop, StopTriggerMethod.Trade);

ExecuteMarketOrder (7 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, long volume)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume (in units) of trade

Return Value

TradeResult

ExecuteMarketOrder (8 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, double volume)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade

Return Value

TradeResult

ExecuteMarketOrder (9 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, long volume, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume (in units) of trade
label string Label representing the order

Return Value

TradeResult

ExecuteMarketOrder (10 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, double volume, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
label string Label representing the order

Return Value

TradeResult

Examples

1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", OnOpened);

ExecuteMarketOrder (11 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, long volume, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume (in units) of trade
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

Examples

1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", OnOpened);
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", HasTrailingStop, OnOpened);

ExecuteMarketOrder (12 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

Examples

1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", OnOpened);
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", HasTrailingStop, OnOpened);
1
2
 ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, 
                    "this is a comment", HasTrailingStop, StopTriggerMethod.Trade);

ExecuteMarketOrder (13 of 18)

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, long volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?

Return Value

TradeResult

ExecuteMarketOrder (14 of 18)

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?

Return Value

TradeResult

ExecuteMarketOrder (15 of 18)

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, long volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, string comment)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
comment string

Return Value

TradeResult

ExecuteMarketOrder (16 of 18)

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, string comment)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
comment string

Return Value

TradeResult

ExecuteMarketOrder (17 of 18)

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
comment string
hasTrailingStop bool

Return Value

TradeResult

ExecuteMarketOrder (18 of 18)

Signature

1
public TradeResult ExecuteMarketOrder(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?

Return Value

TradeResult

ExecuteMarketOrderAsync (18)

ExecuteMarketOrderAsync (1 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
callback Action Event raised when position is opened

Return Value

TradeOperation

ExecuteMarketOrderAsync (2 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Label representing the order
callback Action Event raised when position is opened

Return Value

TradeOperation

ExecuteMarketOrderAsync (3 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
callback Action Event raised when position is opened

Return Value

TradeOperation

ExecuteMarketOrderAsync (4 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string Order comment
callback Action Event raised when position is opened

Return Value

TradeOperation

Examples

1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", OnOpened);

ExecuteMarketOrderAsync (5 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
callback Action Event raised when position is opened

Return Value

TradeOperation

Examples

1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", OnOpened);
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", HasTrailingStop, OnOpened);

ExecuteMarketOrderAsync (6 of 18)

Summary

Execute a market order in asynchronous execution mode

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
callback Action Event raised when position is opened

Return Value

TradeOperation

Examples

1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", OnOpened);
1
2
 ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, 
                         "order comment", HasTrailingStop, OnOpened);
1
2
 ExecuteMarketOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, 
                    "this is a comment", HasTrailingStop, StopTriggerMethod.Trade);

ExecuteMarketOrderAsync (7 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, long volume, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (8 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, double volume, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (9 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, long volume, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
label string
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (10 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, double volume, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (11 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, long volume, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
label string
stopLossPips double?
takeProfitPips double?
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (12 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (13 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, long volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (14 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (15 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, long volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
comment string
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (16 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
comment string
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (17 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
comment string
hasTrailingStop bool
callback Action

Return Value

TradeOperation

ExecuteMarketOrderAsync (18 of 18)

Signature

1
public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, Symbol symbol, double volume, string label, double? stopLossPips, double? takeProfitPips, double? marketRangePips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
label string
stopLossPips double?
takeProfitPips double?
marketRangePips double?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?
callback Action

Return Value

TradeOperation

ExecuteMarketRangeOrder (6)

ExecuteMarketRangeOrder (1 of 6)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketRangeOrder(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price

Return Value

TradeResult

ExecuteMarketRangeOrder (2 of 6)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketRangeOrder(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Representing label

Return Value

TradeResult

ExecuteMarketRangeOrder (3 of 6)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketRangeOrder(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

ExecuteMarketRangeOrder (4 of 6)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketRangeOrder(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string order comment

Return Value

TradeResult

Examples

1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000);
1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000, "Robot1");
1
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 10000, "myLabel", 10, 10);
1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000, "Robot1", 10, 10, 2);
1
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment");

ExecuteMarketRangeOrder (5 of 6)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketRangeOrder(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string order comment
hasTrailingStop bool Enable/disable TrailingStop for position

Return Value

TradeResult

Examples

1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000);
1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000, "Robot1");
1
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 10000, "myLabel", 10, 10);
1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000, "Robot1", 10, 10, 2);
1
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment");
1
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment", HasTrailingStop);

ExecuteMarketRangeOrder (6 of 6)

Summary

Execute a Market Order

Signature

1
public TradeResult ExecuteMarketRangeOrder(TradeType tradeType, string symbolName, double volume, double marketRangePips, double basePrice, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss

Return Value

TradeResult

Examples

1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000);
1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000, "Robot1");
1
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 10000, "myLabel", 10, 10);
1
 ExecuteMarketRangeOrder(TradeType.Sell, Symbol, 10000, "Robot1", 10, 10, 2);
1
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment");
1
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage, "this is a comment", HasTrailingStop);
1
2
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage,
 "this is a comment", HasTrailingStop, StopTriggerMethod.Trade);

ExecuteMarketRangeOrderAsync (6)

ExecuteMarketRangeOrderAsync (1 of 6)

Summary

Execute a market order in asynchronous execution mode

Signature

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

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
callback Action Event raised when position is opened

Return Value

TradeOperation

ExecuteMarketRangeOrderAsync (2 of 6)

Summary

Execute a market order in asynchronous execution mode

Signature

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

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Label representing the order
callback Action Event raised when position is opened

Return Value

TradeOperation

ExecuteMarketRangeOrderAsync (3 of 6)

Summary

Execute a market order in asynchronous execution mode

Signature

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

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
callback Action Event raised when position is opened

Return Value

TradeOperation

ExecuteMarketRangeOrderAsync (4 of 6)

Summary

Execute a market order in asynchronous execution mode

Signature

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

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string Order comment
callback Action Event raised when position is opened

Return Value

TradeOperation

Examples

1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2,
                         "order comment", OnOpened);

ExecuteMarketRangeOrderAsync (5 of 6)

Summary

Execute a market order in asynchronous execution mode

Signature

1
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)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
callback Action Event raised when position is opened

Return Value

TradeOperation

Examples

1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2,
                         "order comment", OnOpened);
1
2
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2,
                         "order comment", HasTrailingStop, OnOpened);

ExecuteMarketRangeOrderAsync (6 of 6)

Summary

Execute a market order in asynchronous execution mode

Signature

1
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)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
marketRangePips double The market range (slippage) in Pips
basePrice double Base price to calculate relative slippage price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
callback Action Event raised when position is opened

Return Value

TradeOperation

Examples

1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel");
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2);
1
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2, "order comment");
1
2
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2,
                         "order comment", OnOpened);
1
2
 ExecuteMarketRangeOrderAsync(TradeType.Buy, Symbol, 10000, "myLabel", 10, 20, 2,
                         "order comment", HasTrailingStop, OnOpened);
1
2
 ExecuteMarketRangeOrder(TradeType.Buy, Symbol, 5000, "myRobot", StopLoss, TakeProfit, Slippage,
                    "this is a comment", HasTrailingStop, StopTriggerMethod.Trade);

CancelPendingOrder

Summary

Cancel a Pending Order

Signature

1
public TradeResult CancelPendingOrder(PendingOrder pendingOrder)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected

Return Value

TradeResult

Examples

1
2
3
4
 foreach (var order in PendingOrders)
 {
     CancelPendingOrder(order);
 }

ModifyPendingOrder (10)

ModifyPendingOrder (1 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price

Return Value

TradeResult

Examples

1
2
3
4
5
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice);
 }

ModifyPendingOrder (2 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price
stopLossPips double? New stop loss pips value from target price
takeProfitPips double? New take profit pips value from target price

Return Value

TradeResult

Examples

1
2
3
4
5
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips);
 }

ModifyPendingOrder (3 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price
stopLossPips double? New stop loss pips value from target price
takeProfitPips double? New take profit pips value from target price
expirationTime DateTime? New order expiration time

Return Value

TradeResult

Examples

1
2
3
4
5
6
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime);
 }

ModifyPendingOrder (4 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, long volume)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price
stopLossPips double? New stop loss pips value from target price
takeProfitPips double? New take profit pips value from target price
expirationTime DateTime? New order expiration time
volume long New volume in units for the order

Return Value

TradeResult

Examples

1
2
3
4
5
6
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, 5);
 }

ModifyPendingOrder (5 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price
stopLossPips double? New stop loss pips value from target price
takeProfitPips double? New take profit pips value from target price
expirationTime DateTime? New order expiration time
volume double New volume in units for the order

Return Value

TradeResult

Examples

1
2
3
4
5
6
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, 5);
 }

ModifyPendingOrder (6 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, bool hasTrailingStop)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price
stopLossPips double? New stop loss pips value from target price
takeProfitPips double? New take profit pips value from target price
expirationTime DateTime? New order expiration time
volume double New volume in units for the order
hasTrailingStop bool Enable/disable TrailingStop for position

Return Value

TradeResult

Examples

1
2
3
4
5
6
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime);
 }
1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, hasTrailingStop);
 }

ModifyPendingOrder (7 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price
stopLossPips double? New stop loss pips value from target price
takeProfitPips double? New take profit pips value from target price
expirationTime DateTime? New order expiration time
volume double New volume in units for the order
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss

Return Value

TradeResult

Examples

1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                            order.ExpirationTime, 10000, hasTrailingStop, StopTriggerMethod.Trade);
 }

ModifyPendingOrder (8 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price
stopLossPips double? New stop loss pips value from target price
takeProfitPips double? New take profit pips value from target price
expirationTime DateTime? New order expiration time
volume double New volume in units for the order
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod? Determines how pending order will be triggered in case it's a StopOrder

Return Value

TradeResult

Examples

1
2
3
4
5
6
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                            order.ExpirationTime);
 }
1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
 if (order.StopLossPips == null)
     ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                        order.ExpirationTime, 5, hasTrailingStop);
 }
1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                            order.ExpirationTime, 5, hasTrailingStop, StopTriggerMethod.Trade, StopTriggerMethod.Trade);
 }

ModifyPendingOrder (9 of 10)

Summary

Modify a Pending Order

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order which is affected
targetPrice double New target price
stopLossPips double? New stop loss pips value from target price
takeProfitPips double? New take profit pips value from target price
expirationTime DateTime? New order expiration time
volume double New volume in units for the order
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod? Determines how pending order will be triggered in case it's a StopOrder
stopLimitRangePips double? Maximum distance for order execution from target price

Return Value

TradeResult

Examples

1
2
3
4
5
6
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                            order.ExpirationTime);
 }
1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
 if (order.StopLossPips == null)
     ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                        order.ExpirationTime, 5, hasTrailingStop);
 }
1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrder(order, order.TargetPrice, 10, order.TakeProfitPips,
                            order.ExpirationTime, 5, hasTrailingStop, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 2);
 }

ModifyPendingOrder (10 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeResult ModifyPendingOrder(PendingOrder pendingOrder, long volume, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
volume long
targetPrice double New target price at which the order becomes market order
stopLossPips double?
takeProfitPips double?
expirationTime DateTime?

Return Value

TradeResult

Examples

1
2
3
4
5
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice);
 }

CancelPendingOrderAsync

Summary

Cancel a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation CancelPendingOrderAsync(PendingOrder pendingOrder, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to cancel
callback Action Method that is called when pending order is cancelled

Return Value

TradeOperation

Examples

1
2
3
4
5
 if (PendingOrders.Count > 0)
 {
     var pendingOrder = PendingOrders[0];
     CancelPendingOrderAsync(pendingOrder);
 }

ModifyPendingOrderAsync (10)

ModifyPendingOrderAsync (1 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice);
 }

ModifyPendingOrderAsync (2 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
stopLossPips double? New stop loss
takeProfitPips double? New take profit
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips);
 }

ModifyPendingOrderAsync (3 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
stopLossPips double? New stop loss
takeProfitPips double? New take profit
expirationTime DateTime? New expiry date and time
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime);
 }

ModifyPendingOrderAsync (4 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, long volume, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
stopLossPips double? New stop loss
takeProfitPips double? New take profit
expirationTime DateTime? New expiry date and time
volume long New volume in units for the order
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, 5);
 }

ModifyPendingOrderAsync (5 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
stopLossPips double? New stop loss
takeProfitPips double? New take profit
expirationTime DateTime? New expiry date and time
volume double New volume in units for the order
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, 5);
 }

ModifyPendingOrderAsync (6 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
stopLossPips double? New stop loss
takeProfitPips double? New take profit
expirationTime DateTime? New expiry date and time
volume double New volume in units for the order
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod? Determines how pending order will be triggered in case it's a StopOrder
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, 5, hasTrailingStop, StopTriggerMethod.Trade, StopTriggerMethod.Opposite);
 }

ModifyPendingOrderAsync (7 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
stopLossPips double? New stop loss
takeProfitPips double? New take profit
expirationTime DateTime? New expiry date and time
volume double New volume in units for the order
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, 5, hasTrailingStop, StopTriggerMethod.Trade);
 }

ModifyPendingOrderAsync (8 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
stopLossPips double? New stop loss
takeProfitPips double? New take profit
expirationTime DateTime? New expiry date and time
volume double New volume in units for the order
hasTrailingStop bool Enable/disable TrailingStop for position
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, 5, hasTrailingStop);
 }

ModifyPendingOrderAsync (9 of 10)

Summary

Modify a Pending Order in asynchronous execution mode

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder Pending Order to modify
targetPrice double New target price at which the order becomes market order
stopLossPips double? New stop loss
takeProfitPips double? New take profit
expirationTime DateTime? New expiry date and time
volume double New volume in units for the order
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod? Determines how pending order will be triggered in case it's a StopOrder
stopLimitRangePips double? Maximum distance for order execution from target price
callback Action Method that is called when order is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime);
 }
1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, hasTrailingStop);
 }
1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, hasTrailingStop, StopTriggerMethod.Trade);
 }
1
2
3
4
5
6
7
 bool hasTrailingStop = false;
 foreach (var order in PendingOrders)
 {
     if (order.StopLossPips == null)
         ModifyPendingOrderAsync(order, order.TargetPrice, 10, order.TakeProfitPips,
                         order.ExpirationTime, hasTrailingStop, 5, StopTriggerMethod.Trade, StopTriggerMethod.Opposite);
 }

ModifyPendingOrderAsync (10 of 10)

Signature

1
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, long volume, double targetPrice, double? stopLossPips, double? takeProfitPips, DateTime? expirationTime, Action<TradeResult> callback)

Parameters

Name Type Description
pendingOrder PendingOrder
volume long
targetPrice double
stopLossPips double?
takeProfitPips double?
expirationTime DateTime?
callback Action

Return Value

TradeOperation

ReversePosition (2)

ReversePosition (1 of 2)

Summary

Modify the direction of trade at position

Signature

1
public TradeResult ReversePosition(Position position)

Parameters

Name Type Description
position Position Position which is affected

Return Value

TradeResult

Examples

1
2
3
4
5
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     ReversePosition(position);
 }

ReversePosition (2 of 2)

Summary

Modify the direction of trade and volume of a position

Signature

1
public TradeResult ReversePosition(Position position, double volume)

Parameters

Name Type Description
position Position Position which is affected
volume double Volume (in units) of Trade

Return Value

TradeResult

Examples

1
2
3
4
5
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     ReversePosition(position, 20000);
 }

ModifyPosition (4)

ModifyPosition (1 of 4)

Summary

Modify the volume of a position

Signature

1
public TradeResult ModifyPosition(Position position, double volume)

Parameters

Name Type Description
position Position Position which is affected
volume double Volume (in units) of Trade

Return Value

TradeResult

Examples

1
2
3
4
5
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     ModifyPosition(position, 20000);
 }

ModifyPosition (2 of 4)

Summary

Modify the protection of a position

Signature

1
public TradeResult ModifyPosition(Position position, double? stopLoss, double? takeProfit)

Parameters

Name Type Description
position Position Position which is affected
stopLoss double? New stop loss price
takeProfit double? New take profit price

Return Value

TradeResult

Examples

1
2
3
4
5
6
7
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     ModifyPosition(position, stopLoss,  takeProfit);
 }

ModifyPosition (3 of 4)

Summary

Modify the protection of a position

Signature

1
public TradeResult ModifyPosition(Position position, double? stopLoss, double? takeProfit, bool hasTrailingStop)

Parameters

Name Type Description
position Position Position which is affected
stopLoss double? New stop loss price
takeProfit double? New take profit price
hasTrailingStop bool Enable/disable TrailingStop for position

Return Value

TradeResult

Examples

1
2
3
4
5
6
7
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     ModifyPosition(position, stopLoss,  takeProfit);
 }
1
2
3
4
5
6
7
8
9
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     bool hasTrailingStop = true;
     ModifyPosition(position, stopLoss,  takeProfit, hasTrailingStop);
     Print("Position was modified, has Trailing Stop = {0}", result.Position.HasTrailingStop);
 }

ModifyPosition (4 of 4)

Summary

Modify the protection of a position

Signature

1
public TradeResult ModifyPosition(Position position, double? stopLoss, double? takeProfit, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
position Position Position which is affected
stopLoss double? New stop loss price
takeProfit double? New take profit price
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss

Return Value

TradeResult

Examples

1
2
3
4
5
6
7
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     ModifyPosition(position, stopLoss,  takeProfit);
 }
1
2
3
4
5
6
7
8
9
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     bool hasTrailingStop = true;
     ModifyPosition(position, stopLoss,  takeProfit, hasTrailingStop);
     Print("Position was modified, has Trailing Stop = {0}", result.Position.HasTrailingStop);
 }
1
2
3
4
5
6
7
8
9
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null )
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     bool hasTrailingStop = true;
     ModifyPosition(position, stopLoss,  takeProfit, hasTrailingStop, StopTriggerMethod.Opposite);
     Print("Position was modified, stop loss trigger method = {0}", result.Position.StopLossTriggerMethod);
 }

ClosePosition (3)

ClosePosition (1 of 3)

Summary

Close a position

Signature

1
public TradeResult ClosePosition(Position position)

Parameters

Name Type Description
position Position Position to close

Return Value

TradeResult

ClosePosition (2 of 3)

Summary

Close a position

Signature

1
public TradeResult ClosePosition(Position position, long volume)

Parameters

Name Type Description
position Position Position to close
volume long Volume which is closed

Return Value

TradeResult

Examples

1
 ClosePosition(position);
1
2
 if (position.Volume >= 20000)
     ClosePosition(position, 10000);

ClosePosition (3 of 3)

Summary

Close a position

Signature

1
public TradeResult ClosePosition(Position position, double volume)

Parameters

Name Type Description
position Position Position to close
volume double Volume which is closed

Return Value

TradeResult

Examples

1
 ClosePosition(position);
1
2
 if (position.Volume >= 20000)
     ClosePosition(position, 10000);

ClosePositionAsync (3)

ClosePositionAsync (1 of 3)

Summary

Close a position in asynchronous execution mode

Signature

1
public TradeOperation ClosePositionAsync(Position position, Action<TradeResult> callback)

Parameters

Name Type Description
position Position The position to close
callback Action The action when the position closes

Return Value

TradeOperation

ClosePositionAsync (2 of 3)

Summary

Close a position in asynchronous execution mode

Signature

1
public TradeOperation ClosePositionAsync(Position position, long volume, Action<TradeResult> callback)

Parameters

Name Type Description
position Position The position to close
volume long The volume to close
callback Action The action when the position closes

Return Value

TradeOperation

Examples

1
 ClosePositionAsync(position);
1
2
 if (position.Volume >= 20000)
     ClosePositionAsync(position, 10000);

ClosePositionAsync (3 of 3)

Summary

Close a position in asynchronous execution mode

Signature

1
public TradeOperation ClosePositionAsync(Position position, double volume, Action<TradeResult> callback)

Parameters

Name Type Description
position Position The position to close
volume double The volume to close
callback Action The action when the position closes

Return Value

TradeOperation

Examples

1
 ClosePositionAsync(position);
1
2
 if (position.Volume >= 20000)
     ClosePositionAsync(position, 10000);

ReversePositionAsync (2)

ReversePositionAsync (1 of 2)

Summary

Modify Position in asynchronous execution mode

Signature

1
public TradeOperation ReversePositionAsync(Position position, Action<TradeResult> callback)

Parameters

Name Type Description
position Position Position to modify
callback Action Method that is called when position is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null)
 {
     ReversePositionAsync(position, TradeType.Sell);
 }

ReversePositionAsync (2 of 2)

Summary

Modify Position in asynchronous execution mode

Signature

1
public TradeOperation ReversePositionAsync(Position position, double volume, Action<TradeResult> callback)

Parameters

Name Type Description
position Position Position to modify
volume double New volume
callback Action Method that is called when position is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null)
 {
     ReversePositionAsync(position, 20000);
 }

ModifyPositionAsync (4)

ModifyPositionAsync (1 of 4)

Summary

Modify Position in asynchronous execution mode

Signature

1
public TradeOperation ModifyPositionAsync(Position position, double volume, Action<TradeResult> callback)

Parameters

Name Type Description
position Position Position to modify
volume double New volume
callback Action Method that is called when position is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null)
 {
     ModifyPositionAsync(position, 20000);
 }

ModifyPositionAsync (2 of 4)

Summary

Modify Position in asynchronous execution mode

Signature

1
public TradeOperation ModifyPositionAsync(Position position, double? stopLoss, double? takeProfit, Action<TradeResult> callback)

Parameters

Name Type Description
position Position Position to modify
stopLoss double? New stop loss price
takeProfit double? New take profit price
callback Action Method that is called when position is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
7
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null)
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     ModifyPositionAsync(position, stopLoss,  takeProfit);
 }

ModifyPositionAsync (3 of 4)

Summary

Modify Position in asynchronous execution mode

Signature

1
public TradeOperation ModifyPositionAsync(Position position, double? stopLoss, double? takeProfit, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
position Position Position to modify
stopLoss double? New stop loss price
takeProfit double? New take profit price
hasTrailingStop bool Enable/disable TrailingStop for position
callback Action Method that is called when position is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
7
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null)
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     ModifyPositionAsync(position, stopLoss,  takeProfit);
 }
1
2
3
4
5
6
7
8
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null)
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     bool hasTrailingStop = true;
     ModifyPositionAsync(position, stopLoss,  takeProfit, hasTrailingStop);
 }

ModifyPositionAsync (4 of 4)

Summary

Modify Position in asynchronous execution mode

Signature

1
public TradeOperation ModifyPositionAsync(Position position, double? stopLoss, double? takeProfit, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
position Position Position to modify
stopLoss double? New stop loss price
takeProfit double? New take profit price
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
callback Action Method that is called when position is modified

Return Value

TradeOperation

Examples

1
2
3
4
5
6
7
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null)
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     ModifyPositionAsync(position, stopLoss,  takeProfit);
 }
1
2
3
4
5
6
7
8
 var position = Positions.Find("myLabel", Symbol, TradeType.Buy);
 if (position != null)
 {
     double? stopLoss = Symbol.Ask- 10*Symbol.PipSize;
     double? takeProfit = Symbol.Ask + 10 * Symbol.PipSize;
     bool hasTrailingStop = true;
     ModifyPositionAsync(position, stopLoss,  takeProfit, hasTrailingStop);
 }

PlaceStopLimitOrder (16)

PlaceStopLimitOrder (1 of 16)

Summary

Place a Stop Limit Order

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price

Return Value

TradeResult

PlaceStopLimitOrder (2 of 16)

Summary

Place a Stop Limit Order

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order

Return Value

TradeResult

PlaceStopLimitOrder (3 of 16)

Summary

Place a Stop Limit Order

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

PlaceStopLimitOrder (4 of 16)

Summary

Place a Stop Limit Order

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time

Return Value

TradeResult

PlaceStopLimitOrder (5 of 16)

Summary

Place a Stop Limit Order

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment

Return Value

TradeResult

PlaceStopLimitOrder (6 of 16)

Summary

Place a Stop Limit Order

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position

Return Value

TradeResult

PlaceStopLimitOrder (7 of 16)

Summary

Place a Stop Limit Order

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss

Return Value

TradeResult

PlaceStopLimitOrder (8 of 16)

Summary

Place a Stop Limit Order

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod stopOrderTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod Determines how pending order will be triggered in case it's a StopLimitOrder

Return Value

TradeResult

PlaceStopLimitOrder (9 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price

Return Value

TradeResult

PlaceStopLimitOrder (10 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order

Return Value

TradeResult

PlaceStopLimitOrder (11 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

PlaceStopLimitOrder (12 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time

Return Value

TradeResult

PlaceStopLimitOrder (13 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment

Return Value

TradeResult

PlaceStopLimitOrder (14 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position

Return Value

TradeResult

PlaceStopLimitOrder (15 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss

Return Value

TradeResult

PlaceStopLimitOrder (16 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopLimitOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod stopOrderTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod Determines how pending order will be triggered in case it's a StopLimitOrder

Return Value

TradeResult

PlaceStopLimitOrderAsync (16)

PlaceStopLimitOrderAsync (1 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopLimitOrderAsync (2 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopLimitOrderAsync (3 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopLimitOrderAsync (4 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopLimitOrderAsync (5 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopLimitOrderAsync (6 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopLimitOrderAsync (7 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopLimitOrderAsync (8 of 16)

Summary

Place Stop Limit order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod stopOrderTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price (or better) at which order is filled
stopLimitRangePips double Maximum distance for order execution from target price
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod Determines how pending order will be triggered in case it's a StopLimitOrder
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopLimitOrderAsync (9 of 16)

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
stopLimitRangePips double
callback Action

Return Value

TradeOperation

PlaceStopLimitOrderAsync (10 of 16)

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
stopLimitRangePips double
label string
callback Action

Return Value

TradeOperation

PlaceStopLimitOrderAsync (11 of 16)

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
stopLimitRangePips double
label string
stopLossPips double?
takeProfitPips double?
callback Action

Return Value

TradeOperation

PlaceStopLimitOrderAsync (12 of 16)

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
stopLimitRangePips double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
callback Action

Return Value

TradeOperation

PlaceStopLimitOrderAsync (13 of 16)

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
stopLimitRangePips double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
callback Action

Return Value

TradeOperation

PlaceStopLimitOrderAsync (14 of 16)

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
stopLimitRangePips double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
callback Action

Return Value

TradeOperation

PlaceStopLimitOrderAsync (15 of 16)

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
stopLimitRangePips double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?
callback Action

Return Value

TradeOperation

PlaceStopLimitOrderAsync (16 of 16)

Signature

1
public TradeOperation PlaceStopLimitOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, double stopLimitRangePips, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod stopOrderTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
stopLimitRangePips double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?
stopOrderTriggerMethod StopTriggerMethod
callback Action

Return Value

TradeOperation

PlaceStopOrder (21)

PlaceStopOrder (1 of 21)

Summary

Place a stop order

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price at which order becomes a market order

Return Value

TradeResult

PlaceStopOrder (2 of 21)

Summary

Place a stop order

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price at which order becomes a market order
label string Representing label

Return Value

TradeResult

PlaceStopOrder (3 of 21)

Summary

Place a stop order

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price at which order becomes a market order
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

PlaceStopOrder (4 of 21)

Summary

Place a stop order

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price at which order becomes a market order
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time

Return Value

TradeResult

PlaceStopOrder (5 of 21)

Summary

Place a stop order

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price at which order becomes a market order
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time
comment string Order comment

Return Value

TradeResult

Examples

1
 PlaceStopOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask);
1
2
 PlaceStopOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask,
                 "myStopOrder");
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20);
1
2
3
 DateTime expiration = Server.Time.AddHours(1);
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, expiration);
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment");

PlaceStopOrder (6 of 21)

Summary

Place a stop order

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price at which order becomes a market order
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position

Return Value

TradeResult

Examples

1
 PlaceStopOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask);
1
2
 PlaceStopOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask,
                 "myStopOrder");
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20);
1
2
3
 DateTime expiration = Server.Time.AddHours(1);
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, expiration);
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment");
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment", HasTrailingStop);

PlaceStopOrder (7 of 21)

Summary

Place a stop order

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price at which order becomes a market order
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss

Return Value

TradeResult

Examples

1
 PlaceStopOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask);
1
2
 PlaceStopOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask,
                 "myStopOrder");
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20);
1
2
3
 DateTime expiration = Server.Time.AddHours(1);
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, expiration);
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment");
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment", HasTrailingStop);
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment", HasTrailingStop, StopTriggerMethod.Trade);

PlaceStopOrder (8 of 21)

Summary

Place a stop order

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod stopOrderTriggerMethod)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume (in units) of trade
targetPrice double Price at which order becomes a market order
label string Representing label
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod Determines how pending order will be triggered in case it's a StopOrder

Return Value

TradeResult

Examples

1
 PlaceStopOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask);
1
2
 PlaceStopOrder(TradeType.Buy, Symbol, 10000, Symbol.Ask,
                 "myStopOrder");
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20);
1
2
3
 DateTime expiration = Server.Time.AddHours(1);
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, expiration);
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment");
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment", HasTrailingStop);
1
2
 PlaceStopOrder(TradeType.Sell, Symbol, 20000, Symbol.Ask,
                 "myStopOrder", 20, 20, null, "my comment", HasTrailingStop, StopTriggerMethod.Trade);

PlaceStopOrder (9 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume of trade
targetPrice double Price at which the order becomes market order

Return Value

TradeResult

PlaceStopOrder (10 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume of trade
targetPrice double Price at which the order becomes market order

Return Value

TradeResult

PlaceStopOrder (11 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order

Return Value

TradeResult

PlaceStopOrder (12 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order

Return Value

TradeResult

PlaceStopOrder (13 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

Examples

1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize);
1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize, "myLabel", 10, 10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
             Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceStopOrderAsync(TradeType.Buy, Symbol, 20000, Symbol.Ask, StopOrderOnPlaced);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed {0}", tradeResult.PendingOrder.Label);
 }

PlaceStopOrder (14 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips

Return Value

TradeResult

Examples

1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize);
1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize, "myLabel", 10, 10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
             Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceStopOrderAsync(TradeType.Buy, Symbol, 20000, Symbol.Ask, StopOrderOnPlaced);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed {0}", tradeResult.PendingOrder.Label);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", hasTrailingStop);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with HasTrailingStop: {0}", tradeResult.PendingOrder.HasTrailingStop);
 }

PlaceStopOrder (15 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume long Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time

Return Value

TradeResult

Examples

1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize);
1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize, "myLabel", 10, 10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
             Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceStopOrderAsync(TradeType.Buy, Symbol, 20000, Symbol.Ask, StopOrderOnPlaced);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed {0}", tradeResult.PendingOrder.Label);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", hasTrailingStop);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with HasTrailingStop: {0}", tradeResult.PendingOrder.HasTrailingStop);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry,
                         "order comment", hasTrailingStop, StopTriggerMethod.Trade);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with stop trigger method: {0}", tradeResult.PendingOrder.StopTriggerMethod);
 }

PlaceStopOrder (16 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbol Symbol
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time

Return Value

TradeResult

Examples

1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize);
1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize, "myLabel", 10, 10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
             Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceStopOrderAsync(TradeType.Buy, Symbol, 20000, Symbol.Ask, StopOrderOnPlaced);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed {0}", tradeResult.PendingOrder.Label);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", hasTrailingStop);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with HasTrailingStop: {0}", tradeResult.PendingOrder.HasTrailingStop);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry,
                         "order comment", hasTrailingStop, StopTriggerMethod.Trade);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with stop loss trigger method: {0}", tradeResult.PendingOrder.StopLossTriggerMethod);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     StopTriggerMethod stopLossTriggerMethod = StopTriggerMethod.Trade;
     StopTriggerMethod stopOrderTriggerMethod = StopTriggerMethod.Trade;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry,
                         "order comment", hasTrailingStop, stopLossTriggerMethod, stopOrderTriggerMethod);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with stop order trigger method: {0}", tradeResult.PendingOrder.StopOrderTriggerMethod);
 }

PlaceStopOrder (17 of 21)

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string

Return Value

TradeResult

PlaceStopOrder (18 of 21)

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string

Return Value

TradeResult

PlaceStopOrder (19 of 21)

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool

Return Value

TradeResult

PlaceStopOrder (20 of 21)

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?

Return Value

TradeResult

PlaceStopOrder (21 of 21)

Signature

1
public TradeResult PlaceStopOrder(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod stopOrderTriggerMethod)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?
stopOrderTriggerMethod StopTriggerMethod

Return Value

TradeResult

PlaceStopOrderAsync (21)

PlaceStopOrderAsync (1 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Price at which the order becomes market order
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopOrderAsync (2 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopOrderAsync (3 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopOrderAsync (4 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
callback Action Action when order is placed

Return Value

TradeOperation

PlaceStopOrderAsync (5 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
callback Action Action when order is placed

Return Value

TradeOperation

Examples

1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize);
1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize, "myLabel", 10, 10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
             Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceStopOrderAsync(TradeType.Buy, Symbol, 20000, Symbol.Ask, StopOrderOnPlaced);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed {0}", tradeResult.PendingOrder.Label);
 }

PlaceStopOrderAsync (6 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
callback Action Action when order is placed

Return Value

TradeOperation

Examples

1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize);
1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize, "myLabel", 10, 10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
             Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceStopOrderAsync(TradeType.Buy, Symbol, 20000, Symbol.Ask, StopOrderOnPlaced);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed {0}", tradeResult.PendingOrder.Label);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", hasTrailingStop);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with HasTrailingStop: {0}", tradeResult.PendingOrder.HasTrailingStop);
 }

PlaceStopOrderAsync (7 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
callback Action Action when order is placed

Return Value

TradeOperation

Examples

1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize);
1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize, "myLabel", 10, 10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
             Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceStopOrderAsync(TradeType.Buy, Symbol, 20000, Symbol.Ask, StopOrderOnPlaced);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed {0}", tradeResult.PendingOrder.Label);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", hasTrailingStop);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with HasTrailingStop: {0}", tradeResult.PendingOrder.HasTrailingStop);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry,
                         "order comment", hasTrailingStop, StopTriggerMethod.Trade);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with stop trigger method: {0}", tradeResult.PendingOrder.StopTriggerMethod);
 }

PlaceStopOrderAsync (8 of 21)

Summary

Place stop order in asynchronous execution mode

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, string symbolName, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod stopOrderTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType Direction of trade
symbolName string Symbol name of trade
volume double Volume of trade
targetPrice double Price at which the order becomes market order
label string Label representing the order
stopLossPips double? Stop loss in pips
takeProfitPips double? Take profit in pips
expiration DateTime? Order expiry date and time
comment string Order comment
hasTrailingStop bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
stopOrderTriggerMethod StopTriggerMethod Determines how pending order will be triggered in case it's a StopOrder
callback Action Action when order is placed

Return Value

TradeOperation

Examples

1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize);
1
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000, Symbol.Bid - 5* Symbol.PipSize, "myLabel", 10, 10);
1
2
3
 DateTime? expiry = DateTime.Now.AddHours(1);
 PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
             Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment");
1
2
3
4
5
6
7
8
 protected override void OnStart()
 {
     PlaceStopOrderAsync(TradeType.Buy, Symbol, 20000, Symbol.Ask, StopOrderOnPlaced);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed {0}", tradeResult.PendingOrder.Label);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry, "order comment", hasTrailingStop);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with HasTrailingStop: {0}", tradeResult.PendingOrder.HasTrailingStop);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry,
                         "order comment", hasTrailingStop, StopTriggerMethod.Trade);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with stop loss trigger method: {0}", tradeResult.PendingOrder.StopLossTriggerMethod);
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 protected override void OnStart()
 {
     bool hasTrailingStop = true;
     StopTriggerMethod stopLossTriggerMethod = StopTriggerMethod.Trade;
     StopTriggerMethod stopOrderTriggerMethod = StopTriggerMethod.Trade;
     DateTime? expiry = DateTime.Now.AddHours(1);
     PlaceStopOrderAsync(TradeType.Sell, Symbol, 10000,
                         Symbol.Bid - 10* Symbol.PipSize,"myLabel", 10, 10, expiry,
                         "order comment", hasTrailingStop, stopLossTriggerMethod, stopOrderTriggerMethod);
 }
 private void StopOrderOnPlaced(TradeResult tradeResult)
 {
     Print("Stop order placed with stop order trigger method: {0}", tradeResult.PendingOrder.StopOrderTriggerMethod);
 }

PlaceStopOrderAsync (9 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (10 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (11 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (12 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (13 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (14 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (15 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (16 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (17 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, long volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume long
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (18 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (19 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (20 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?
callback Action

Return Value

TradeOperation

PlaceStopOrderAsync (21 of 21)

Signature

1
public TradeOperation PlaceStopOrderAsync(TradeType tradeType, Symbol symbol, double volume, double targetPrice, string label, double? stopLossPips, double? takeProfitPips, DateTime? expiration, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod stopOrderTriggerMethod, Action<TradeResult> callback)

Parameters

Name Type Description
tradeType TradeType
symbol Symbol
volume double
targetPrice double
label string
stopLossPips double?
takeProfitPips double?
expiration DateTime?
comment string
hasTrailingStop bool
stopLossTriggerMethod StopTriggerMethod?
stopOrderTriggerMethod StopTriggerMethod
callback Action

Return Value

TradeOperation

Properties

Account

Summary

Contains all Account information

Signature

1
public IAccount Account {get;}

Return Value

IAccount

Examples

1
2
3
4
5
6
7
 double balance = Account.Balance;
 string currency = Account.Currency;
 double equity = Account.Equity;
 double freemargin = Account.FreeMargin;
 double margin = Account.Margin;
 double? marginlevel = Account.MarginLevel;
 int leverage = Account.Leverage;

LastResult

Summary

The latest trade result

Signature

1
public TradeResult LastResult {get;}

Return Value

TradeResult

Examples

1
2
3
 ExecuteMarketOrder(TradeType.Buy, Symbol, 20000, null, 10, null);
 if(LastResult.IsSuccessful)
     Print(LastResult.Position.StopLoss);

Trade

Signature

1
public ITrade Trade {get;}

Return Value

ITrade