TradeResult
Summary
The result of a trade operation.
Signature
| public sealed class TradeResult
|
Namespace
cAlgo.API
Examples
Methods
ToString
Summary
The description of a trade result.
Signature
Return Value
string
Examples
| TradeResult result = PlaceLimitOrder(TradeType.Sell, Symbol, 50000, Symbol.Ask);
if (result.IsSuccessful)
Print(result.ToString());
|
Properties
IsSuccessful
Summary
True if the trade is successful, false if there is an error.
Signature
| public bool IsSuccessful {get;}
|
Return Value
bool
Examples
| TradeResult result = ExecuteMarketOrder(TradeType.Buy, Symbol, 20000);
if (result.IsSuccessful)
Print("Buy at {0}", result.Position.EntryPrice);
|
Error
Summary
The error code of an unsuccessful trade.
Signature
| public ErrorCode? Error {get;}
|
Return Value
ErrorCode?
Examples
| var mySymbol = MarketData.GetSymbol("EURUSD");
TradeResult result = ExecuteMarketOrder(TradeType.Sell, mySymbol, 1);
if(!result.IsSuccessful)
Print("Error: {0}", result.Error);
|
Position
Summary
The resulting position of a trade request.
Signature
| public Position Position {get;}
|
Return Value
Position
Examples
| TradeResult result = ExecuteMarketOrder(TradeType.Sell, Symbol, 50000);
if (result.IsSuccessful)
Print("Sell at {0}", result.Position.EntryPrice);
|
PendingOrder
Summary
The resulting pending order of a trade request.
Signature
| public PendingOrder PendingOrder {get;}
|
Return Value
PendingOrder
Examples
| TradeResult result = PlaceLimitOrder(TradeType.Sell, Symbol,
50000, Symbol.Ask, "myLabel", 10, null);
if(result.IsSuccessful)
Print("Order placed. SL: {0}", result.PendingOrder.StopLoss);
|