Robot Summary Base class for all cBots.
Provides a convenient framework for creating cBots including methods to create, modify, cancel orders and closepositions, methods triggered by each tick and each bar, access to built-in Indicators and more.
Signature
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 OnStart Summary
Called when cBot is being started. Override this method to initialize cBot, create nested indicators, etc.
Signature
protected internal void OnStart ()
Return Value
void
Examples
protected override void OnStart ()
{
//This method is invoked when the cBot is started.
}
OnStop Summary
Called when cBot is stopped.
Signature
protected internal void OnStop ()
Return Value
void
Examples
protected override void OnStop ()
{
//This method is called when the cBot is stopped
}
OnTick Summary
Called on each incoming market tick.
Signature
protected internal void OnTick ()
Return Value
void
Examples
protected override void OnTick ()
{
// Place cBot's Logic here.
}
OnBar Summary
Called on each incoming Bar.
Signature
protected internal void OnBar ()
Return Value
void
Examples
protected override void OnBar ()
{
//Place cBot's Logic here.
}
OnBarClosed Summary
Called when a new bar is opened; the method is called for the previous (closed) bar.
Signature
protected internal void OnBarClosed ()
Return Value
void
OnError Summary
Called if there is an error executing a trade operation.
Signature
protected internal void OnError ( Error error )
Parameters
Name Type Description error Error Error description.
Return Value
void
Examples
protected override void OnError ( Error error )
{
Print ( "There has been an Error" );
}
Stop Summary
Stops the cBot. cBot will be completely stopped and will not send/receive any signals.
Signature
Return Value
void
Examples
// 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
Return Value
string
Examples
protected override void OnStart ()
{
Print ( ToString ());
}
GetFitness Summary
Override this method to provide custom fitness value for Optimization
Signature
protected internal double GetFitness ( GetFitnessArgs args )
Parameters
Name Type Description args GetFitnessArgs
Return Value
double
PlaceLimitOrder (7) PlaceLimitOrder (1 of 7)
Summary
Place a Limit Order
Signature
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 7)
Summary
Place a Limit Order
Signature
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 7)
Summary
Place a Limit Order
Signature
public TradeResult PlaceLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType )
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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type
Return Value
TradeResult
PlaceLimitOrder (4 of 7)
Summary
Place a Limit Order
Signature
public TradeResult PlaceLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry time
Return Value
TradeResult
PlaceLimitOrder (5 of 7)
Summary
Place a Limit Order
Signature
public TradeResult PlaceLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry time comment string Order comment
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON)
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 100000 ,
Symbol . Bid - 2 * Symbol . PipSize );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 200000 ,
Symbol . Bid - 2 * Symbol . PipSize , "myLabel" );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 5 * Symbol . PipSize , "112" , 10 , 10 , ProtectionType . Relative );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" );
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 100000 , api . Symbol . Bid - 2 * api . Symbol . PipSize )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 200000 , api . Symbol . Bid - 2 * api . Symbol . PipSize , "myLabel" )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 5 * api . Symbol . PipSize , "112" , 10 , 10 , ProtectionType . Relative )
targetPrice = api . Symbol . Bid - 5 * api . Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry )
targetPrice = api . Symbol . Bid - 5 * api . Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" )
PlaceLimitOrder (6 of 7)
Summary
Place a Limit Order
Signature
public TradeResult PlaceLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry time comment string Order comment hasTrailingStop bool Enable/disable TrailingStop for position
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON)
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 100000 ,
Symbol . Bid - 2 * Symbol . PipSize );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 200000 ,
Symbol . Bid - 2 * Symbol . PipSize , "myLabel" );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 5 * Symbol . PipSize , "112" , 10 , 10 , ProtectionType . Relative );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" , HasTrailingStop );
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 100000 ,
api . Symbol . Bid - 2 * api . Symbol . PipSize )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 200000 ,
api . Symbol . Bid - 2 * api . Symbol . PipSize , "myLabel" )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 5 * api . Symbol . PipSize , "112" , 10 , 10 , ProtectionType . Relative )
targetPrice = api . Symbol . Bid - 5 * api . Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry )
targetPrice = api . Symbol . Bid - 5 * Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" )
targetPrice = api . Symbol . Bid - 5 * Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" , HasTrailingStop )
PlaceLimitOrder (7 of 7)
Summary
Place a Limit Order
Signature
public TradeResult PlaceLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON)
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 100000 ,
Symbol . Bid - 2 * Symbol . PipSize );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 200000 ,
Symbol . Bid - 2 * Symbol . PipSize , "myLabel" );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 5 * Symbol . PipSize , "112" , 10 , 10 , ProtectionType . Relative );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" , HasTrailingStop );
var targetPrice = Symbol . Bid - 5 * Symbol . PipSize ;
var expiry = Server . Time . AddMinutes ( 30 );
PlaceLimitOrder ( TradeType . Buy , Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" , HasTrailingStop , StopTriggerMethod . Trade );
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 100000 ,
api . Symbol . Bid - 2 * api . Symbol . PipSize )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 200000 ,
api . Symbol . Bid - 2 * api . Symbol . PipSize , "myLabel" )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 5 * api . Symbol . PipSize , "112" , 10 , 10 , ProtectionType . Relative )
targetPrice = api . Symbol . Bid - 5 * api . Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry )
targetPrice = api . Symbol . Bid - 5 * Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" )
targetPrice = api . Symbol . Bid - 5 * Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" , HasTrailingStop )
targetPrice = api . Symbol . Bid - 5 * Symbol . PipSize
expiry = api . Server . Time . AddMinutes ( 30 )
api . PlaceLimitOrder ( TradeType . Buy , api . Symbol . Name , 10000 ,
targetPrice , "112" , 10 , 10 , ProtectionType . Relative , expiry , "first order" , HasTrailingStop , StopTriggerMethod . Trade )
PlaceLimitOrderAsync (7) PlaceLimitOrderAsync (1 of 7)
Summary
Place limit order in asynchronous execution mode
Signature
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 7)
Summary
Place limit order in asynchronous execution mode
Signature
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 7)
Summary
Place limit order in asynchronous execution mode
Signature
public TradeOperation PlaceLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type callback Action The action when the position closes
Return Value
TradeOperation
PlaceLimitOrderAsync (4 of 7)
Summary
Place limit order in asynchronous execution mode
Signature
public TradeOperation PlaceLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time callback Action The action when the position closes
Return Value
TradeOperation
PlaceLimitOrderAsync (5 of 7)
Summary
Place limit order in asynchronous execution mode
Signature
public TradeOperation PlaceLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time comment string Order comment callback Action The action when the position closes
Return Value
TradeOperation
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (PYTHON) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON)
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative );
var expiry = Server . Time . AddHours ( 1 );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" );
protected override void OnStart ()
{
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Bid , LimitOrderOnPlaced );
}
private void LimitOrderOnPlaced ( TradeResult tradeResult )
{
Print ( "Limit order placed {0}" , tradeResult . PendingOrder . Label );
}
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" )
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative )
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" )
1
2
3
4
5
6
7
8
9
10
11
12 import clr
clr . AddReference ( "cAlgo.API" )
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
from System import Action
class Test ():
def on_start ( self ):
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Bid , Action [ TradeResult ]( self . on_limit_order_placed ))
def on_limit_order_placed ( self , result ):
print ( f "Limit order placed { result . PendingOrder . Label } " )
PlaceLimitOrderAsync (6 of 7)
Summary
Place limit order in asynchronous execution mode
Signature
public TradeOperation PlaceLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON)
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative );
var expiry = Server . Time . AddHours ( 1 );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" );
protected override void OnStart ()
{
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Bid , LimitOrderOnPlaced );
}
private void LimitOrderOnPlaced ( TradeResult tradeResult )
{
Print ( "Limit order placed {0}" , tradeResult . PendingOrder . Label );
}
var expiry = Server . Time . AddHours ( 1 );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , HasTrailingStop );
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" )
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative )
expiry = Server . Time . AddHours ( 1 )
api . PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" )
1
2
3
4
5
6
7
8
9
10
11
12 import clr
clr . AddReference ( "cAlgo.API" )
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
from System import Action
class Test ():
def on_start ( self ):
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Bid , Action [ TradeResult ]( self . on_limit_order_placed ))
def on_limit_order_placed ( self , result ):
print ( f "Limit order placed { result . PendingOrder . Label } " )
expiry = api . Server . Time . AddHours ( 1 );
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , HasTrailingStop )
PlaceLimitOrderAsync (7 of 7)
Summary
Place limit order in asynchronous execution mode
Signature
public TradeOperation PlaceLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (C#)
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative );
var expiry = Server . Time . AddHours ( 1 );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" );
protected override void OnStart ()
{
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Bid , LimitOrderOnPlaced );
}
private void LimitOrderOnPlaced ( TradeResult tradeResult )
{
Print ( "Limit order placed {0}" , tradeResult . PendingOrder . Label );
}
var expiry = Server . Time . AddHours ( 1 );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , HasTrailingStop );
var expiry = Server . Time . AddHours ( 1 );
PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , HasTrailingStop , StopTriggerMethod . Trade );
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" )
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative )
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceLimitOrderAsync ( TradeType . Buy , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" )
1
2
3
4
5
6
7
8
9
10
11
12 import clr
clr . AddReference ( "cAlgo.API" )
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
from System import Action
class Test ():
def on_start ( self ):
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Bid , Action [ TradeResult ]( self . on_limit_order_placed ))
def on_limit_order_placed ( self , result ):
print ( f "Limit order placed { result . PendingOrder . Label } " )
expiry = Server . Time . AddHours ( 1 );
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , HasTrailingStop )
expiry = Server . Time . AddHours ( 1 )
api . PlaceLimitOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , HasTrailingStop , StopTriggerMethod . Trade )
ExecuteMarketOrder (6) ExecuteMarketOrder (1 of 6)
Summary
Execute a Market Order
Signature
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 6)
Summary
Execute a Market Order
Signature
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 6)
Summary
Execute a Market Order
Signature
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 6)
Summary
Execute a Market Order
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON)
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 );
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 , "Robot1" );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 10 );
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 , "Robot1" , 10 , 10 , 2 );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" );
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 )
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 , "Robot1" )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 10 )
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 , "Robot1" , 10 , 10 , 2 )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" )
ExecuteMarketOrder (5 of 6)
Summary
Execute a Market Order
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON)
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 );
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 , "Robot1" );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 10 );
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 , "Robot1" , 10 , 10 , 2 );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" , HasTrailingStop );
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 )
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 , "Robot1" )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 10 )
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 , "Robot1" , 10 , 10 , 2 )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" , HasTrailingStop )
ExecuteMarketOrder (6 of 6)
Summary
Execute a Market Order
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON)
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 );
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 , "Robot1" );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 10 );
ExecuteMarketOrder ( TradeType . Sell , Symbol . Name , 10000 , "Robot1" , 10 , 10 , 2 );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" , HasTrailingStop );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage ,
"this is a comment" , HasTrailingStop , StopTriggerMethod . Trade );
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 )
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 , "Robot1" )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 10 )
api . ExecuteMarketOrder ( TradeType . Sell , api . Symbol . Name , 10000 , "Robot1" , 10 , 10 , 2 )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" , HasTrailingStop )
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage ,
"this is a comment" , HasTrailingStop , StopTriggerMethod . Trade )
ExecuteMarketOrderAsync (6) ExecuteMarketOrderAsync (1 of 6)
Summary
Execute a market order in asynchronous execution mode
Signature
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 6)
Summary
Execute a market order in asynchronous execution mode
Signature
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 6)
Summary
Execute a market order in asynchronous execution mode
Signature
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 6)
Summary
Execute a market order in asynchronous execution mode
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON)
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , OnOpened );
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , Action [ TradeResult ]( self . on_opened ))
ExecuteMarketOrderAsync (5 of 6)
Summary
Execute a market order in asynchronous execution mode
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON)
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , OnOpened );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , HasTrailingStop , OnOpened );
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , Action [ TradeResult ]( self . on_opened ))
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , HasTrailingStop , Action [ TradeResult ]( self . on_opened ))
ExecuteMarketOrderAsync (6 of 6)
Summary
Execute a market order in asynchronous execution mode
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (C#) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON) Example 15 (PYTHON) Example 16 (PYTHON)
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , OnOpened );
ExecuteMarketOrderAsync ( TradeType . Buy , Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , HasTrailingStop , OnOpened );
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage ,
"this is a comment" , HasTrailingStop , StopTriggerMethod . Trade );
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" )
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , Action [ TradeResult ]( self . on_opened ))
api . ExecuteMarketOrderAsync ( TradeType . Buy , api . Symbol . Name , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , HasTrailingStop , Action [ TradeResult ]( self . on_opened ))
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage ,
"this is a comment" , HasTrailingStop , StopTriggerMethod . Trade );
ExecuteMarketRangeOrder (6) ExecuteMarketRangeOrder (1 of 6)
Summary
Execute a Market Order
Signature
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
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
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
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON)
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 );
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 , "Robot1" );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 10 );
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 , "Robot1" , 10 , 10 , 2 );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" );
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 )
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 , "Robot1" )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 10 )
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 , "Robot1" , 10 , 10 , 2 )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" )
ExecuteMarketRangeOrder (5 of 6)
Summary
Execute a Market Order
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON)
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 );
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 , "Robot1" );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 10 );
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 , "Robot1" , 10 , 10 , 2 );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" , HasTrailingStop );
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 )
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 , "Robot1" )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 10 )
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 , "Robot1" , 10 , 10 , 2 )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" , HasTrailingStop )
ExecuteMarketRangeOrder (6 of 6)
Summary
Execute a Market Order
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON)
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 );
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 , "Robot1" );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 10 );
ExecuteMarketRangeOrder ( TradeType . Sell , Symbol , 10000 , "Robot1" , 10 , 10 , 2 );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" , HasTrailingStop );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage ,
"this is a comment" , HasTrailingStop , StopTriggerMethod . Trade );
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 )
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 , "Robot1" )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 10 )
api . ExecuteMarketRangeOrder ( TradeType . Sell , api . Symbol , 10000 , "Robot1" , 10 , 10 , 2 )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage , "this is a comment" , HasTrailingStop )
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . 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
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
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
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
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON)
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , OnOpened );
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , Action [ TradeResult ]( self . on_opened ))
ExecuteMarketRangeOrderAsync (5 of 6)
Summary
Execute a market order in asynchronous execution mode
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON)
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , OnOpened );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , HasTrailingStop , OnOpened );
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , Action [ TradeResult ]( self . on_opened ))
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , HasTrailingStop , Action [ TradeResult ]( self . on_opened ))
ExecuteMarketRangeOrderAsync (6 of 6)
Summary
Execute a market order in asynchronous execution mode
Signature
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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (C#) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON) Example 15 (PYTHON) Example 16 (PYTHON)
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , OnOpened );
ExecuteMarketRangeOrderAsync ( TradeType . Buy , Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , HasTrailingStop , OnOpened );
ExecuteMarketRangeOrder ( TradeType . Buy , Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage ,
"this is a comment" , HasTrailingStop , StopTriggerMethod . Trade );
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 , "order comment" )
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , Action [ TradeResult ]( self . on_opened ))
api . ExecuteMarketRangeOrderAsync ( TradeType . Buy , api . Symbol , 10000 , "myLabel" , 10 , 20 , 2 ,
"order comment" , HasTrailingStop , Action [ TradeResult ]( self . on_opened ))
api . ExecuteMarketRangeOrder ( TradeType . Buy , api . Symbol , 5000 , "myRobot" , StopLoss , TakeProfit , Slippage ,
"this is a comment" , HasTrailingStop , StopTriggerMethod . Trade )
CancelPendingOrder Summary
Cancel a Pending Order
Signature
public TradeResult CancelPendingOrder ( PendingOrder pendingOrder )
Parameters
Name Type Description pendingOrder PendingOrder Pending Order which is affected
Return Value
TradeResult
Examples
ModifyPendingOrder (9) ModifyPendingOrder (1 of 9)
Summary
Modify a Pending Order
Signature
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
ModifyPendingOrder (2 of 9)
Summary
Modify a Pending Order
Signature
public TradeResult ModifyPendingOrder ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType )
Parameters
Name Type Description pendingOrder PendingOrder Pending Order which is affected targetPrice double New target price stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type
Return Value
TradeResult
Examples
ModifyPendingOrder (3 of 9)
Summary
Modify a Pending Order
Signature
public TradeResult ModifyPendingOrder ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , DateTime ? expirationTime )
Parameters
Name Type Description pendingOrder PendingOrder Pending Order which is affected targetPrice double New target price stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type expirationTime DateTime? New order expiration time
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (PYTHON)
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime );
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime )
ModifyPendingOrder (4 of 9)
Summary
Modify a Pending Order
Signature
public TradeResult ModifyPendingOrder ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , DateTime ? expirationTime , long volume )
Parameters
Name Type Description pendingOrder PendingOrder Pending Order which is affected targetPrice double New target price stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type expirationTime DateTime? New order expiration time volume long New volume in units for the order
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (PYTHON)
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , 5 );
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , 5 )
ModifyPendingOrder (5 of 9)
Summary
Modify a Pending Order
Signature
public TradeResult ModifyPendingOrder ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , DateTime ? expirationTime , double volume )
Parameters
Name Type Description pendingOrder PendingOrder Pending Order which is affected targetPrice double New target price stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type expirationTime DateTime? New order expiration time volume double New volume in units for the order
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (PYTHON)
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , 5 );
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , 5 )
ModifyPendingOrder (6 of 9)
Summary
Modify a Pending Order
Signature
public TradeResult ModifyPendingOrder ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , DateTime ? expirationTime , double volume , bool hasTrailingStop )
Parameters
Name Type Description pendingOrder PendingOrder Pending Order which is affected targetPrice double New target price stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (PYTHON) Example 4 (PYTHON)
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop );
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop )
ModifyPendingOrder (7 of 9)
Summary
Modify a Pending Order
Signature
public TradeResult ModifyPendingOrder ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , DateTime ? expirationTime , double volume , bool hasTrailingStop , StopTriggerMethod ? stopLossTriggerMethod )
Parameters
Name Type Description pendingOrder PendingOrder Pending Order which is affected targetPrice double New target price stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (PYTHON) Example 5 (PYTHON) Example 6 (PYTHON)
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite );
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite )
ModifyPendingOrder (8 of 9)
Summary
Modify a Pending Order
Signature
public TradeResult ModifyPendingOrder ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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 is a StopOrder
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (PYTHON) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON)
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite , StopTriggerMethod . Trade );
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite , StopTriggerMethod . Trade )
ModifyPendingOrder (9 of 9)
Summary
Modify a Pending Order
Signature
public TradeResult ModifyPendingOrder ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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 is a StopOrder stopLimitRangePips double? Maximum distance for order execution from target price
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON)
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite , StopTriggerMethod . Trade );
var hasTrailingStop = false ;
ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite , StopTriggerMethod . Trade , 2 );
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite , StopTriggerMethod . Trade )
hasTrailingStop = False
api . ModifyPendingOrder ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative ,
order . ExpirationTime , hasTrailingStop , StopTriggerMethod . Opposite , StopTriggerMethod . Trade , 2 )
CancelPendingOrderAsync Summary
Cancel a Pending Order in asynchronous execution mode
Signature
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
ModifyPendingOrderAsync (9) ModifyPendingOrderAsync (1 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
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
ModifyPendingOrderAsync (2 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
public TradeOperation ModifyPendingOrderAsync ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type callback Action Method that is called when order is modified
Return Value
TradeOperation
Examples
Example 1 (C#) Example 2 (C#) Example 3 (PYTHON) Example 4 (PYTHON)
ModifyPendingOrderAsync ( order , newTargetPrice );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative );
api . ModifyPendingOrderAsync ( order , newTargetPrice )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative )
ModifyPendingOrderAsync (3 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
public TradeOperation ModifyPendingOrderAsync ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type expirationTime DateTime? New expiry date and time callback Action Method that is called when order is modified
Return Value
TradeOperation
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (PYTHON) Example 5 (PYTHON) Example 6 (PYTHON)
ModifyPendingOrderAsync ( order , newTargetPrice );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime );
api . ModifyPendingOrderAsync ( order , newTargetPrice )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime )
ModifyPendingOrderAsync (4 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
public TradeOperation ModifyPendingOrderAsync ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (PYTHON) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON)
ModifyPendingOrderAsync ( order , newTargetPrice );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 );
api . ModifyPendingOrderAsync ( order , newTargetPrice )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 )
ModifyPendingOrderAsync (5 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
public TradeOperation ModifyPendingOrderAsync ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (PYTHON) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON)
ModifyPendingOrderAsync ( order , newTargetPrice );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 );
api . ModifyPendingOrderAsync ( order , newTargetPrice )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 )
ModifyPendingOrderAsync (6 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
public TradeOperation ModifyPendingOrderAsync ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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 is a StopOrder callback Action Method that is called when order is modified
Return Value
TradeOperation
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON)
ModifyPendingOrderAsync ( order , newTargetPrice );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true , StopTriggerMethod . Trade );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true , StopTriggerMethod . Trade , StopTriggerMethod . Opposite );
api . ModifyPendingOrderAsync ( order , newTargetPrice )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True , StopTriggerMethod . Trade )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True , StopTriggerMethod . Trade , StopTriggerMethod . Opposite )
ModifyPendingOrderAsync (7 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
public TradeOperation ModifyPendingOrderAsync ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON)
ModifyPendingOrderAsync ( order , newTargetPrice );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true , StopTriggerMethod . Trade );
api . ModifyPendingOrderAsync ( order , newTargetPrice )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True , StopTriggerMethod . Trade )
ModifyPendingOrderAsync (8 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
public TradeOperation ModifyPendingOrderAsync ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON)
ModifyPendingOrderAsync ( order , newTargetPrice );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true );
api . ModifyPendingOrderAsync ( order , newTargetPrice )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True )
ModifyPendingOrderAsync (9 of 9)
Summary
Modify a Pending Order in asynchronous execution mode
Signature
public TradeOperation ModifyPendingOrderAsync ( PendingOrder pendingOrder , double targetPrice , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? New Stop loss takeProfit double? New Take profit protectionType ProtectionType? New Protection type 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 is 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (C#) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON) Example 15 (PYTHON) Example 16 (PYTHON)
ModifyPendingOrderAsync ( order , newTargetPrice );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true , StopTriggerMethod . Trade );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true , StopTriggerMethod . Trade , StopTriggerMethod . Opposite );
ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , true , StopTriggerMethod . Trade , StopTriggerMethod . Opposite , 10 );
api . ModifyPendingOrderAsync ( order , newTargetPrice )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True , StopTriggerMethod . Trade )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True , StopTriggerMethod . Trade , StopTriggerMethod . Opposite )
api . ModifyPendingOrderAsync ( order , order . TargetPrice , 10 , order . TakeProfitPips , ProtectionType . Relative , order . ExpirationTime , 5 , True , StopTriggerMethod . Trade , StopTriggerMethod . Opposite , 10 )
ReversePosition (2) ReversePosition (1 of 2)
Summary
Modify the direction of trade at position
Signature
public TradeResult ReversePosition ( Position position )
Parameters
Name Type Description position Position Position which is affected
Return Value
TradeResult
Examples
ReversePosition (2 of 2)
Summary
Modify the direction of trade and volume of a position
Signature
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
ModifyPosition (4) ModifyPosition (1 of 4)
Summary
Modify the volume of a position
Signature
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
ModifyPosition (2 of 4)
Summary
Modify the protection of a position
Signature
public TradeResult ModifyPosition ( Position position , double? stopLoss , double? takeProfit , ProtectionType ? protectionType )
Parameters
Name Type Description position Position Position which is affected stopLoss double? New stop loss takeProfit double? New take profit protectionType ProtectionType? Protection type
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (PYTHON)
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute );
}
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
api . ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute )
ModifyPosition (3 of 4)
Summary
Modify the protection of a position
Signature
public TradeResult ModifyPosition ( Position position , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , bool hasTrailingStop )
Parameters
Name Type Description position Position Position which is affected stopLoss double? New stop loss takeProfit double? New take profit protectionType ProtectionType? Protection type hasTrailingStop bool Enable/disable TrailingStop for position
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (PYTHON) Example 4 (PYTHON)
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute );
}
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
var hasTrailingStop = true ;
var result = ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop );
Print ( "Position was modified, has Trailing Stop = {0}" , result . Position . HasTrailingStop );
}
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
api . ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute )
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
hasTrailingStop = True
result = api . ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop )
print ( f "Position was modified, has Trailing Stop = { result . Position . HasTrailingStop } " )
ModifyPosition (4 of 4)
Summary
Modify the protection of a position
Signature
public TradeResult ModifyPosition ( Position position , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , bool hasTrailingStop , StopTriggerMethod ? stopLossTriggerMethod )
Parameters
Name Type Description position Position Position which is affected stopLoss double? New stop loss takeProfit double? New take profit protectionType ProtectionType? Protection type hasTrailingStop bool Enable/disable TrailingStop for position stopLossTriggerMethod StopTriggerMethod? Trigger method for position's StopLoss
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (PYTHON) Example 5 (PYTHON) Example 6 (PYTHON)
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute );
}
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
var hasTrailingStop = true ;
var result = ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop );
Print ( "Position was modified, has Trailing Stop = {0}" , result . Position . HasTrailingStop );
}
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
var hasTrailingStop = true ;
var result = ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop , StopTriggerMethod . Opposite );
Print ( "Position was modified, stop loss trigger method = {0}" , result . Position . StopLossTriggerMethod );
}
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
api . ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute )
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
hasTrailingStop = True
result = api . ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop )
print ( f "Position was modified, has Trailing Stop = { result . Position . HasTrailingStop } " )
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
hasTrailingStop = True
result = api . ModifyPosition ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop , StopTriggerMethod . Opposite )
print ( f "Position was modified, stop loss trigger method = { result . Position . StopLossTriggerMethod } " )
ClosePosition (3) ClosePosition (1 of 3)
Summary
Close a position
Signature
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
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
ClosePosition (3 of 3)
Summary
Close a position
Signature
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
ClosePositionAsync (3) ClosePositionAsync (1 of 3)
Summary
Close a position in asynchronous execution mode
Signature
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
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
ClosePositionAsync (3 of 3)
Summary
Close a position in asynchronous execution mode
Signature
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
ReversePositionAsync (2) ReversePositionAsync (1 of 2)
Summary
Reverses Position in asynchronous execution mode
Signature
public TradeOperation ReversePositionAsync ( Position position , Action < TradeResult > callback )
Parameters
Name Type Description position Position Position to reverse callback Action Method that is called when position is modified
Return Value
TradeOperation
Examples
ReversePositionAsync (2 of 2)
Summary
Reverses Position in asynchronous execution mode
Signature
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
ModifyPositionAsync (4) ModifyPositionAsync (1 of 4)
Summary
Modify Position in asynchronous execution mode
Signature
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
ModifyPositionAsync (2 of 4)
Summary
Modify Position in asynchronous execution mode
Signature
public TradeOperation ModifyPositionAsync ( Position position , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , Action < TradeResult > callback )
Parameters
Name Type Description position Position Position to modify stopLoss double? New stop loss takeProfit double? New take profit protectionType ProtectionType? New protection type callback Action Method that is called when position is modified
Return Value
TradeOperation
Examples
Example 1 (C#) Example 2 (PYTHON)
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute );
}
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
api . ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute )
ModifyPositionAsync (3 of 4)
Summary
Modify Position in asynchronous execution mode
Signature
public TradeOperation ModifyPositionAsync ( Position position , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 protectionType ProtectionType? Protection type hasTrailingStop bool Enable/disable TrailingStop for position callback Action Method that is called when position is modified
Return Value
TradeOperation
Examples
Example 1 (C#) Example 2 (C#) Example 3 (PYTHON) Example 4 (PYTHON)
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute );
}
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
var hasTrailingStop = true ;
ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop );
}
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
api . ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute )
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
hasTrailingStop = True
api . ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop )
ModifyPositionAsync (4 of 4)
Summary
Modify Position in asynchronous execution mode
Signature
public TradeOperation ModifyPositionAsync ( Position position , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , bool hasTrailingStop , StopTriggerMethod ? stopLossTriggerMethod , Action < TradeResult > callback )
Parameters
Name Type Description position Position Position to modify stopLoss double? New stop loss takeProfit double? New take profit protectionType ProtectionType? Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (PYTHON) Example 5 (PYTHON) Example 6 (PYTHON)
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute );
}
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
var hasTrailingStop = true ;
ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop );
}
var position = Positions . Find ( "myLabel" , Symbol , TradeType . Buy );
if ( position != null )
{
var stopLoss = Symbol . Ask - 10 * Symbol . PipSize ;
var takeProfit = Symbol . Ask + 10 * Symbol . PipSize ;
var hasTrailingStop = true ;
ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop , StopTriggerMethod . Trade );
}
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
api . ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute )
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
hasTrailingStop = True
api . ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop )
position = api . Positions . Find ( "myLabel" , api . Symbol , TradeType . Buy )
if position is not None :
stopLoss = api . Symbol . Ask - 10 * api . Symbol . PipSize
takeProfit = api . Symbol . Ask + 10 * api . Symbol . PipSize
hasTrailingStop = True
api . ModifyPositionAsync ( position , stopLoss , takeProfit , ProtectionType . Absolute , hasTrailingStop , StopTriggerMethod . Trade )
PlaceStopLimitOrder (8) PlaceStopLimitOrder (1 of 8)
Summary
Place a Stop Limit Order
Signature
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 8)
Summary
Place a Stop Limit Order
Signature
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 8)
Summary
Place a Stop Limit Order
Signature
public TradeResult PlaceStopLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType )
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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type
Return Value
TradeResult
PlaceStopLimitOrder (4 of 8)
Summary
Place a Stop Limit Order
Signature
public TradeResult PlaceStopLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time
Return Value
TradeResult
PlaceStopLimitOrder (5 of 8)
Summary
Place a Stop Limit Order
Signature
public TradeResult PlaceStopLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time comment string Order comment
Return Value
TradeResult
PlaceStopLimitOrder (6 of 8)
Summary
Place a Stop Limit Order
Signature
public TradeResult PlaceStopLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time comment string Order comment hasTrailingStop bool Enable/disable TrailingStop for position
Return Value
TradeResult
PlaceStopLimitOrder (7 of 8)
Summary
Place a Stop Limit Order
Signature
public TradeResult PlaceStopLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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 8)
Summary
Place a Stop Limit Order
Signature
public TradeResult PlaceStopLimitOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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 is a StopLimitOrder
Return Value
TradeResult
PlaceStopLimitOrderAsync (8) PlaceStopLimitOrderAsync (1 of 8)
Summary
Place Stop Limit order in asynchronous execution mode
Signature
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 8)
Summary
Place Stop Limit order in asynchronous execution mode
Signature
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 8)
Summary
Place Stop Limit order in asynchronous execution mode
Signature
public TradeOperation PlaceStopLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type callback Action Action when order is placed
Return Value
TradeOperation
PlaceStopLimitOrderAsync (4 of 8)
Summary
Place Stop Limit order in asynchronous execution mode
Signature
public TradeOperation PlaceStopLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time callback Action Action when order is placed
Return Value
TradeOperation
PlaceStopLimitOrderAsync (5 of 8)
Summary
Place Stop Limit order in asynchronous execution mode
Signature
public TradeOperation PlaceStopLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time comment string Order comment callback Action Action when order is placed
Return Value
TradeOperation
PlaceStopLimitOrderAsync (6 of 8)
Summary
Place Stop Limit order in asynchronous execution mode
Signature
public TradeOperation PlaceStopLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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 8)
Summary
Place Stop Limit order in asynchronous execution mode
Signature
public TradeOperation PlaceStopLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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 8)
Summary
Place Stop Limit order in asynchronous execution mode
Signature
public TradeOperation PlaceStopLimitOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , double stopLimitRangePips , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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 is a StopLimitOrder callback Action Action when order is placed
Return Value
TradeOperation
PlaceStopOrder (8) PlaceStopOrder (1 of 8)
Summary
Place a stop order
Signature
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 8)
Summary
Place a stop order
Signature
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 8)
Summary
Place a stop order
Signature
public TradeResult PlaceStopOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType )
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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type
Return Value
TradeResult
PlaceStopOrder (4 of 8)
Summary
Place a stop order
Signature
public TradeResult PlaceStopOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry time
Return Value
TradeResult
PlaceStopOrder (5 of 8)
Summary
Place a stop order
Signature
public TradeResult PlaceStopOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry time comment string Order comment
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON)
PlaceStopOrder ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Ask );
PlaceStopOrder ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Ask ,
"myStopOrder" );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative );
var expiration = Server . Time . AddHours ( 1 );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , expiration );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" );
api . PlaceStopOrder ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Ask )
api . PlaceStopOrder ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Ask ,
"myStopOrder" )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative )
expiration = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , expiration )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" )
PlaceStopOrder (6 of 8)
Summary
Place a stop order
Signature
public TradeResult PlaceStopOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry time comment string Order comment hasTrailingStop bool Enable/disable TrailingStop for position
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON)
PlaceStopOrder ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Ask );
PlaceStopOrder ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Ask ,
"myStopOrder" );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative );
var expiration = Server . Time . AddHours ( 1 );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , expiration );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" , HasTrailingStop );
api . PlaceStopOrder ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Ask )
api . PlaceStopOrder ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Ask ,
"myStopOrder" )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative )
expiration = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , expiration )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" , HasTrailingStop )
PlaceStopOrder (7 of 8)
Summary
Place a stop order
Signature
public TradeResult PlaceStopOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON)
PlaceStopOrder ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Ask );
PlaceStopOrder ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Ask ,
"myStopOrder" );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative );
var expiration = Server . Time . AddHours ( 1 );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , expiration );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" , HasTrailingStop );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" , HasTrailingStop , StopTriggerMethod . Trade );
api . PlaceStopOrder ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Ask )
api . PlaceStopOrder ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Ask ,
"myStopOrder" )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative )
expiration = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , expiration )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" , HasTrailingStop )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" , HasTrailingStop , StopTriggerMethod . Trade )
PlaceStopOrder (8 of 8)
Summary
Place a stop order
Signature
public TradeResult PlaceStopOrder ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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 is a StopOrder
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (C#) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON) Example 15 (PYTHON) Example 16 (PYTHON)
PlaceStopOrder ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Ask );
PlaceStopOrder ( TradeType . Buy , Symbol . Name , 10000 , Symbol . Ask ,
"myStopOrder" );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative );
var expiration = Server . Time . AddHours ( 1 );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , expiration );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" , HasTrailingStop );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" , HasTrailingStop , StopTriggerMethod . Trade );
PlaceStopOrder ( TradeType . Sell , Symbol . Name , 20000 , Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , null , "my comment" , HasTrailingStop , StopTriggerMethod . Trade , StopTriggerMethod . Opposite );
api . PlaceStopOrder ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Ask )
api . PlaceStopOrder ( TradeType . Buy , api . Symbol . Name , 10000 , api . Symbol . Ask ,
"myStopOrder" )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative )
expiration = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , expiration )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" , HasTrailingStop )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" , HasTrailingStop , StopTriggerMethod . Trade )
api . PlaceStopOrder ( TradeType . Sell , api . Symbol . Name , 20000 , api . Symbol . Ask ,
"myStopOrder" , 20 , 20 , ProtectionType . Relative , None , "my comment" , HasTrailingStop , StopTriggerMethod . Trade , StopTriggerMethod . Opposite )
PlaceStopOrderAsync (8) PlaceStopOrderAsync (1 of 8)
Summary
Place stop order in asynchronous execution mode
Signature
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 8)
Summary
Place stop order in asynchronous execution mode
Signature
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 8)
Summary
Place stop order in asynchronous execution mode
Signature
public TradeOperation PlaceStopOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type callback Action Action when order is placed
Return Value
TradeOperation
PlaceStopOrderAsync (4 of 8)
Summary
Place stop order in asynchronous execution mode
Signature
public TradeOperation PlaceStopOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time callback Action Action when order is placed
Return Value
TradeOperation
PlaceStopOrderAsync (5 of 8)
Summary
Place stop order in asynchronous execution mode
Signature
public TradeOperation PlaceStopOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type expiration DateTime? Order expiry date and time comment string Order comment callback Action Action when order is placed
Return Value
TradeOperation
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (PYTHON) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON)
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 , Symbol . Bid - 5 * Symbol . PipSize );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 , Symbol . Bid - 5 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative );
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" );
protected override void OnStart ()
{
PlaceStopOrderAsync ( TradeType . Buy , Symbol . Name , 20000 , Symbol . Ask , StopOrderOnPlaced );
}
private void StopOrderOnPlaced ( TradeResult tradeResult )
{
Print ( "Stop order placed {0}" , tradeResult . PendingOrder . Label );
}
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 , api . Symbol . Bid - 5 * api . Symbol . PipSize )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 , api . Symbol . Bid - 5 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative )
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" )
1
2
3
4
5
6
7
8
9
10
11
12 import clr
clr . AddReference ( "cAlgo.API" )
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
from System import Action
class Test ():
def on_start ( self ):
api . PlaceStopOrderAsync ( TradeType . Buy , api . Symbol . Name , 20000 , api . Symbol . Ask , Action [ TradeResult ]( self . on_stop_order_placed ))
def on_stop_order_placed ( self , result ):
print ( f "Stop order placed { result . PendingOrder . Label } " )
PlaceStopOrderAsync (6 of 8)
Summary
Place stop order in asynchronous execution mode
Signature
public TradeOperation PlaceStopOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (PYTHON) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON)
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 , Symbol . Bid - 5 * Symbol . PipSize );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 , Symbol . Bid - 5 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative );
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" );
protected override void OnStart ()
{
PlaceStopOrderAsync ( TradeType . Buy , Symbol . Name , 20000 , Symbol . Ask , StopOrderOnPlaced );
}
private void StopOrderOnPlaced ( TradeResult tradeResult )
{
Print ( "Stop order placed {0}" , tradeResult . PendingOrder . Label );
}
var hasTrailingStop = true ;
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , hasTrailingStop );
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 , api . Symbol . Bid - 5 * api . Symbol . PipSize )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 , api . Symbol . Bid - 5 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative )
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" )
1
2
3
4
5
6
7
8
9
10
11
12 import clr
clr . AddReference ( "cAlgo.API" )
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
from System import Action
class Test ():
def on_start ( self ):
api . PlaceStopOrderAsync ( TradeType . Buy , api . Symbol . Name , 20000 , api . Symbol . Ask , Action [ TradeResult ]( self . on_stop_order_placed ))
def on_stop_order_placed ( self , result ):
print ( f "Stop order placed { result . PendingOrder . Label } " )
hasTrailingStop = True
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , hasTrailingStop )
PlaceStopOrderAsync (7 of 8)
Summary
Place stop order in asynchronous execution mode
Signature
public TradeOperation PlaceStopOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (PYTHON) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON)
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 , Symbol . Bid - 5 * Symbol . PipSize );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 , Symbol . Bid - 5 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative );
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" );
protected override void OnStart ()
{
PlaceStopOrderAsync ( TradeType . Buy , Symbol . Name , 20000 , Symbol . Ask , StopOrderOnPlaced );
}
private void StopOrderOnPlaced ( TradeResult tradeResult )
{
Print ( "Stop order placed {0}" , tradeResult . PendingOrder . Label );
}
var hasTrailingStop = true ;
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , hasTrailingStop );
var hasTrailingStop = true ;
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry ,
"order comment" , hasTrailingStop , StopTriggerMethod . Trade );
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 , api . Symbol . Bid - 5 * api . Symbol . PipSize )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 , api . Symbol . Bid - 5 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative )
expiry = Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" )
1
2
3
4
5
6
7
8
9
10
11
12 import clr
clr . AddReference ( "cAlgo.API" )
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
from System import Action
class Test ():
def on_start ( self ):
api . PlaceStopOrderAsync ( TradeType . Buy , api . Symbol . Name , 20000 , api . Symbol . Ask , Action [ TradeResult ]( self . on_stop_order_placed ))
def on_stop_order_placed ( self , result ):
print ( f "Stop order placed { result . PendingOrder . Label } " )
hasTrailingStop = True
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , hasTrailingStop )
hasTrailingStop = True
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry ,
"order comment" , hasTrailingStop , StopTriggerMethod . Trade )
PlaceStopOrderAsync (8 of 8)
Summary
Place stop order in asynchronous execution mode
Signature
public TradeOperation PlaceStopOrderAsync ( TradeType tradeType , string symbolName , double volume , double targetPrice , string label , double? stopLoss , double? takeProfit , ProtectionType ? protectionType , 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 stopLoss double? Stop loss takeProfit double? Take profit protectionType ProtectionType? Protection type 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 is a StopOrder callback Action Action when order is placed
Return Value
TradeOperation
Examples
Example 1 (C#) Example 2 (C#) Example 3 (C#) Example 4 (C#) Example 5 (C#) Example 6 (C#) Example 7 (C#) Example 8 (PYTHON) Example 9 (PYTHON) Example 10 (PYTHON) Example 11 (PYTHON) Example 12 (PYTHON) Example 13 (PYTHON) Example 14 (PYTHON)
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 , Symbol . Bid - 5 * Symbol . PipSize );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 , Symbol . Bid - 5 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative );
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" );
protected override void OnStart ()
{
PlaceStopOrderAsync ( TradeType . Buy , Symbol . Name , 20000 , Symbol . Ask , StopOrderOnPlaced );
}
private void StopOrderOnPlaced ( TradeResult tradeResult )
{
Print ( "Stop order placed {0}" , tradeResult . PendingOrder . Label );
}
var hasTrailingStop = true ;
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , hasTrailingStop );
var hasTrailingStop = true ;
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry ,
"order comment" , hasTrailingStop , StopTriggerMethod . Trade );
var hasTrailingStop = true ;
StopTriggerMethod stopLossTriggerMethod = StopTriggerMethod . Trade ;
StopTriggerMethod stopOrderTriggerMethod = StopTriggerMethod . Trade ;
var expiry = Server . Time . AddHours ( 1 );
PlaceStopOrderAsync ( TradeType . Sell , Symbol . Name , 10000 ,
Symbol . Bid - 10 * Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry ,
"order comment" , hasTrailingStop , stopLossTriggerMethod , stopOrderTriggerMethod );
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 , api . Symbol . Bid - 5 * api . Symbol . PipSize )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 , api . Symbol . Bid - 5 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative )
expiry = Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" )
1
2
3
4
5
6
7
8
9
10
11
12 import clr
clr . AddReference ( "cAlgo.API" )
# Import cAlgo API types
from cAlgo.API import *
# Import trading wrapper functions
from robot_wrapper import *
from System import Action
class Test ():
def on_start ( self ):
api . PlaceStopOrderAsync ( TradeType . Buy , api . Symbol . Name , 20000 , api . Symbol . Ask , Action [ TradeResult ]( self . on_stop_order_placed ))
def on_stop_order_placed ( self , result ):
print ( f "Stop order placed { result . PendingOrder . Label } " )
hasTrailingStop = True
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry , "order comment" , hasTrailingStop )
hasTrailingStop = True
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry ,
"order comment" , hasTrailingStop , StopTriggerMethod . Trade )
hasTrailingStop = True
stopLossTriggerMethod = StopTriggerMethod . Trade
stopOrderTriggerMethod = StopTriggerMethod . Trade
expiry = api . Server . Time . AddHours ( 1 )
api . PlaceStopOrderAsync ( TradeType . Sell , api . Symbol . Name , 10000 ,
api . Symbol . Bid - 10 * api . Symbol . PipSize , "myLabel" , 10 , 10 , ProtectionType . Relative , expiry ,
"order comment" , hasTrailingStop , stopLossTriggerMethod , stopOrderTriggerMethod )
Properties Account Summary
Contains all Account information
Signature
public IAccount Account { get ;}
Return Value
IAccount
Examples
double balance = Account . Balance ;
string currency = Account . Asset . Name ;
double equity = Account . Equity ;
double freemargin = Account . FreeMargin ;
double margin = Account . Margin ;
double? marginlevel = Account . MarginLevel ;
double leverage = Account . PreciseLeverage ;
LastResult Summary
The latest trade result
Signature
public TradeResult LastResult { get ;}
Return Value
TradeResult
Examples
Example 1 (C#) Example 2 (PYTHON)
ExecuteMarketOrder ( TradeType . Buy , Symbol . Name , 20000 , null , 10 , null );
if ( LastResult . IsSuccessful )
Print ( LastResult . Position . StopLoss );
api . ExecuteMarketOrder ( TradeType . Buy , api . Symbol . Name , 20000 , None , 10 , None )
if api . LastResult . IsSuccessful :
print ( api . LastResult . Position . StopLoss )