TradeType


Summary

The direction of a trade order.

Remarks

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

Syntax

public sealed enum TradeType

Members

NameTypeSummary
Buy FieldRepresents a Buy order.
Sell FieldRepresents a Sell order.

Example 1

ExecuteMarketOrder(TradeType.Buy, Symbol, 20000);

Example 2

Position position =  Positions.Find("myLabel", Symbol, TradeType.Sell);

Example 3

PlaceLimitOrder(TradeType.Buy, Symbol, 10000, Symbol.Bid);

Example 4

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);
        }
    }
}
Reference