private void UpdateTradeOrders(DateTime currentDateTime, Candle candle, SimTrade t)
        {
            // Update order prices
            if (t.OriginalTrade.OrderPrices.Count > 0 && t.OrderIndex + 1 < t.OriginalTrade.OrderPrices.Count &&
                (t.OrderIndex == -1 || t.OriginalTrade.OrderPrices[t.OrderIndex + 1].Date <= currentDateTime))
            {
                t.OrderIndex++;
                var price = ProcessPriceOption(t.OriginalTrade.OrderPrices[t.OrderIndex].Price);
                var date  = t.OriginalTrade.OrderPrices[t.OrderIndex].Date;
                t.AddOrderPrice(date, price);
                t.OrderPrice  = price;
                t.OrderAmount = t.OriginalTrade.OrderAmount;
                if (t.OrderDateTime == null)
                {
                    t.OrderDateTime = date;
                }
                ApplyOrderType(price, t, candle);
                t.OrderKind = OrderKind.EntryPrice;
            }

            // Update market order price
            if (t.OrderPrices.Count == 0 && t.OriginalTrade.OrderPrices.Count == 0 && t.EntryPrice != null &&
                t.OriginalTrade.EntryDateTime <= currentDateTime)
            {
                var price = ProcessPriceOption(t.OriginalTrade.EntryPrice);
                var date  = t.OriginalTrade.EntryDateTime.Value;
                t.AddOrderPrice(date, price);
                t.OrderPrice    = price;
                t.OrderAmount   = t.OriginalTrade.EntryQuantity;
                t.OrderDateTime = date;
                ApplyOrderType(price, t, candle);
                t.OrderKind = OrderKind.EntryPrice;
            }
        }
        //todo // Run with original setups then test alternatives

        private void UpdateTradeStops(DateTime currentDateTime, SimTrade t, TimeframeLookup <List <CandleAndIndicators> > candlesLookup)
        {
            // Update stop
            var addInitialStopOnly = _options.StopOption == StopOption.InitialStopOnly ||
                                     _options.StopOption == StopOption.InitialStopThenTrail2HR8EMA ||
                                     _options.StopOption == StopOption.InitialStopThenTrail2HR25EMA ||
                                     _options.StopOption == StopOption.InitialStopThenTrail4HR8EMA ||
                                     _options.StopOption == StopOption.InitialStopThenTrail4HR25EMA ||
                                     _options.StopOption == StopOption.DynamicTrailingStop;

            if (t.OriginalTrade.StopPrices.Count > 0 && t.StopIndex + 1 < t.OriginalTrade.StopPrices.Count &&
                (t.StopIndex == -1 || t.OriginalTrade.StopPrices[t.StopIndex + 1].Date <= currentDateTime))
            {
                if ((addInitialStopOnly && t.StopIndex == -1) || !addInitialStopOnly)
                {
                    t.StopIndex++;
                    var price = t.OriginalTrade.StopPrices[t.StopIndex].Price;
                    var date  = t.OriginalTrade.StopPrices[t.StopIndex].Date;
                    t.AddStopPrice(date, price);
                    t.StopPrice = price;
                }
            }

            ApplyStopStrategy(t, candlesLookup, currentDateTime);
        }
        private void UpdateTradeLimits(DateTime currentDateTime, SimTrade t)
        {
            if (_options.LimitOption == LimitOption.None)
            {
                // Nothing to do
            }
            else if (_options.LimitOption == LimitOption.Fixed3RLimit)
            {
                if (t.StopPrices.Count > 0 && t.OrderPrice != null && t.LimitPrices.Count == 0)
                {
                    var limit = t.OrderPrice.Value + ((t.OrderPrice.Value - t.StopPrices[0].Price.Value) * 3M);

                    t.LimitPrices.Clear();
                    t.AddLimitPrice(t.StopPrices[0].Date, limit);
                    t.LimitPrice = limit;
                }
            }
            else if (_options.LimitOption == LimitOption.Fixed2RLimit)
            {
                if (t.StopPrices.Count > 0 && t.OrderPrice != null && t.LimitPrices.Count == 0)
                {
                    var limit = t.OrderPrice.Value + ((t.OrderPrice.Value - t.StopPrices[0].Price.Value) * 2M);

                    t.LimitPrices.Clear();
                    t.AddLimitPrice(t.StopPrices[0].Date, limit);
                    t.LimitPrice = limit;
                }
            }
            else if (_options.LimitOption == LimitOption.Fixed1Point5RLimit)
            {
                if (t.StopPrices.Count > 0 && t.OrderPrice != null && t.LimitPrices.Count == 0)
                {
                    var limit = t.OrderPrice.Value + ((t.OrderPrice.Value - t.StopPrices[0].Price.Value) * 1.5M);

                    t.LimitPrices.Clear();
                    t.AddLimitPrice(t.StopPrices[0].Date, limit);
                    t.LimitPrice = limit;
                }
            }
            else if (_options.LimitOption == LimitOption.Fixed1RLimit)
            {
                if (t.StopPrices.Count > 0 && t.OrderPrice != null && t.LimitPrices.Count == 0)
                {
                    var limit = t.OrderPrice.Value + ((t.OrderPrice.Value - t.StopPrices[0].Price.Value) * 1M);

                    t.LimitPrices.Clear();
                    t.AddLimitPrice(t.StopPrices[0].Date, limit);
                    t.LimitPrice = limit;
                }
            }
            else if (_options.LimitOption == LimitOption.Original)
            {
                if (t.OriginalTrade.LimitPrices.Count > 0 && t.LimitIndex + 1 < t.OriginalTrade.LimitPrices.Count &&
                    (t.LimitIndex == -1 || t.OriginalTrade.LimitPrices[t.LimitIndex + 1].Date <= currentDateTime))
                {
                    t.LimitIndex++;
                    var price = t.OriginalTrade.LimitPrices[t.LimitIndex].Price;
                    var date  = t.OriginalTrade.LimitPrices[t.LimitIndex].Date;
                    t.AddLimitPrice(date, price);
                    t.LimitPrice = price;
                }
            }
        }