/// <summary>
        ///     Sets a new order Buy Limit.
        /// </summary>
        private static void OrdBuyLimit(int bar, int orderIf, int toPos, double lots, double price, OrderSender sender,
                                        OrderOrigin origin, string note)
        {
            int sessionOrder = session[bar].Orders;
            Order order = session[bar].Order[sessionOrder] = new Order();

            order.OrdNumb = SentOrders;
            order.OrdDir = OrderDirection.Buy;
            order.OrdType = OrderType.Limit;
            order.OrdCond = orderIf > 0 ? OrderCondition.If : OrderCondition.Norm;
            order.OrdStatus = OrderStatus.Confirmed;
            order.OrdIf = orderIf;
            order.OrdPos = toPos;
            order.OrdLots = lots;
            order.OrdPrice = Math.Round(price, InstrProperties.Digits);
            order.OrdPrice2 = 0;
            order.OrdSender = sender;
            order.OrdOrigin = origin;
            order.OrdNote = note;

            ordCoord[SentOrders].Bar = bar;
            ordCoord[SentOrders].Ord = sessionOrder;
            session[bar].Orders++;
            SentOrders++;
        }
Example #2
0
        public static string ShortenOrigin(OrderOrigin origin)
        {
            switch (origin)
            {
            case OrderOrigin.PositionOpen:
                return("PO");

            case OrderOrigin.PositionClose:
                return("PC");

            case OrderOrigin.PositionClose_ContStop:
                return("PCS");

            case OrderOrigin.PositionClose_ContLimit:
                return("PCL");

            case OrderOrigin.PositionClose_TE:
                return("PCT");

            case OrderOrigin.PositionClose_CircuitBreaker:
                return("PCB");

            case OrderOrigin.PositionReverse_Close:
                return("PRC");

            case OrderOrigin.PositionReverse_Open:
                return("PRO");

            case OrderOrigin.PositionDouble:
                return("PD");

            default:
                return(null);
            }
        }
Example #3
0
        /// <summary>
        ///     Sets a new order Buy Limit.
        /// </summary>
        private static void OrdBuyLimit(int bar, int orderIf, int toPos, double lots, double price, OrderSender sender,
                                        OrderOrigin origin, string note)
        {
            int   sessionOrder = session[bar].Orders;
            Order order        = session[bar].Order[sessionOrder] = new Order();

            order.OrdNumb   = SentOrders;
            order.OrdDir    = OrderDirection.Buy;
            order.OrdType   = OrderType.Limit;
            order.OrdCond   = orderIf > 0 ? OrderCondition.If : OrderCondition.Norm;
            order.OrdStatus = OrderStatus.Confirmed;
            order.OrdIf     = orderIf;
            order.OrdPos    = toPos;
            order.OrdLots   = lots;
            order.OrdPrice  = Math.Round(price, InstrProperties.Digits);
            order.OrdPrice2 = 0;
            order.OrdSender = sender;
            order.OrdOrigin = origin;
            order.OrdNote   = note;

            ordCoord[SentOrders].Bar = bar;
            ordCoord[SentOrders].Ord = sessionOrder;
            session[bar].Orders++;
            SentOrders++;
        }
Example #4
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public Order()
 {
     openClose             = "O";
     origin                = OrderOrigin.Customer;
     transmit              = true;
     tif                   = TimeInForce.Day;
     designatedLocation    = "";
     minQty                = Int32.MaxValue;
     percentOffset         = Double.MaxValue;
     nbboPriceCap          = decimal.MaxValue;
     startingPrice         = decimal.MaxValue;
     stockRefPrice         = Double.MaxValue;
     delta                 = Double.MaxValue;
     stockRangeLower       = Double.MaxValue;
     stockRangeUpper       = Double.MaxValue;
     volatility            = Double.MaxValue;
     volatilityType        = VolatilityType.Undefined;
     deltaNeutralOrderType = OrderType.Empty;
     deltaNeutralAuxPrice  = Double.MaxValue;
     referencePriceType    = Int32.MaxValue;
     trailStopPrice        = decimal.MaxValue;
     basisPoints           = decimal.MaxValue;
     basisPointsType       = Int32.MaxValue;
     scaleInitLevelSize    = Int32.MaxValue;
     scaleSubsLevelSize    = Int32.MaxValue;
     scalePriceIncrement   = decimal.MaxValue;
     faMethod              = FinancialAdvisorAllocationMethod.None;
     notHeld               = false;
 }
