TradeOperation


Summary

Provides access to properties describing an asynchronous trade operation.

Syntax

public class TradeOperation : Object

Members

NameTypeSummary
IsExecuting PropertyTrue if a trade operation is being executed, false if it completed
SetResult Method
ToString MethodThe description of a trade operation
TradeOperation Method
TradeResult PropertyThe result of a trade operation

Example 1

TradeOperation operation = ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "asynchronous");
if (operation.IsExecuting)
{
    Print("Trade is executing");
}
else
{
    if (operation.TradeResult.IsSuccessful)
        Print("Trade executed");
}

Example 2

protected override void OnStart()
{
    Positions.Opened += PositionsOnOpened;
    TradeOperation operation = ExecuteMarketOrderAsync(TradeType.Buy, Symbol, 10000, "asynchronous");
    ExecuteMarketOrder(TradeType.Buy, Symbol, 10000, "synchronous", 10, 10);
    if (operation.IsExecuting)
    {
        Print("Trade is executing");
    }
    else
    {
        if (operation.TradeResult.IsSuccessful)
            Print("Trade executed");
    } 
}
private void PositionsOnOpened(PositionOpenedEventArgs args)
{
    var pos = args.Position;
    Print("Position {0} opened at {1}", pos.Label, pos.EntryPrice);
}