Skip to content

ToString Method

ToString

Summary

The description of a trade result.

Signature

1
public string ToString()

Return Value

string

Declaring Type

cAlgo.API.TradeResult

Examples

1
2
3
 TradeResult result = ExecuteMarketOrder(TradeType.Sell, Symbol, 20000);
 if (result.IsSuccessful)
     Print("Sell at {0}", result.Position.EntryPrice);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 using cAlgo.API;
 namespace cAlgo.Robots
 {
     // This sample cBot shows how to get a trade operation result
     [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class TradeResultSample : Robot
     {
         protected override void OnStart()
         {
             var tradeResult = ExecuteMarketOrder(TradeType.Buy, SymbolName, Symbol.VolumeInUnitsMin);
             if (tradeResult.IsSuccessful)
             {
                 Print("Market order execution was successful");
                 var position = tradeResult.Position;
                 Print("A new position opend with ID ", position.Id);
             }
             else
             {
                 Print("Market order execution was not successful");
             }
         }
     }
 }

Last update: November 25, 2022

Comments