Forex_Strategy_Builder.Backtester.OrdBuyStopLimit C# (CSharp) Method

OrdBuyStopLimit() static private method

Sets a new order Buy Stop Limit.
static private OrdBuyStopLimit ( int bar, int orderIf, int toPos, double lots, double price1, double price2, OrderSender sender, OrderOrigin origin, string note ) : void
bar int
orderIf int
toPos int
lots double
price1 double
price2 double
sender OrderSender
origin OrderOrigin
note string
return void
        static void OrdBuyStopLimit(int bar, int orderIf, int toPos, double lots, double price1, double price2, OrderSender sender, OrderOrigin origin, string note)
        {
            int sessionOrder = session[bar].Orders;
            Order order = session[bar].Order[sessionOrder] = new Order();

            order.OrdNumb   = totalOrders;
            order.OrdDir    = OrderDirection.Buy;
            order.OrdType   = OrderType.StopLimit;
            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(price1, InstrProperties.Digits);
            order.OrdPrice2 = Math.Round(price2, InstrProperties.Digits);
            order.OrdSender = sender;
            order.OrdOrigin = origin;
            order.OrdNote   = note;

            ordCoord[totalOrders].Bar = bar;
            ordCoord[totalOrders].Ord = sessionOrder;
            session[bar].Orders++;
            totalOrders++;
        }