Ejemplo n.º 1
0
 private void PendingOrders_Filled(PendingOrderFilledEventArgs obj)
 {
     if (bs != null)
     {
         bs.PendingOrdersFilled(obj);
     }
 }
Ejemplo n.º 2
0
 private void PendingOrders_Filled(PendingOrderFilledEventArgs obj)
 {
     RunInfo.Grids.Where(x => x.Status == TradeStatus.Pending && x.RobotPendingOrder.Id == obj.PendingOrder.Id).All(x => {
         x.WhenOrderFilled(obj.Position);
         return(true);
     });
 }
Ejemplo n.º 3
0
        internal void PendingOrderFilled(PendingOrderFilledEventArgs result)
        {
            //add routine for Trap model, close all pending orders when first order is activated/filled
            if (tmBot.config.OpenCycleMethod == enOpenCycleMethod.Trap && result.Position.Label == TMLabel + "-I" + (1).ToString("#000") + PositionSessionNumber)
            {
                foreach (var to in tmBot.PendingOrders)
                {
                    tmBot.CancelPendingOrderAsync(to);
                }
            }

            if (result.Position.Label == TMLabel + GetPositionIndexNumber(0) + PositionSessionNumber)
            {
                Statistics.SetMaxBounce(tmBot.Positions.Count, tmBot.Time);

                LastTradeType = result.Position.TradeType;
                TunnelStatus  = enTunnelStatus.Pending;
                LastVolume    = result.Position.VolumeInUnits * tmBot.config.LotMultiplier;

                tmBot.PlaceStopOrderAsync((result.Position.TradeType == TradeType.Buy ? TradeType.Sell : TradeType.Buy),
                                          tmBot.config.SessionDates.Enabled ? GetSymbolName(ParsedSessionDates.First()) : tmBot.Symbol.Name,
                                          result.Position.VolumeInUnits * tmBot.config.LotMultiplier,
                                          (result.Position.TradeType == TradeType.Buy ? TunnelFloor : TunnelCeiling),
                                          TMLabel + GetPositionIndexNumber() + PositionSessionNumber, AnotherOrderPlaced);
            }

            TunnelChartObjects.DrawDirection(tmBot, Direction);

            //no IF, executes every pending order filled
            UpdateTargetLines(result.Position.EntryPrice);
        }
Ejemplo n.º 4
0
 private void PendingOrders_Filled(PendingOrderFilledEventArgs result)
 {
     if (tm != null)
     {
         tm.PendingOrderFilled(result);
     }
 }
Ejemplo n.º 5
0
        private void PendingOrders_Filled(PendingOrderFilledEventArgs obj)
        {
            var sst = SimpleScalpingTrades.Where(x => x.T1Label == obj.PendingOrder.Label || x.T2Label == obj.PendingOrder.Label).FirstOrDefault();

            if (sst != null && sst.Status == SimpleScalpingTrade.State.Pending)
            {
                sst.Status = SimpleScalpingTrade.State.Active;
            }
        }
Ejemplo n.º 6
0
        internal void PendingOrderFilled(PendingOrderFilledEventArgs result)
        {
            if (result.Position.Label.StartsWith(TMLabel + TMLabelSeparator))
            {
                //add routine for Trap model, close all pending orders when first order is activated/filled
                if (tmBot.config.OpenCycleMethod == enOpenCycleMethod.Trap && result.Position.Label == TMLabel + TMLabelSeparator + "I" + (1).ToString("#000") + PositionSessionNumber)
                {
                    TunnelStatus = enTunnelStatus.PendingActivation;
                    foreach (var to in tmBot.PendingOrders)
                    {
                        tmBot.CancelPendingOrderAsync(to);
                    }
                }

                if (result.Position.Label == TMLabel + GetPositionIndexNumber(0) + PositionSessionNumber)                 //check whether this order filled is the last position, if yes then...
                {
                    Statistics.SetMaxBounce(tmPositions.Count(), tmBot.Time);

                    LastTradeType = result.Position.TradeType;
                    TunnelStatus  = enTunnelStatus.PendingActivation;
                    LastVolume    = tmBot.Symbol.NormalizeVolumeInUnits(result.Position.VolumeInUnits * tmBot.config.LotMultiplier);
                    tmBot.Print("LastVolume: {0:#,##0}, Previous Trade: {1}", LastVolume, LastTradeType.ToString());

                    tmBot.PlaceStopOrderAsync(result.Position.TradeType == TradeType.Buy ? TradeType.Sell : TradeType.Buy,
                                              tmBot.config.SessionDates.Enabled ? GetSymbolName(CurrentSessionDate) : tmBot.Symbol.Name,
                                              LastVolume,
                                              (result.Position.TradeType == TradeType.Buy ? TunnelFloor : TunnelCeiling),
                                              TMLabel + GetPositionIndexNumber() + PositionSessionNumber, AnotherOrderPlaced);
                }

                TunnelChartObjects.DrawDirection(tmBot, Direction);

                //no IF, executes every pending order filled
                UpdateTargetLines(result.Position.EntryPrice);
            }
        }
Ejemplo n.º 7
0
 internal void PendingOrdersFilled(PendingOrderFilledEventArgs obj)
 {
 }