Example #5
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Order()
 {
     ordDir    = OrderDirection.None;
     ordType   = OrderType.None;
     ordCond   = OrderCondition.None;
     ordStatus = OrderStatus.None;
     ordSender = OrderSender.None;
     ordOrigin = OrderOrigin.None;
     ordNote   = "Not Defined";
 }
Example #6
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public Order()
 {
     openClose = "O";
     origin = OrderOrigin.Customer;
     transmit = true;
     tif = TimeInForce.Day;
     designatedLocation = "";
     minQty = Int32.MaxValue;
     percentOffset = Double.MaxValue;
     nbboPriceCap = decimal.MaxValue;
     startingPrice = decimal.MaxValue;
     stockRefPrice = Double.MaxValue;
     delta = Double.MaxValue;
     stockRangeLower = Double.MaxValue;
     stockRangeUpper = Double.MaxValue;
     volatility = Double.MaxValue;
     volatilityType = VolatilityType.Undefined;
     deltaNeutralOrderType = OrderType.Empty;
     deltaNeutralAuxPrice = Double.MaxValue;
     referencePriceType = Int32.MaxValue;
     trailStopPrice = decimal.MaxValue;
     basisPoints = decimal.MaxValue;
     basisPointsType = Int32.MaxValue;
     scaleInitLevelSize = Int32.MaxValue;
     scaleSubsLevelSize = Int32.MaxValue;
     scalePriceIncrement = decimal.MaxValue;
     faMethod = FinancialAdvisorAllocationMethod.None;
     notHeld = false;
     exemptCode = -1;
     
     optOutSmartRouting = false;
     deltaNeutralConId = 0;
     deltaNeutralOrderType = OrderType.Empty;
     deltaNeutralSettlingFirm = string.Empty;
     deltaNeutralClearingAccount = string.Empty;
     deltaNeutralClearingIntent = string.Empty;
 }
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Order()
 {
     ordDir    = OrderDirection.None;
     ordType   = OrderType.None;
     ordCond   = OrderCondition.None;
     ordStatus = OrderStatus.None;
     ordSender = OrderSender.None;
     ordOrigin = OrderOrigin.None;
     ordNote   = "Not Defined";
 }
Example #8
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public Order()
        {
            openClose = "O";
            origin = OrderOrigin.Customer;
            transmit = true;
            tif = TimeInForce.Day;
            designatedLocation = "";
            minQty = int.MaxValue;
            percentOffset = double.MaxValue;
            nbboPriceCap = decimal.MaxValue;
            startingPrice = decimal.MaxValue;
            stockRefPrice = double.MaxValue;
            delta = double.MaxValue;
            stockRangeLower = double.MaxValue;
            stockRangeUpper = double.MaxValue;
            volatility = double.MaxValue;
            volatilityType = VolatilityType.Undefined;
            deltaNeutralOrderType = OrderType.Empty;
            deltaNeutralAuxPrice = double.MaxValue;
            referencePriceType = int.MaxValue;
            trailStopPrice = decimal.MaxValue;
            basisPoints = decimal.MaxValue;
            basisPointsType = int.MaxValue;
            scaleInitLevelSize = int.MaxValue;
            scaleSubsLevelSize = int.MaxValue;
            scalePriceIncrement = decimal.MaxValue;
            faMethod = FinancialAdvisorAllocationMethod.None;
            notHeld = false;
            exemptCode = -1;

            optOutSmartRouting = false;
            deltaNeutralConId = 0;
            deltaNeutralOrderType = OrderType.Empty;
            deltaNeutralSettlingFirm = string.Empty;
            deltaNeutralClearingAccount = string.Empty;
            deltaNeutralClearingIntent = string.Empty;

            DeltaNeutralOpenClose = "";
            DeltaNeutralShortSale = false;
            DeltaNeutralShortSaleSlot = 0;
            DeltaNeutralDesignatedLocation = "";
            referencePriceType = int.MaxValue;
            trailStopPrice = decimal.MaxValue;
            TrailingPercent = double.MaxValue;
            BasisPoints = decimal.MaxValue;
            basisPointsType = int.MaxValue;
            scaleInitLevelSize = int.MaxValue;
            scaleSubsLevelSize = int.MaxValue;
            scalePriceIncrement = decimal.MaxValue;
            ScalePriceAdjustValue = double.MaxValue;
            ScalePriceAdjustInterval = int.MaxValue;
            ScaleProfitOffset = double.MaxValue;
            ScaleAutoReset = false;
            ScaleInitPosition = int.MaxValue;
            ScaleInitFillQty = int.MaxValue;
            ScaleRandomPercent = false;
            ScaleTable = "";
            whatIf = false;
            notHeld = false;
            Conditions = new List<OrderCondition>();
            TriggerPrice = double.MaxValue;
            LmtPriceOffset = double.MaxValue;
            AdjustedStopPrice = double.MaxValue;
            AdjustedStopLimitPrice = double.MaxValue;
            AdjustedTrailingAmount = double.MaxValue;
            ExtOperator = "";
        }
