Ejemplo n.º 1
0
        /// <summary>Update the risk level from pending orders positions</summary>
        private void Update(PendingOrders orders)
        {
            // Add up all potential losses from pending orders
            var risk = (AcctCurrency)0.0;

            foreach (var order in orders.Select(x => new Order(x)))
            {
                // The stop loss will be negative if it is on the 'win' side
                // of the entry price, regardless of trade type.
                var sym = Bot.GetSymbol(order.SymbolCode);
                risk += sym.QuoteToAcct(order.StopLossRel) * order.Volume;
            }

            PendingRisk = risk;
        }