Exemplo n.º 1
0
        private void buttonModifyOrder_Click(object sender, EventArgs e)
        {
            List <Order> orders = GetSelectedOrders();

            if (orders.Count > 1 || orders.Count == 0)
            {
                MessageBox.Show("Select a single order to modify.");
                return;
            }

            ActiveOrder selectedOrder = (ActiveOrder)orders[0];

            if (selectedOrder.IsOpenOrPending == false ||
                selectedOrder.OrderExecutionProvider == null)
            //|| selectedOrder.OrderExecutionProvider.DataProvider == null
            //|| selectedOrder.OrderExecutionProvider.DataProvider.Quotes == null)
            {
                return;
            }

            ModifyOrderControl control = new ModifyOrderControl(ModifyOrderControl.ModeEnum.Modify, selectedOrder);

            control.Visible = true;

            HostingForm form = new HostingForm("Modify order", control);

            form.ShowDialog();
        }
        public void AddClientActiveOrder(ActiveOrderDTO _order, ClientDTO _client)
        {
            if (_order is null)
            {
                throw new ArgumentNullException("_order");
            }
            if (_client is null)
            {
                throw new ArgumentException("_client");
            }

            ActiveOrder order  = Mapper.Map <ActiveOrder>(_order);
            Client      client = UnitOfWork.Clients.FindByPhoneNumber(_client.PhoneNumber);

            if (client is null)
            {
                client = Mapper.Map <Client>(_client);
                client.ActiveOrders.Add(order);
                UnitOfWork.Clients.Insert(client);
            }
            else
            {
                client.ActiveOrders.Add(order);
                UnitOfWork.Clients.Update(client);
            }
            UnitOfWork.Save();
        }
