Beispiel #1
0
 public void UpdateStopLoss(decimal latestPrice)
 {
     if ((latestPrice > CurrentPrice && TradeDirection > 0) ||
         (latestPrice < CurrentPrice && TradeDirection < 0))
     {
         StopTicket.Update(
             new UpdateOrderFields
         {
             StopPrice = StopTicket.Get(OrderField.StopPrice) + TradeDirection * Math.Abs(latestPrice - CurrentPrice)
         });
     }
 }
Beispiel #2
0
        public void UpdateStopLoss(QuoteBar latestQuote)
        {
            return;

            if ((latestQuote.Bid.Close - _trailingStop > StopTicket.Get(OrderField.StopPrice) && TradeDirection > 0) ||
                (latestQuote.Ask.Close + _trailingStop < StopTicket.Get(OrderField.StopPrice) && TradeDirection < 0))
            {
                StopTicket.Update(
                    new UpdateOrderFields
                {
                    StopPrice = OrderUtil.RoundOrderPrices(null, (TradeDirection > 0 ? latestQuote.Bid.Close : latestQuote.Ask.Close) + TradeDirection * _trailingStop)
                }
                    );
            }
        }