Example #9
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public Order()
        {
            openClose             = "O";
            origin                = OrderOrigin.Customer;
            transmit              = true;
            tif                   = TimeInForce.Day;
            designatedLocation    = "";
            minQty                = int.MaxValue;
            percentOffset         = double.MaxValue;
            nbboPriceCap          = decimal.MaxValue;
            startingPrice         = decimal.MaxValue;
            stockRefPrice         = double.MaxValue;
            delta                 = double.MaxValue;
            stockRangeLower       = double.MaxValue;
            stockRangeUpper       = double.MaxValue;
            volatility            = double.MaxValue;
            volatilityType        = VolatilityType.Undefined;
            deltaNeutralOrderType = OrderType.Empty;
            deltaNeutralAuxPrice  = double.MaxValue;
            referencePriceType    = int.MaxValue;
            trailStopPrice        = decimal.MaxValue;
            basisPoints           = decimal.MaxValue;
            basisPointsType       = int.MaxValue;
            scaleInitLevelSize    = int.MaxValue;
            scaleSubsLevelSize    = int.MaxValue;
            scalePriceIncrement   = decimal.MaxValue;
            faMethod              = FinancialAdvisorAllocationMethod.None;
            notHeld               = false;
            exemptCode            = -1;

            optOutSmartRouting          = false;
            deltaNeutralConId           = 0;
            deltaNeutralOrderType       = OrderType.Empty;
            deltaNeutralSettlingFirm    = string.Empty;
            deltaNeutralClearingAccount = string.Empty;
            deltaNeutralClearingIntent  = string.Empty;

            DeltaNeutralOpenClose          = "";
            DeltaNeutralShortSale          = false;
            DeltaNeutralShortSaleSlot      = 0;
            DeltaNeutralDesignatedLocation = "";
            referencePriceType             = int.MaxValue;
            trailStopPrice           = decimal.MaxValue;
            TrailingPercent          = double.MaxValue;
            BasisPoints              = decimal.MaxValue;
            basisPointsType          = int.MaxValue;
            scaleInitLevelSize       = int.MaxValue;
            scaleSubsLevelSize       = int.MaxValue;
            scalePriceIncrement      = decimal.MaxValue;
            ScalePriceAdjustValue    = double.MaxValue;
            ScalePriceAdjustInterval = int.MaxValue;
            ScaleProfitOffset        = double.MaxValue;
            ScaleAutoReset           = false;
            ScaleInitPosition        = int.MaxValue;
            ScaleInitFillQty         = int.MaxValue;
            ScaleRandomPercent       = false;
            ScaleTable             = "";
            whatIf                 = false;
            notHeld                = false;
            Conditions             = new List <OrderCondition>();
            TriggerPrice           = double.MaxValue;
            LmtPriceOffset         = double.MaxValue;
            AdjustedStopPrice      = double.MaxValue;
            AdjustedStopLimitPrice = double.MaxValue;
            AdjustedTrailingAmount = double.MaxValue;
            ExtOperator            = "";
        }