Exemplo n.º 3
0
        private void buttonCloseOrder_Click(object sender, EventArgs e)
        {
            List <Order> orders = GetSelectedOrders();

            if (orders.Count > 1 || orders.Count == 0)
            {
                MessageBox.Show("Select a single order to close.");
                return;
            }

            if (orders[0] is ActiveOrder)
            {
                ActiveOrder order = (ActiveOrder)orders[0];

                if (order.IsOpenOrPending == false)
                {
                    return;
                }

                if (order.State == OrderStateEnum.Submitted)
                {
                    string message;
                    if (order.Cancel(out message))
                    {
                        MessageBox.Show("Order canceled.", "Success", MessageBoxButtons.OK);
                    }
                    else
                    {
                        MessageBox.Show("Order cancel failed [" + message + "].", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    ModifyOrderControl control = new ModifyOrderControl(ModifyOrderControl.ModeEnum.Close, order);
                    HostingForm        form    = new HostingForm("Modify order", control);
                    form.ShowDialog();
                }
            }
            else if (orders[0] is PassiveOrder)
            {
                PassiveOrder order = (PassiveOrder)orders[0];

                if (order.State != OrderStateEnum.Submitted)
                {
                    MessageBox.Show("Passive orders can only be canceled.");
                    return;
                }

                string operationResultMessage = string.Empty;
                if (order.CloseOrCancel(null, null, out operationResultMessage) == false)
                {
                    MessageBox.Show("Failed to cancel order [" + operationResultMessage + "].", "Order Cancel Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Exemplo n.º 4
0
        public void UnInitialize()
        {
            if (_dataProvider != null)
            {
                _dataProvider.QuoteUpdateEvent -= new QuoteProviderUpdateDelegate(_dataProvider_QuoteUpdateEvent);
                _dataProvider = null;
            }

            _order = null;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Detailed constructor.
 /// </summary>
 public ModifyOrderControl(ModeEnum mode, ActiveOrder order)
 {
     InitializeComponent();
     _provider     = order.OrderExecutionProvider;
     _mode         = mode;
     _order        = order;
     _dataProvider = order.QuoteProvider;
     _dataProvider.QuoteUpdateEvent += new QuoteProviderUpdateDelegate(_dataProvider_QuoteUpdateEvent);
     _session = order.SessionInfo.Value;
 }
        public ActiveOrderDTO FindOrder(int orderId)
        {
            ActiveOrder order = UnitOfWork.ActiveOrders.FindById(orderId);

            if (!(order is null))
            {
                //UnitOfWork.ActiveOrders.LoadActiveOrders(order);
                return(Mapper.Map <ActiveOrderDTO>(order));
            }
            return(null);
        }
        public void ConfirmPayment(int activeOrderId)
        {
            ActiveOrder order = UnitOfWork.ActiveOrders.FindById(activeOrderId);

            if (!(order is null))
            {
                order.PaymentState = PaymentStateEnum.P;
                UnitOfWork.ActiveOrders.Update(order);
                UnitOfWork.Save();
            }
        }
        public ActiveOrderDTO InsertOrder(ActiveOrderDTO order)
        {
            if (order is null)
            {
                throw new ArgumentNullException(nameof(order));
            }
            ActiveOrder newOrder = Mapper.Map <ActiveOrder>(order);

            UnitOfWork.ActiveOrders.Insert(newOrder);
            UnitOfWork.Save();
            return(Mapper.Map <ActiveOrderDTO>(newOrder));
        }
Exemplo n.º 9
0
        public static void NewOrderSubmitted([ServiceBusTrigger("buyerOrders", Connection = "ServiceBusConnectionString")]  ActiveOrder order,
                                             [SignalR(HubName = "notifications")] IAsyncCollector <SignalRMessage> signalRMessage, ILogger log)
        {
            log.LogInformation($"Saving Order Details to Database -  Item Name:{order.ItemName}, Buyer Name:{order.BuyerName}");
            SaveToDataBase(order);

            log.LogInformation($"Passing order details to SignalR -  Item Name:{order.ItemName}, Buyer Name:{order.BuyerName}");
            signalRMessage.AddAsync(new SignalRMessage
            {
                Target    = "newOrderSubmitted",
                Arguments = new[] { order }
            });
        }
        public bool ConfirmPayment(int activeOrderId)
        {
            ActiveOrder order = UnitOfWork.ActiveOrders.FindById(activeOrderId);

            if (!(order is null))
            {
                order.PaymentState = PaymentStateEnum.P;
                UnitOfWork.ActiveOrders.Update(order);
                UnitOfWork.Save();
                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
        private static void SaveToDataBase(ActiveOrder order)
        {
            using SqlConnection con = new SqlConnection(Environment.GetEnvironmentVariable("SQLConnectionString"));
            using (SqlCommand cmd = new SqlCommand())
            {
                con.Open();
                cmd.Connection  = con;
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "usp_buyer_order_insert";
                cmd.Parameters.AddWithValue("@BuyerName", order.BuyerName);
                cmd.Parameters.AddWithValue("@ItemName", order.ItemName);
                cmd.Parameters.AddWithValue("@Quantity", order.Quantity);

                cmd.ExecuteNonQuery();
            }
        }
        public bool UpdateOrder(ActiveOrderDTO order)
        {
            if (order is null)
            {
                throw new ArgumentNullException(nameof(order));
            }
            if (!UnitOfWork.Clients.CheckAvailability(order.ActiveOrderId))
            {
                return(false);
            }
            ActiveOrder editOrder = Mapper.Map <ActiveOrder>(order);

            UnitOfWork.ActiveOrders.Update(editOrder);
            UnitOfWork.Save();
            return(true);
        }
Exemplo n.º 13
0
        private void SendNotification(ActiveOrder order)
        {
            var instrumentName = Instrument.ToString().Replace("Default", "").Replace(" ", "").Replace("$", "");

            var mailSubject = string.Format("KC-SIGNAL-{0}:  {1} @  {2}", instrumentName,
                                            (order.IsLong) ? "BULL" : "BEAR",
                                            Close[0]);
            var mailContentTemplate = @"A {0} signal was observed in '{1}' at {2} at a closing price of {3}.
Exit at {4}
Strike Width: {5}";
            var mailContent         = string.Format(mailContentTemplate, (order.IsLong) ? "BULL" : "BEAR", Instrument, Time,
                                                    Close[0], order.ExitAt, order.StrikeWidth);

            if (Historical)
            {
                return;
            }
            SendMail("*****@*****.**", "*****@*****.**", mailSubject, mailContent);
        }
        private List <ActiveOrder> GetActiveOrdersFromDataBase()
        {
            List <ActiveOrder> lstActiveOrder = new List <ActiveOrder>();

            using (SqlConnection con = new SqlConnection(_appSettings.SQLConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    con.Open();
                    cmd.Connection  = con;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "usp_active_orders_get";
                    SqlDataReader dataReader = cmd.ExecuteReader();
                    if (dataReader.HasRows)
                    {
                        while (dataReader.Read())
                        {
                            //Create ActiveOrder object
                            ActiveOrder ao = new ActiveOrder
                            {
                                BuyerName = dataReader["BuyerName"].ToString(),
                                ItemName  = dataReader["ItemName"].ToString(),
                                OrderId   = Convert.ToInt32(dataReader["OrderId"]),
                                Quantity  = Convert.ToInt32(dataReader["Quantity"]),
                                Status    = dataReader["Status"].ToString()
                            };

                            //Add Active order object to list
                            lstActiveOrder.Add(ao);
                        }
                    }
                    else
                    {
                        Console.WriteLine("No rows found.");
                    }
                    dataReader.Close();
                }
            }

            return(lstActiveOrder);
        }
Exemplo n.º 15
0
        private void SendNotification(double candlestick, ActiveOrder order)
        {
            if (Historical)
            {
                return;
            }


            var isBull         = IsBullishSentiment(candlestick);
            var instrumentName = this.Instrument.ToString().Replace("Default", "").Replace(" ", "").Replace("$", "");

            var mailSubject = string.Format("KC-SIGNAL-{0}:  {1} @ {2} - {3} ", instrumentName, (isBull) ? "BULL" : "BEAR",
                                            Close[0], (Kp)candlestick);
            var mailContentTemplate = @"A {0} {4} signal was observed in '{1}' at {2} at a closing price of {3}.
Exit at {5}
Strike Width: {6}";
            var mailContent         = string.Format(mailContentTemplate, (isBull) ? "BULL" : "BEAR", Instrument, Time, Close[0],
                                                    (Kp)candlestick, order.ExitAt, order.StrikeWidth);

            SendMail("*****@*****.**", "*****@*****.**", mailSubject, mailContent);
        }
Exemplo n.º 16
0
        private void SendNotification(ActiveOrder order)
        {
            var instrumentName = Instrument.ToString().Replace("Default", "").Replace(" ", "").Replace("$", "");

            var mailSubject = string.Format("KC-SIGNAL-{0}:  {1} @  {2}", instrumentName,
                (order.IsLong) ? "BULL" : "BEAR",
                Close[0]);
            var mailContentTemplate = @"A {0} signal was observed in '{1}' at {2} at a closing price of {3}.
Exit at {4}
Strike Width: {5}";
            var mailContent = string.Format(mailContentTemplate, (order.IsLong) ? "BULL" : "BEAR", Instrument, Time,
                Close[0], order.ExitAt, order.StrikeWidth);

            if (Historical)
                return;
            SendMail("*****@*****.**", "*****@*****.**", mailSubject, mailContent);
        }
Exemplo n.º 17
0
        protected override void OnBarUpdate()
        {

            try
            {

               
                HandleCurrentOrders();



                foreach (
                    var dood in
                        _stats.Where(z => z.Value.Success > 0).OrderByDescending(z => z.Value.Success/z.Value.Attempt))
                {
                    Print(string.Format("{0}-({4}): {1} of {2} ({3}) successful", dood.Key, dood.Value.Success,
                        dood.Value.Attempt, (dood.Value.Success / dood.Value.Attempt), dood.Key.ToInt()));
                }


                Print(string.Format("{0} of {1} bulls successful({2})", _winningBulls, _bulls, (_bulls > 0) ? (double)_winningBulls / _bulls : 0));
                Print(string.Format("{0} of {1} bears successful({2})", _winningBears, _bears, (_bears > 0) ? (double)_winningBears / _bears : 0));
                Print(string.Format("{0} of {1} all successful({2})", _winningBears + _winningBulls, _bears + _bulls, (_bears + _bulls > 0)?(double)(_winningBears + _winningBulls) / (_bears + _bulls):0));




                double candlestick = 0;

                var barTime = DateTime.Parse(Time.ToString());

                //Make Sure there is enough movement to matter

                if (!HasEnoughVoltility())
                    return;




                //Is there any sentiment found
                foreach (var dood in KpsToUse)
                {
                    candlestick = 0;
                    candlestick = KenCandleStickPattern(dood, TrendStrength)[0];
                    if (candlestick != 0)
                        break;


                }

                if (IsBullishSentiment(candlestick) || IsBearishSentiment(candlestick))
                {
                    var expiryTime = barTime.AddHours(1);

                    var
                        order = new ActiveOrder
                        {
                            Id = Guid.NewGuid(),
                            Time = barTime,
                            ExpiryHour = expiryTime.Hour,
                            ExpiryDay = expiryTime.Day,
                            EnteredAt = Close[0],
                            Kp = (Kp) (int) candlestick,
                            StrikeWidth = _strikeWidth
                        };


                    if (IsBullishSentiment(candlestick))
                    {
                        order.IsLong = true;
                        order.ExitAt = Close[0] + (Math.Abs(_strikeWidth*.5));
                        activerOrders.Add(order.Id, order);
                        _bulls++;
                        _stats[(Kp) (int) candlestick].Attempt = _stats[(Kp) (int) candlestick].Attempt + 1;

                        SendNotification(candlestick, order);
                    }

                    if (IsBearishSentiment(candlestick))
                    {
                        order.IsLong = false;
                        order.ExitAt = Close[0] - (Math.Abs(_strikeWidth*5));

                        activerOrders.Add(order.Id, order);
                        _bears++;

                        _stats[(Kp) (int) candlestick].Attempt = _stats[(Kp) (int) candlestick].Attempt + 1;

                        SendNotification(candlestick, order);
                    }
                }

            }
            catch (Exception e)
            {
                Log("error found:" + e.Message + " " + e.Source + " " + e.StackTrace, LogLevel.Error);
            }



        }
Exemplo n.º 18
0
        private void SendNotification(double candlestick, ActiveOrder order)
        {

            if (Historical)
                return;

            
            var isBull = IsBullishSentiment(candlestick);
            var instrumentName = this.Instrument.ToString().Replace("Default", "").Replace(" ", "").Replace("$", "");

            var mailSubject = string.Format("KC-SIGNAL-{0}:  {1} @ {2} - {3} ", instrumentName, (isBull) ? "BULL" : "BEAR",
                 Close[0], (Kp) candlestick);
            var mailContentTemplate = @"A {0} {4} signal was observed in '{1}' at {2} at a closing price of {3}.
Exit at {5}
Strike Width: {6}";
            var mailContent = string.Format(mailContentTemplate, (isBull) ? "BULL" : "BEAR", Instrument, Time, Close[0],
                (Kp) candlestick, order.ExitAt, order.StrikeWidth);
            SendMail("*****@*****.**", "*****@*****.**", mailSubject, mailContent);
        }
Exemplo n.º 19
0
        public IActionResult DoOrder([FromBody] UserData userData)
        {
            var username = User.Identity.Name;

            try
            {
                var user     = db.Users.First(x => x.Email == username);
                var userCart = db.Cart.Where(x => x.UserId == user.Id).ToList();
                if (userCart.Count > 0)
                {
                    int orderId = userCart[0].Id;
                    foreach (var product in userCart)
                    {
                        var order = new ActiveOrder()
                        {
                            UserId        = user.Id,
                            OrderId       = orderId,
                            IsComplete    = false,
                            OrderDateTime = DateTime.Now,
                            ProductId     = product.ProductId,
                            Quantity      = product.Quantity,
                            Cost          = db.Products.First(x => x.Id == product.ProductId).Cost
                        };
                        db.ActiveOrders.Add(order);
                        db.Cart.Remove(product);
                        db.SaveChanges();
                    }

                    var databaseUserData = db.UsersData.FirstOrDefault(x => x.UserId == user.Id);
                    if (databaseUserData != null)
                    {
                        databaseUserData.Address      = userData.Address;
                        databaseUserData.City         = userData.City;
                        databaseUserData.Country      = userData.Country;
                        databaseUserData.FirstName    = userData.FirstName;
                        databaseUserData.LastName     = userData.LastName;
                        databaseUserData.MobileNumber = userData.MobileNumber;
                        databaseUserData.Zipcode      = userData.Zipcode;
                        db.UsersData.Update(databaseUserData);
                        db.SaveChanges();
                    }
                    else
                    {
                        userData = new UserData()
                        {
                            UserId       = user.Id,
                            Address      = userData.Address,
                            City         = userData.City,
                            Country      = userData.Country,
                            FirstName    = userData.FirstName,
                            LastName     = userData.LastName,
                            MobileNumber = userData.MobileNumber,
                            Zipcode      = userData.Zipcode
                        };
                        db.UsersData.Add(userData);
                        db.SaveChanges();
                    }

                    return(StatusCode(200));
                }

                return(StatusCode(400, "Cart on server is empty"));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error" + ex));
            }
        }
Exemplo n.º 20
0
        protected override void OnBarUpdate()
        {
            try
            {
                HandleCurrentOrders();



                foreach (
                    var dood in
                    _stats.Where(z => z.Value.Success > 0).OrderByDescending(z => z.Value.Success / z.Value.Attempt))
                {
                    Print(string.Format("{0}-({4}): {1} of {2} ({3}) successful", dood.Key, dood.Value.Success,
                                        dood.Value.Attempt, (dood.Value.Success / dood.Value.Attempt), dood.Key.ToInt()));
                }


                Print(string.Format("{0} of {1} bulls successful({2})", _winningBulls, _bulls, (_bulls > 0) ? (double)_winningBulls / _bulls : 0));
                Print(string.Format("{0} of {1} bears successful({2})", _winningBears, _bears, (_bears > 0) ? (double)_winningBears / _bears : 0));
                Print(string.Format("{0} of {1} all successful({2})", _winningBears + _winningBulls, _bears + _bulls, (_bears + _bulls > 0)?(double)(_winningBears + _winningBulls) / (_bears + _bulls):0));



                double candlestick = 0;

                var barTime = DateTime.Parse(Time.ToString());

                //Make Sure there is enough movement to matter

                if (!HasEnoughVoltility())
                {
                    return;
                }



                //Is there any sentiment found
                foreach (var dood in KpsToUse)
                {
                    candlestick = 0;
                    candlestick = KenCandleStickPattern(dood, TrendStrength)[0];
                    if (candlestick != 0)
                    {
                        break;
                    }
                }

                if (IsBullishSentiment(candlestick) || IsBearishSentiment(candlestick))
                {
                    var expiryTime = barTime.AddHours(1);

                    var
                        order = new ActiveOrder
                    {
                        Id          = Guid.NewGuid(),
                        Time        = barTime,
                        ExpiryHour  = expiryTime.Hour,
                        ExpiryDay   = expiryTime.Day,
                        EnteredAt   = Close[0],
                        Kp          = (Kp)(int)candlestick,
                        StrikeWidth = _strikeWidth
                    };


                    if (IsBullishSentiment(candlestick))
                    {
                        order.IsLong = true;
                        order.ExitAt = Close[0] + (Math.Abs(_strikeWidth * .5));
                        activerOrders.Add(order.Id, order);
                        _bulls++;
                        _stats[(Kp)(int)candlestick].Attempt = _stats[(Kp)(int)candlestick].Attempt + 1;

                        SendNotification(candlestick, order);
                    }

                    if (IsBearishSentiment(candlestick))
                    {
                        order.IsLong = false;
                        order.ExitAt = Close[0] - (Math.Abs(_strikeWidth * 5));

                        activerOrders.Add(order.Id, order);
                        _bears++;

                        _stats[(Kp)(int)candlestick].Attempt = _stats[(Kp)(int)candlestick].Attempt + 1;

                        SendNotification(candlestick, order);
                    }
                }
            }
            catch (Exception e)
            {
                Log("error found:" + e.Message + " " + e.Source + " " + e.StackTrace, LogLevel.Error);
            }
        }
Exemplo n.º 21
0
        protected override void OnBarUpdate()
        {
            RecordSmaSlope();

            //bail if we don't have enough bars
            if (this.CurrentBar < 12)
            {
                return;
            }


            try
            {
                HandleCurrentOrders();


                var tickSize = TickSize;


                Print("");

                Print(string.Format("{0} of {1} bulls successful({2})", _winningBulls, _bulls,
                                    (_bulls > 0) ? (double)_winningBulls / _bulls : 0));
                Print(string.Format("{0} of {1} bears successful({2})", _winningBears, _bears,
                                    (_bears > 0) ? (double)_winningBears / _bears : 0));
                Print(string.Format("{0} of {1} all successful({2})", _winningBears + _winningBulls, _bears + _bulls,
                                    (_bears + _bulls > 0) ? (double)(_winningBears + _winningBulls) / (_bears + _bulls) : 0));


                //if (DateTime.Parse(Time.ToString()).Minute > 21)
                //  return;


                var barTime = DateTime.Parse(Time.ToString());


                var isBull = IsBull();


                var isBear = IsBear();


                if (isBull || isBear)
                {
                    var expiryTime = barTime.AddHours(1);

                    var
                        order = new ActiveOrder
                    {
                        Id          = Guid.NewGuid(),
                        Time        = barTime,
                        ExpiryHour  = expiryTime.Hour,
                        ExpiryDay   = expiryTime.Day,
                        EnteredAt   = Close[0],
                        StrikeWidth = _strikeWidth
                    };


                    if (isBull)
                    {
                        order.IsLong   = true;
                        order.ExitAt   = Close[0] + (Math.Abs(_strikeWidth));
                        order.SettleAT = Close[0] + (Math.Abs(_strikeWidth * .25));
                        _activerOrders.Add(order.Id, order);
                        _bulls++;

                        SendNotification(order);
                    }


                    if (isBear)
                    {
                        order.IsLong   = false;
                        order.ExitAt   = Close[0] - (Math.Abs(_strikeWidth));
                        order.SettleAT = Close[0] - (Math.Abs(_strikeWidth * .25));

                        _activerOrders.Add(order.Id, order);
                        _bears++;
                        SendNotification(order);
                    }
                }
            }
            catch (Exception e)
            {
                Print("error found:" + e.Message + " " + e.Source + " " + e.StackTrace);
                //Log("error found:" + e.Message + " " + e.Source + " " + e.StackTrace, LogLevel.Error);
            }
        }
Exemplo n.º 22
0
        protected override void OnBarUpdate()
        {

            RecordSmaSlope();

            //bail if we don't have enough bars
            if (this.CurrentBar < 12)
                return;


            try
            {
                HandleCurrentOrders();


                var tickSize = TickSize;


                Print("");

                Print(string.Format("{0} of {1} bulls successful({2})", _winningBulls, _bulls,
                    (_bulls > 0) ? (double)_winningBulls / _bulls : 0));
                Print(string.Format("{0} of {1} bears successful({2})", _winningBears, _bears,
                    (_bears > 0) ? (double)_winningBears / _bears : 0));
                Print(string.Format("{0} of {1} all successful({2})", _winningBears + _winningBulls, _bears + _bulls,
                    (_bears + _bulls > 0) ? (double)(_winningBears + _winningBulls) / (_bears + _bulls) : 0));


                //if (DateTime.Parse(Time.ToString()).Minute > 21)
                //  return;


                var barTime = DateTime.Parse(Time.ToString());


                var isBull = IsBull();


                var isBear = IsBear();


                if (isBull || isBear)
                {
                    var expiryTime = barTime.AddHours(1);

                    var
                        order = new ActiveOrder
                        {
                            Id = Guid.NewGuid(),
                            Time = barTime,
                            ExpiryHour = expiryTime.Hour,
                            ExpiryDay = expiryTime.Day,
                            EnteredAt = Close[0],
                            StrikeWidth = _strikeWidth
                        };


                    if (isBull)
                    {
                        order.IsLong = true;
                        order.ExitAt = Close[0] + (Math.Abs(_strikeWidth));
                        order.SettleAT = Close[0] + (Math.Abs(_strikeWidth * .25));
                        _activerOrders.Add(order.Id, order);
                        _bulls++;

                        SendNotification(order);
                    }


                    if (isBear)
                    {
                        order.IsLong = false;
                        order.ExitAt = Close[0] - (Math.Abs(_strikeWidth));
                        order.SettleAT = Close[0] - (Math.Abs(_strikeWidth * .25));

                        _activerOrders.Add(order.Id, order);
                        _bears++;
                        SendNotification(order);
                    }
                }
            }
            catch (Exception e)
            {
                Print("error found:" + e.Message + " " + e.Source + " " + e.StackTrace);
                //Log("error found:" + e.Message + " " + e.Source + " " + e.StackTrace, LogLevel.Error);
            }
        }