Skip to content

TradeType

Summary

The direction of a trade order.

Remarks

Indicates the trade direction, whether it is a Buy or a Sell trade.

Signature

1
public enum TradeType

Namespace

cAlgo.API

Examples

1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 20000);
1
 Position position =  Positions.Find("myLabel", Symbol, TradeType.Sell);
1
 PlaceLimitOrder(TradeType.Buy, Symbol, 10000, Symbol.Bid);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 using cAlgo.API;
 namespace cAlgo.Robots
 {
     // This sample cBot shows how to use the TradeType
     // TradeType is used to set an order trade side or direction
     [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class TradeTypeSample : Robot
     {
         [Parameter("Trade Type", DefaultValue = TradeType.Buy)]
         public TradeType TradeType { get; set; }
         protected override void OnStart()
         {
             ExecuteMarketOrder(TradeType, SymbolName, Symbol.VolumeInUnitsMin);
         }
     }
 }

Fields

Buy

Summary

Represents a Buy order.

Signature

1
public static TradeType Buy;

Return Value

TradeType

Examples

1
 ExecuteMarketOrder(TradeType.Buy, Symbol, 10000);
1
 var result = PlaceLimitOrder(TradeType.Buy, Symbol, 10000, Symbol.Bid);

Sell

Summary

Represents a Sell order.

Signature

1
public static TradeType Sell;

Return Value

TradeType

Examples

1
 ExecuteMarketOrder(TradeType.Sell, Symbol, 10000);
1
 var result = PlaceLimitOrder(TradeType.Sell, Symbol, 10000, Symbol.Ask);