Example #1
0
 public Stop(Strategy strategy, Position position, double level, StopType type, StopMode mode)
 {
     this.type           = StopType.Trailing;
     this.mode           = StopMode.Percent;
     this.traceOnQuote   = true;
     this.traceOnTrade   = true;
     this.traceOnBar     = true;
     this.traceOnBarOpen = true;
     this.trailOnOpen    = true;
     this.filterBarSize  = -1L;
     this.filterBarType  = BarType.Time;
     this.fillMode       = StopFillMode.Stop;
     this.strategy       = strategy;
     this.position       = position;
     this.instrument     = position.Instrument;
     this.qty            = position.Qty;
     this.side           = position.Side;
     this.level          = level;
     this.type           = type;
     this.mode           = mode;
     this.currPrice      = GetInstrumentPrice();
     this.trailPrice     = this.currPrice;
     this.stopPrice      = GetStopPrice();
     this.creationTime   = strategy.Framework.Clock.DateTime;
     this.completionTime = DateTime.MinValue;
     this.method_0();
 }
Example #2
0
        public bool SetSoftLimit(I32 positiveLimit, I32 negativeLimit, CmdStatus sw, StopType stopType)
        {
            I16 rc = -1;

            if (axisPara.IsActive && axisPara.Enabled)
            {
                if (sw == CmdStatus.ON)
                {
                    /*
                     * 0 INT only
                     * 1 Immediately stop
                     * 2 Slow down then stop
                     * 3 Reserved
                     */
                    if (stopType == StopType.Emergency)
                    {
                        rc = CCMNet.CS_mnet_m1_enable_soft_limit(RingNoOfMNet, axisPara.SlaveIP, 1);
                    }
                    else
                    {
                        rc = CCMNet.CS_mnet_m1_enable_soft_limit(RingNoOfMNet, axisPara.SlaveIP, 2);
                    }
                    rc = CCMNet.CS_mnet_m1_set_soft_limit(RingNoOfMNet, axisPara.SlaveIP, positiveLimit, negativeLimit);
                }
                else
                {
                    rc = CCMNet.CS_mnet_m1_disable_soft_limit(RingNoOfMNet, axisPara.SlaveIP);
                }
            }
            return(rc == 0 ? true : false);
        }
Example #3
0
        public ATSStop SetStop(Position position, double level, StopType type, StopMode mode)
        {
            ATSStop atsStop = new ATSStop(position, level, type, mode);

            this.Strategy.nPMi9oJHY7(atsStop);
            return(atsStop);
        }
Example #4
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (treeView1.SelectedNode.Level == 0)
            {
                FerryManType o = (FerryManType)treeView1.SelectedNode.Tag;
                dg1.DataSource = o.ParcelList();
                dg2.DataSource = o.GetParcelSums();

                var c = (from cc in DicterType.GetFullCennik()
                         where cc.Przewoznik_KOD == o.KOD
                         select cc).ToList();

                dg3.DataSource = c;

                label1.Text = o.SumaStawkaDorecz().ToString();
            }

            if (treeView1.SelectedNode.Level == 1)
            {
                DeliveryManType o = (DeliveryManType)treeView1.SelectedNode.Tag;
                dg1.DataSource = o.ParcelList();
                dg2.DataSource = o.GetParcelSums();

                var c = (from cc in DicterType.GetFullCennik()
                         where cc.Przewoznik_KOD == o.PrzewoznikKOD
                         select cc).ToList();

                dg3.DataSource = c;
                label1.Text    = o.SumaStawkaDorecz().ToString();
            }

            if (treeView1.SelectedNode.Level == 2)
            {
                DMrejonType o = (DMrejonType)treeView1.SelectedNode.Tag;
                dg1.DataSource = o.ParcelList();
                dg2.DataSource = o.GetParcelSums();
                dg3.DataSource = o.Cennik;

                label1.Text = o.SumaStawkaDorecz().ToString();
            }

            if (treeView1.SelectedNode.Level == 3)
            {
                StopType o = (StopType)treeView1.SelectedNode.Tag;
                dg1.DataSource = o.ParcelList;
                dg2.DataSource = o.GetParcelSums();

                label1.Text = o.SumaStawkaDorecz().ToString();
            }

            if (treeView1.SelectedNode.Level == 4)
            {
                StopFileType o = (StopFileType)treeView1.SelectedNode.Tag;

                o.GetParcelGroup();

                dg1.DataSource = o;
                dg2.DataSource = o.PARCEL_GROUP;
            }
        }
Example #5
0
        private void SetType()
        {
            string desc = Description.ToUpper();

            if (desc.Contains("BUS"))
            {
                Type = StopType.Bus;
            }
            else if (desc.Contains("METRO"))
            {
                Type = StopType.Metro;
            }
            else if (desc.Contains("TRAM"))
            {
                Type = StopType.Tram;
            }
            else if (desc.Contains("FERRY"))
            {
                Type = StopType.Ferry;
            }
            else
            {
                Type = StopType.Undefined;
            }
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            startArrow     = (Arrow)GetTemplateChild("StartArrow");
            endArrow       = (Arrow)GetTemplateChild("EndArrow");
            stopColorPanel = (System.Windows.Shapes.Rectangle)GetTemplateChild("StopColorPanel");
            alphaNumeric   = (Numeric)GetTemplateChild("nA");
            stopAnglePanel = (System.Windows.Shapes.Ellipse)GetTemplateChild("StopAnglePanel");
            stopAngleArrow = (System.Windows.Shapes.Line)GetTemplateChild("StopAngleArrow");
            SelectedBrush.PropertyChanged += new PropertyChangedEventHandler(SelectedBrush_PropertyChanged);

            alphaNumeric.ValueChanged += new RoutedEventHandler(alphaNumeric_ValueChanged);

            stopColorPanel.MouseLeftButtonUp += new MouseButtonEventHandler(ArrowDoubleClick);
            startArrow.MouseDoubleClick      += new MouseButtonEventHandler(ArrowDoubleClick);
            endArrow.MouseDoubleClick        += new MouseButtonEventHandler(ArrowDoubleClick);

            startArrow.MouseLeftButtonUp += new MouseButtonEventHandler(ArrowMouseUp);
            endArrow.MouseLeftButtonUp   += new MouseButtonEventHandler(ArrowMouseUp);

            stopAnglePanel.MouseDown += new MouseButtonEventHandler(Ellipse_MouseDown);
            stopAnglePanel.MouseMove += new MouseEventHandler(Ellipse_MouseMove);

            stopColorPanel.Fill = DrawingColorToBrushConverter.Convert(SelectedBrush.StartColor);
            alphaNumeric.Value  = SelectedBrush.StartColor.A;
            stopType            = StopType.Start;

            FillAngleArrow();
            //SetPreviewImage();
        }
Example #7
0
        public static SelectList ToSelectList(this StopType selectedValueOutput)
        {
            var values = from StopType e in Enum.GetValues(typeof(StopType))
                         select new { Id = (int)e, Name = e.GetDescription() };

            return(new SelectList(values, "Id", "Name", selectedValueOutput));
        }
Example #8
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Object result = new Object();

            if (value != null)
            {
                try
                {
                    Debug.Assert(value is Stop); // only stops can be input value in this converter

                    Stop     currentStop = (Stop)value;
                    StopType type        = (StopType)currentStop.StopType;

                    ControlTemplate template = (ControlTemplate)App.Current.FindResource("OrderStopGlyph");
                    Grid            grid     = (Grid)template.LoadContent();

                    Path  path  = (Path)grid.Children[2];
                    Color color = Color.FromArgb(currentStop.Route.Color.A, currentStop.Route.Color.R,
                                                 currentStop.Route.Color.G, currentStop.Route.Color.B);
                    path.Fill = new SolidColorBrush(color);

                    result = grid;
                }
                catch
                {
                    result = null;
                }
            }
            else
            {
                result = null;
            }

            return(result);
        }
Example #9
0
        public ATSStop SetStop(Position position, double level, StopType type, StopMode mode)
        {
            ATSStop aTSStop = new ATSStop(position, level, type, mode);

            base.Strategy.AddStop(aTSStop);
            return(aTSStop);
        }
Example #10
0
        /// <summary>
        ///     Changes the <see cref="State"/> of the Manager to the specified <see cref="State"/> and fires the StateChanged event.
        /// </summary>
        /// <param name="state">The State to which the <see cref="State"/> property is to be changed.</param>
        /// <param name="message">The optional message describing the nature or reason for the change.</param>
        /// <param name="stopType">The <see cref="StopType"/> enumeration corresponding to the nature of the stoppage.</param>
        protected void ChangeState(State state, string message = "", StopType stopType = StopType.Stop)
        {
            logger.EnterMethod(xLogger.Params(state, message, stopType));

            State previousState = State;

            State = state;

            // if the new State is State.Faulted, ensure StopType is Abnormal
            if (State == State.Faulted && !stopType.HasFlag(StopType.Exception))
            {
                // if the Restart flag was passed in, ensure it remains
                if (stopType.HasFlag(StopType.Restart))
                {
                    stopType = StopType.Exception | StopType.Restart;
                }
                else
                {
                    stopType = StopType.Exception;
                }
            }

            StateChanged?.Invoke(this, new StateChangedEventArgs(State, previousState, message, stopType));

            logger.ExitMethod();
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="StateChangedEventArgs"/> class with the specified state,
 ///     previousState, stopType and message parameters.
 /// </summary>
 /// <param name="state">The State to which the state changed.</param>
 /// <param name="previousState">The State from which the state changed.</param>
 /// <param name="message">The optional message associated with the event.</param>
 /// <param name="stopType">The StopType associated with a change to the Stopped or Faulted states.</param>
 public StateChangedEventArgs(State state, State previousState, string message = "", StopType stopType = StopType.Stop)
 {
     State         = state;
     PreviousState = previousState;
     Message       = message;
     StopType      = stopType;
 }
Example #12
0
		public virtual Stop AddStop(double level, StopType type, StopMode mode)
		{
			if (!this.Strategy.IsInstrumentActive(this.Position.Instrument))
				return null;
			else
				return new Stop(this.Strategy, this.Position, level, type, mode);
		}
Example #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lane"></param>
 /// <param name="waypoint"></param>
 /// <param name="stopType"></param>
 public StoppingState(LaneID lane, RndfWaypointID waypoint, StopType stopType, LaneDescription currentLane)
     : base(lane, lane)
 {
     this.stopType    = stopType;
     this.waypoint    = waypoint;
     this.currentLane = currentLane;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lane"></param>
 /// <param name="waypoint"></param>
 /// <param name="stopType"></param>
 public StoppingState(LaneID lane, RndfWaypointID waypoint, StopType stopType, LaneDescription currentLane)
     : base(lane, lane)
 {
     this.stopType = stopType;
     this.waypoint = waypoint;
     this.currentLane = currentLane;
 }
        public Result Stop(StopType stopType = StopType.Stop)
        {
            Guid guid = logger.EnterMethod(true);

            Result retVal = new Result();

            ChangeState(State.Stopping);

            try
            {
                // todo: implement shutdown logic
            }
            catch (Exception ex)
            {
                retVal.AddError("Failed to stop the Plugin: " + ex.Message);
            }

            if (retVal.ResultCode != ResultCode.Failure)
            {
                ChangeState(State.Stopped);
            }
            else
            {
                ChangeState(State.Faulted);
            }

            retVal.LogResult(logger);
            logger.ExitMethod(retVal, guid);
            return(retVal);
        }
Example #16
0
        public Stop SetStop(double level, StopType type = StopType.Fixed, StopMode mode = StopMode.Absolute)
        {
            var stop = new Stop(this.strategy, this.Position, level, type, mode);

            this.strategy.AddStop(stop);
            return(stop);
        }
 public virtual Stop AddStop(double level, StopType type, StopMode mode)
 {
     if (!base.Strategy.IsInstrumentActive(base.Position.Instrument))
     {
         return(null);
     }
     return(new Stop(base.Strategy, base.Position, level, type, mode));
 }
Example #18
0
        public static Stop AddStop(this Strategy s, Position position, PositionSide side, double qty = 0,
                                   double level = 0.05, StopType type = StopType.Trailing, StopMode mode = StopMode.Percent)
        {
            var stop = new QBStop(s, position, side, qty, level, type, mode);

            AddStop2(s, stop);
            return(stop);
        }
        public Result Restart(StopType stopType = StopType.Stop)
        {
            Guid guid = logger.EnterMethod(true);

            Result retVal = Start().Incorporate(Stop(stopType | StopType.Restart));

            retVal.LogResult(logger);
            logger.ExitMethod(retVal, guid);
            return(retVal);
        }
Example #20
0
 public Stop FillIn(Stop stop, string name, double latitude,
                    double longitude, StopType stopType, int stationNumber)
 {
     stop.Name       = name;
     stop.Latitude   = latitude;
     stop.Longitude  = longitude;
     stop.StopType   = stopType;
     stop.StopNumber = stationNumber;
     return(stop);
 }
Example #21
0
        public static Stop CreateMIDIStop(int PGM, int MSB, int LSB, StopType type, bool PlaceB = false)
        {
            int Flags = UserMIDIPGMFlag;

            if (PlaceB)
            {
                Flags |= UserMIDIFlagB;
            }
            return(new StopMIDI(PGM, Flags, MSB, LSB, type));
        }
Example #22
0
 public static VoicesGroup Create(StopType Type, int Offset, int Len, VoicesGroup.VoicesDecoder Decoder)
 {
     return(new VoicesGroup()
     {
         Type = Type,
         Offset = Offset,
         Len = Len,
         Decoder = Decoder
     });
 }
Example #23
0
        /// <summary>
        /// Gets the next navigational stop relavant to us (stop or end) in the closest good lane or our current opposing lane
        /// </summary>
        /// <param name="closestGood"></param>
        /// <param name="coordinates"></param>
        /// <param name="ignorable"></param>
        /// <param name="navStopSpeed"></param>
        /// <param name="navStopDistance"></param>
        /// <param name="navStopType"></param>
        /// <param name="navStop"></param>
        private void NextOpposingNavigationalStop(ArbiterLane opposing, ArbiterLane closestGood, Coordinates coordinates, double extraDistance,
                                                  out double navStopSpeed, out double navStopDistance, out StopType navStopType, out ArbiterWaypoint navStop)
        {
            ArbiterWaypoint current = null;
            double          minDist = Double.MaxValue;
            StopType        st      = StopType.EndOfLane;

            #region Closest Good Parameterization

            foreach (ArbiterWaypoint aw in closestGood.WaypointList)
            {
                if (aw.IsStop || aw.NextPartition == null)
                {
                    double dist = closestGood.DistanceBetween(coordinates, aw.Position);

                    if (dist < minDist && dist >= 0)
                    {
                        current = aw;
                        minDist = dist;
                        st      = aw.IsStop ? StopType.StopLine : StopType.EndOfLane;
                    }
                }
            }

            #endregion

            #region Opposing Parameterization

            ArbiterWaypoint opStart    = opposing.GetClosestPartition(coordinates).Initial;
            int             startIndex = opposing.WaypointList.IndexOf(opStart);

            for (int i = startIndex; i >= 0; i--)
            {
                ArbiterWaypoint aw = opposing.WaypointList[i];
                if (aw.IsStop || aw.PreviousPartition == null)
                {
                    double dist = opposing.DistanceBetween(aw.Position, coordinates);

                    if (dist < minDist && dist >= 0)
                    {
                        current = aw;
                        minDist = dist;
                        st      = aw.IsStop ? StopType.StopLine : StopType.EndOfLane;
                    }
                }
            }

            #endregion

            double tmpDistanceIgnore;
            this.StoppingParams(current, closestGood, coordinates, extraDistance, out navStopSpeed, out tmpDistanceIgnore);
            navStop         = current;
            navStopDistance = minDist;
            navStopType     = st;
        }
Example #24
0
 public virtual Stop AddStop(double level, StopType type, StopMode mode)
 {
     if (!this.Strategy.IsInstrumentActive(this.Position.Instrument))
     {
         return(null);
     }
     else
     {
         return(new Stop(this.Strategy, this.Position, level, type, mode));
     }
 }
Example #25
0
        protected override IResult Shutdown(StopType stopType = StopType.Stop)
        {
            Guid guid = logger.EnterMethod(true);

            logger.Debug("Performing Shutdown for '" + GetType().Name + "'...");
            IResult retVal = new Result();

            retVal.LogResult(logger.Debug);
            logger.ExitMethod(guid);
            return(retVal);
        }
 public QBStop(Strategy strategy, Position position,
               PositionSide side, double qty,
               double level, StopType type, StopMode mode)
     : base(strategy, position, level, type, mode)
 {
     if (qty > 0)
     {
         this.qty = qty;
     }
     this.side = side;
 }
Example #27
0
        /// <summary>
        ///     Stops, then Starts the Connector.
        /// </summary>
        /// <returns>A Result containing the result of the operation.</returns>
        public Result Restart(StopType stopType = StopType.Stop)
        {
            Guid guid = logger.EnterMethod(true);

            // short and sweet. This should work in most instances.
            Result retVal = Start().Incorporate(Stop(stopType | StopType.Restart));

            retVal.LogResult(logger);
            logger.ExitMethod(retVal, guid);
            return(retVal);
        }
Example #28
0
 internal Stop(Position position, double level, StopType type, StopMode mode)
 {
     this.position = position;
     SmartQuant.Trading.StopType type2 = EnumConverter.Convert(type);
     SmartQuant.Trading.StopMode mode2 = EnumConverter.Convert(mode);
     this.stop = new ATSStop(position.position, level, type2, mode2);
     this.stop.TrailOnHighLow = true;
     this.stop.TraceOnBarOpen = true;
     this.stop.TraceOnBar     = true;
     this.stop.TraceOnQuote   = true;
     this.stop.TraceOnTrade   = true;
 }
Example #29
0
 internal Stop(Position position, double level, StopType type, StopMode mode)
 {
     this.position = position;
     FreeQuant.Trading.StopType stopType = EnumConverter.Convert(type);
     FreeQuant.Trading.StopMode stopMode = EnumConverter.Convert(mode);
     this.stop = new ATSStop(position.position, level, stopType, stopMode);
     ((StopBase)this.stop).TrailOnHighLow = true;
     ((StopBase)this.stop).TraceOnBarOpen = true;
     ((StopBase)this.stop).TraceOnBar     = true;
     ((StopBase)this.stop).TraceOnQuote   = true;
     ((StopBase)this.stop).TraceOnTrade   = true;
 }
 public bool AreStopAndLineTypesMatching(StopType stopType, LineType lineType)
 {
     if (stopType == StopType.Bus)
     {
         return(lineType == LineType.Bus);
     }
     if (stopType == StopType.Tram)
     {
         return(lineType == LineType.Tram);
     }
     throw new ArgumentException(DomainErrors.InvalidStopType);
 }
Example #31
0
        public async Task <List <StopData> > GetAllStops(StopType requestedTypes = StopType.Other | StopType.Tram | StopType.Bus)
        {
            IEnumerable <StopData> tramFiltered = Enumerable.Empty <StopData>();
            IEnumerable <StopData> busFiltered  = Enumerable.Empty <StopData>();

            if ((requestedTypes & StopType.Tram) == StopType.Tram)
            {
                var tramResponse = await Request.AllStops(false).ConfigureAwait(false);

                var tramPreparsed = JsonConvert.DeserializeObject <GeoStops>(tramResponse.Data).Stops;
                tramFiltered = tramPreparsed.Select(s => new StopData
                {
                    ID        = int.Parse(s.ShortName),
                    Latitude  = (double)s.Latitude.ToCoordinate(),
                    Longitude = (double)s.Longitude.ToCoordinate(),
                    Name      = s.Name,
                    Type      = StopCategoryConverter.Convert(s.Category)
                })
                               .Where(s => (requestedTypes & s.Type) == s.Type);
            }
            if ((requestedTypes & StopType.Bus) == StopType.Bus)
            {
                var busResponse = await Request.AllStops(true).ConfigureAwait(false);

                var busPreparsed = JsonConvert.DeserializeObject <GeoStops>(busResponse.Data).Stops;
                busFiltered = busPreparsed.Select(s => new StopData
                {
                    ID        = int.Parse(s.ShortName),
                    Latitude  = (double)s.Latitude.ToCoordinate(),
                    Longitude = (double)s.Longitude.ToCoordinate(),
                    Name      = s.Name,
                    Type      = StopCategoryConverter.Convert(s.Category)
                })
                              .Where(s => (requestedTypes & s.Type) == s.Type);
            }

            Dictionary <int, StopData> tramStops = tramFiltered.ToDictionary(k => k.ID);
            HashSet <int> matched = new HashSet <int>();

            return(busFiltered.Select(bf =>
            {
                if (tramStops.ContainsKey(bf.ID))
                {
                    bf.Type = bf.Type | tramStops[bf.ID].Type;
                    matched.Add(bf.ID);
                }

                return bf;
            }).
                   Concat(tramFiltered.Where(tf => !matched.Contains(tf.ID)))
                   .OrderByDescending(s => s.Name)
                   .ToList());
        }
Example #32
0
        public TimeSpan(DateTime dateTime, dateTimeFormatEnum dateTimeFormat1, StopType stopType)
        {
            if (stopType == StopType.begin)
            {
                this.begin = dateTime;
            }
            else
            {
                this.end = dateTime;
            }

            this.dateTimeFormat1 = dateTimeFormat1;
        }
Example #33
0
        public TimeSpan(DateTime dateTime, dateTimeFormatEnum dateTimeFormat1, StopType stopType)
        {
            if (stopType == StopType.begin)
            {
                this.begin = dateTime;
            }
            else
            {
                this.end = dateTime;
            }

            this.dateTimeFormat1 = dateTimeFormat1;
        }
Example #34
0
 public Stop(Strategy strategy, Position position, DateTime time)
 {
     this.strategy = strategy;
     this.position = position;
     this.instrument = position.instrument;
     this.qty = position.qty;
     this.side = position.Side;
     this.type = StopType.Time;
     this.creationTime = strategy.framework.Clock.DateTime;
     this.completionTime = time;
     this.stopPrice = this.GetInstrumentPrice();
     if (this.completionTime > this.creationTime)
     {
         strategy.framework.Clock.AddReminder(new Reminder(new ReminderCallback(this.OnClock), this.completionTime, null));
     }
 }
Example #35
0
    public PortfolioStop(StrategyBase strategy, DateTime time, bool stopStrategy)
			:base(){
      this.dUqRtBdT71 = StopType.Trailing;
      this.Wa9RdDJEOa = StopMode.Percent;
      this.rfci6isjj5 = StopFillMode.Stop;
      this.sKmRoRmeN5 = strategy;
      this.ElNRan0isi = strategy.Portfolio;
      this.RUQiAxBBaC = stopStrategy;
      this.dUqRtBdT71 = StopType.Time;
      this.XoERmcoQ62 = Clock.Now;
      this.xTNRf1TvWo = time;
      this.FuNRz16ilo = this.ElNRan0isi.GetValue();
      if (!(this.xTNRf1TvWo > this.XoERmcoQ62))
        return;
      Clock.AddReminder(new ReminderEventHandler(this.AaPRYK2epA), this.xTNRf1TvWo, (object) null);
    }
Example #36
0
 public Stop(Strategy strategy, Position position, double level, StopType type, StopMode mode)
 {
     this.strategy = strategy;
     this.position = position;
     this.instrument = position.instrument;
     this.qty = position.qty;
     this.side = position.Side;
     this.level = level;
     this.type = type;
     this.mode = mode;
     this.currPrice = this.GetInstrumentPrice();
     this.trailPrice = this.currPrice;
     this.stopPrice = this.GetStopPrice();
     this.creationTime = strategy.framework.Clock.DateTime;
     this.completionTime = DateTime.MinValue;
     this.Connect();
 }
Example #37
0
		public ATSStop(Position position, double level, StopType type, StopMode mode)	: base()
		{
			this.fPosition = position;
			this.fInstrument = position.Instrument;
			this.fQty = position.Qty;
			this.fSide = position.Side;
			this.fLevel = level;
			this.fType = type;
			this.fMode = mode;
			this.fCurrPrice = this.fInstrument.Price();
			this.fTrailPrice = this.fCurrPrice;
			this.fStopPrice = this.lkZijZtYnj();
			this.fCreationTime = Clock.Now;
			this.fCompletionTime = DateTime.MinValue;
			this.series = new DoubleSeries();
			if (this.fType == StopType.Trailing)
				this.series.Add(this.fCreationTime, this.lkZijZtYnj());
			this.Connect();
		}
Example #38
0
File: Stop.cs Project: heber/FreeOQ
    public Stop(StrategyBase strategy, Position position, double level, StopType type, StopMode mode)
			:base()
		{
      this.Udd6EeE9v6 = strategy;
      this.fPosition = position;
      this.fInstrument = position.Instrument;
      this.fQty = position.Qty;
      this.fSide = position.Side;
      this.fLevel = level;
      this.fType = type;
      this.fMode = mode;
      this.fCurrPrice = this.fInstrument.Price();
      this.fTrailPrice = this.fCurrPrice;
      this.fStopPrice = this.SlN6PMZ5Ct();
      this.fCreationTime = Clock.Now;
      this.fCompletionTime = DateTime.MinValue;
      this.Udd6EeE9v6.AddStop((StopBase) this);
      this.t276DXCuDr();
    }
Example #39
0
    public PortfolioStop(StrategyBase strategy, double level, StopType type, StopMode mode, bool stopStrategy)
			:base(){
      this.dUqRtBdT71 = StopType.Trailing;
      this.Wa9RdDJEOa = StopMode.Percent;
      this.rfci6isjj5 = StopFillMode.Stop;
      this.sKmRoRmeN5 = strategy;
      this.ElNRan0isi = strategy.Portfolio;
      this.QqtReC8Evy = level;
      this.dUqRtBdT71 = type;
      this.Wa9RdDJEOa = mode;
      this.RUQiAxBBaC = stopStrategy;
      this.oURRNWOggg = this.ElNRan0isi.GetValue();
      this.uLLipPWdua = this.oURRNWOggg;
      this.FuNRz16ilo = this.aIZRlrvLwJ();
      this.XoERmcoQ62 = Clock.Now;
      this.xTNRf1TvWo = DateTime.MinValue;
      this.i7uRq8Sj1g();
      this.agAikbNDtv = this.oURRNWOggg;
      this.uLLipPWdua = this.oURRNWOggg;
      this.QJSRn03JW5();
    }
Example #40
0
		internal static SmartQuant.Trading.StopType Convert(StopType stopType)
		{
			switch (stopType)
			{
			case StopType.Fixed:
				return SmartQuant.Trading.StopType.Fixed;
			case StopType.Trailing:
				return SmartQuant.Trading.StopType.Trailing;
			case StopType.Time:
				return SmartQuant.Trading.StopType.Time;
			default:
				throw new NotImplementedException("Stop type is not supported : " + stopType);
			}
		}
        /// <summary>
        /// Determines the point at which we need to stop in the current lane
        /// </summary>
        /// <param name="lanePoint"></param>
        /// <param name="position"></param>
        /// <param name="stopRequired"></param>
        /// <param name="stopSpeed"></param>
        /// <param name="stopDistance"></param>
        public void NextNavigationalStop(IFQMPlanable lane, ArbiterWaypoint lanePoint, Coordinates position, double[] enCovariance, List<ArbiterWaypoint> ignorable,
            out double stopSpeed, out double stopDistance, out StopType stopType, out ArbiterWaypoint stopWaypoint)
        {
            // variables for default next stop line or end of lane
            this.NextLaneStop(lane, position, enCovariance, ignorable, out stopWaypoint, out stopSpeed, out stopDistance, out stopType);

            if (lanePoint != null)
            {
                // check if the point downstream is the last checkpoint
                if (CoreCommon.Mission.MissionCheckpoints.Count == 1 && lanePoint.WaypointId.Equals(CoreCommon.Mission.MissionCheckpoints.Peek().WaypointId))
                {
                    ArbiterWaypoint cpStop = lanePoint;
                    double cpStopSpeed;
                    double cpStopDistance;
                    StopType cpStopType = StopType.LastGoal;
                    this.StoppingParams(cpStop, lane, position, enCovariance, out cpStopSpeed, out cpStopDistance);

                    if (cpStopDistance <= stopDistance)
                    {
                        stopSpeed = cpStopSpeed;
                        stopDistance = cpStopDistance;
                        stopType = cpStopType;
                        stopWaypoint = cpStop;
                    }
                }
                // check if point is not the checkpoint and is an exit
                else if (lanePoint.IsExit && !lanePoint.WaypointId.Equals(CoreCommon.Mission.MissionCheckpoints.Peek().WaypointId))
                {
                    ArbiterWaypoint exitStop = lanePoint;
                    double exitStopSpeed;
                    double exitStopDistance;
                    StopType exitStopType = lanePoint.IsStop ? StopType.StopLine : StopType.Exit;
                    this.StoppingParams(exitStop, lane, position, enCovariance, out exitStopSpeed, out exitStopDistance);

                    if (exitStopDistance <= stopDistance)
                    {
                        stopSpeed = exitStopSpeed;
                        stopDistance = exitStopDistance;
                        stopType = exitStopType;
                        stopWaypoint = exitStop;
                    }
                }
            }
        }
        /// <summary>
        /// Makes new parameterization for nav
        /// </summary>
        /// <param name="lane"></param>
        /// <param name="lanePlan"></param>
        /// <param name="speed"></param>
        /// <param name="distance"></param>
        /// <param name="stopType"></param>
        /// <returns></returns>
        public TravelingParameters NavStopParameterization(IFQMPlanable lane, RoadPlan roadPlan, double speed, double distance, 
            ArbiterWaypoint stopWaypoint, StopType stopType, VehicleState state)
        {
            // get min dist
            double distanceCutOff = stopType == StopType.StopLine ? CoreCommon.OperationslStopLineSearchDistance : CoreCommon.OperationalStopDistance;

            #region Get Decorators

            // turn direction default
            ArbiterTurnDirection atd = ArbiterTurnDirection.Straight;
            List<BehaviorDecorator> decorators = TurnDecorators.NoDecorators;

            // check if need decorators
            if (lane is ArbiterLane &&
                stopWaypoint.Equals(roadPlan.BestPlan.laneWaypointOfInterest.PointOfInterest) &&
                roadPlan.BestPlan.laneWaypointOfInterest.IsExit &&
                distance < 40.0)
            {
                if (roadPlan.BestPlan.laneWaypointOfInterest.BestExit == null)
                    ArbiterOutput.Output("NAV BUG: lanePlan.laneWaypointOfInterest.BestExit: FQM NavStopParameterization");
                else
                {
                    switch (roadPlan.BestPlan.laneWaypointOfInterest.BestExit.TurnDirection)
                    {
                        case ArbiterTurnDirection.Left:
                            decorators = TurnDecorators.LeftTurnDecorator;
                            atd = ArbiterTurnDirection.Left;
                            break;
                        case ArbiterTurnDirection.Right:
                            atd = ArbiterTurnDirection.Right;
                            decorators = TurnDecorators.RightTurnDecorator;
                            break;
                        case ArbiterTurnDirection.Straight:
                            atd = ArbiterTurnDirection.Straight;
                            decorators = TurnDecorators.NoDecorators;
                            break;
                        case ArbiterTurnDirection.UTurn:
                            atd = ArbiterTurnDirection.UTurn;
                            decorators = TurnDecorators.LeftTurnDecorator;
                            break;
                    }
                }
            }
            else if (lane is SupraLane)
            {
                SupraLane sl = (SupraLane)lane;
                double distToInterconnect = sl.DistanceBetween(state.Front, sl.Interconnect.InitialGeneric.Position);

                if ((distToInterconnect > 0 && distToInterconnect < 40.0) || sl.ClosestComponent(state.Front) == SLComponentType.Interconnect)
                {
                    switch (sl.Interconnect.TurnDirection)
                    {
                        case ArbiterTurnDirection.Left:
                            decorators = TurnDecorators.LeftTurnDecorator;
                            atd = ArbiterTurnDirection.Left;
                            break;
                        case ArbiterTurnDirection.Right:
                            atd = ArbiterTurnDirection.Right;
                            decorators = TurnDecorators.RightTurnDecorator;
                            break;
                        case ArbiterTurnDirection.Straight:
                            atd = ArbiterTurnDirection.Straight;
                            decorators = TurnDecorators.NoDecorators;
                            break;
                        case ArbiterTurnDirection.UTurn:
                            atd = ArbiterTurnDirection.UTurn;
                            decorators = TurnDecorators.LeftTurnDecorator;
                            break;
                    }
                }
            }

            #endregion

            #region Get Maneuver

            Maneuver m = new Maneuver();
            bool usingSpeed = true;
            SpeedCommand sc = new StopAtDistSpeedCommand(distance);

            #region Distance Cutoff

            // check if distance is less than cutoff
            if (distance < distanceCutOff && stopType != StopType.EndOfLane)
            {
                // default behavior
                Behavior b = new StayInLaneBehavior(stopWaypoint.Lane.LaneId, new StopAtDistSpeedCommand(distance), new List<int>(), lane.LanePath(), stopWaypoint.Lane.Width, stopWaypoint.Lane.NumberOfLanesLeft(state.Front, true), stopWaypoint.Lane.NumberOfLanesRight(state.Front, true));

                // stopping so not using speed param
                usingSpeed = false;

                // exit is next
                if (stopType == StopType.Exit)
                {
                    // exit means stopping at a good exit in our current lane
                    IState nextState = new StoppingAtExitState(stopWaypoint.Lane, stopWaypoint, atd, true, roadPlan.BestPlan.laneWaypointOfInterest.BestExit, state.Timestamp, state.Front);
                    m = new Maneuver(b, nextState, decorators, state.Timestamp);
                }

                // stop line is left
                else if (stopType == StopType.StopLine)
                {
                    // determine if hte stop line is the best exit
                    bool isNavExit = roadPlan.BestPlan.laneWaypointOfInterest.PointOfInterest.Equals(stopWaypoint);

                    // get turn direction
                    atd = isNavExit ? atd : ArbiterTurnDirection.Straight;

                    // predetermine interconnect if best exit
                    ArbiterInterconnect desired = null;
                    if (isNavExit)
                        desired = roadPlan.BestPlan.laneWaypointOfInterest.BestExit;
                    else if (stopWaypoint.NextPartition != null && state.Front.DistanceTo(roadPlan.BestPlan.laneWaypointOfInterest.PointOfInterest.Position) > 25)
                        desired = stopWaypoint.NextPartition.ToInterconnect;

                    // set decorators
                    decorators = isNavExit ? decorators : TurnDecorators.NoDecorators;

                    // stop at the stop
                    IState nextState = new StoppingAtStopState(stopWaypoint.Lane, stopWaypoint, atd, isNavExit, desired);
                    b = new StayInLaneBehavior(stopWaypoint.Lane.LaneId, new StopAtLineSpeedCommand(), new List<int>(), lane.LanePath(), stopWaypoint.Lane.Width, stopWaypoint.Lane.NumberOfLanesLeft(state.Front, true), stopWaypoint.Lane.NumberOfLanesRight(state.Front, true));
                    m = new Maneuver(b, nextState, decorators, state.Timestamp);
                    sc = new StopAtLineSpeedCommand();
                }
                else if(stopType == StopType.LastGoal)
                {
                    // stop at the last goal
                    IState nextState = new StayInLaneState(stopWaypoint.Lane, CoreCommon.CorePlanningState);
                    m = new Maneuver(b, nextState, decorators, state.Timestamp);
                }
            }

            #endregion

            #region Outisde Distance Envelope

            // not inside distance envalope
            else
            {
                // set speed
                sc = new ScalarSpeedCommand(speed);

                // check if lane
                if (lane is ArbiterLane)
                {
                    // get lane
                    ArbiterLane al = (ArbiterLane)lane;

                    // default behavior
                    Behavior b = new StayInLaneBehavior(al.LaneId, new ScalarSpeedCommand(speed), new List<int>(), al.LanePath(), al.Width, al.NumberOfLanesLeft(state.Front, true), al.NumberOfLanesRight(state.Front, true));

                    // standard behavior is fine for maneuver
                    m = new Maneuver(b, new StayInLaneState(al, CoreCommon.CorePlanningState), decorators, state.Timestamp);
                }
                // check if supra lane
                else if (lane is SupraLane)
                {
                    // get lane
                    SupraLane sl = (SupraLane)lane;

                    // get sl state
                    StayInSupraLaneState sisls = (StayInSupraLaneState)CoreCommon.CorePlanningState;

                    // get default beheavior
                    Behavior b = sisls.GetBehavior(new ScalarSpeedCommand(speed), state.Front, new List<int>());

                    // standard behavior is fine for maneuver
                    m = new Maneuver(b, sisls, decorators, state.Timestamp);
                }
            }

            #endregion

            #endregion

            #region Parameterize

            // create new params
            TravelingParameters tp = new TravelingParameters();
            tp.Behavior = m.PrimaryBehavior;
            tp.Decorators = m.PrimaryBehavior.Decorators;
            tp.DistanceToGo = distance;
            tp.NextState = m.PrimaryState;
            tp.RecommendedSpeed = speed;
            tp.Type = TravellingType.Navigation;
            tp.UsingSpeed = usingSpeed;
            tp.SpeedCommand = sc;
            tp.VehiclesToIgnore = new List<int>();

            // return navigation params
            return tp;

            #endregion
        }
        /// <summary>
        /// Convert stop type to string
        /// </summary>
        /// <param name="stopType">Stop type</param>
        /// <param name="stop">Stop</param>
        /// <returns>Correct localized string</returns>
        private static string _GetStopTypeStr(StopType stopType, Stop stop)
        {
            string result = "";

            switch (stopType)
            {
                case StopType.Location:
                    {
                        if (stop.SequenceNumber == 1)
                        {
                            result = (string)App.Current.FindResource("StartString");
                        }
                        else if (stop.SequenceNumber == stop.Route.Stops.Count)
                        {
                            result = (string)App.Current.FindResource("FinishString");
                        }
                        else
                        {
                            result = (string)App.Current.FindResource("RenewalString");
                        }

                        break;
                    }
                case StopType.Order:
                    {
                        result = (string)App.Current.FindResource("Order");
                        break;
                    }
                case StopType.Lunch:
                    {
                        Debug.Assert(false);
                        break;
                    }
            }

            return result;
        }
        /// <summary>
        /// Generate the traveling parameterization for the desired behaivor
        /// </summary>
        /// <param name="lane"></param>
        /// <param name="navStopSpeed"></param>
        /// <param name="navStopDistance"></param>
        /// <param name="navStop"></param>
        /// <param name="navStopType"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        private TravelingParameters NavStopParameterization(ArbiterLane lane, double navStopSpeed, double navStopDistance, ArbiterWaypoint navStop, StopType navStopType, VehicleState state)
        {
            // get min dist
            double distanceCutOff = CoreCommon.OperationalStopDistance;

            // turn direction default
            List<BehaviorDecorator> decorators = TurnDecorators.NoDecorators;

            // create new params
            TravelingParameters tp = new TravelingParameters();

            #region Get Maneuver

            Maneuver m = new Maneuver();
            bool usingSpeed = true;

            // get lane path
            LinePath lp = lane.LanePath().Clone();
            lp.Reverse();

            #region Distance Cutoff

            // check if distance is less than cutoff
            if (navStopDistance < distanceCutOff)
            {
                // default behavior
                tp.SpeedCommand = new StopAtDistSpeedCommand(navStopDistance);
                Behavior b = new StayInLaneBehavior(lane.LaneId, new StopAtDistSpeedCommand(navStopDistance), new List<int>(), lp, lane.Width, lane.NumberOfLanesLeft(state.Front, false), lane.NumberOfLanesRight(state.Front, false));

                // stopping so not using speed param
                usingSpeed = false;

                IState nextState = CoreCommon.CorePlanningState;
                m = new Maneuver(b, nextState, decorators, state.Timestamp);
            }

            #endregion

            #region Outisde Distance Envelope

            // not inside distance envalope
            else
            {
                // get lane
                ArbiterLane al = lane;

                // default behavior
                tp.SpeedCommand = new ScalarSpeedCommand(Math.Min(navStopSpeed, 2.24));
                Behavior b = new StayInLaneBehavior(al.LaneId, new ScalarSpeedCommand(Math.Min(navStopSpeed, 2.24)), new List<int>(), lp, al.Width, al.NumberOfLanesRight(state.Front, false), al.NumberOfLanesLeft(state.Front, false));

                // standard behavior is fine for maneuver
                m = new Maneuver(b, CoreCommon.CorePlanningState, decorators, state.Timestamp);
            }

            #endregion

            #endregion

            #region Parameterize

            tp.Behavior = m.PrimaryBehavior;
            tp.Decorators = m.PrimaryBehavior.Decorators;
            tp.DistanceToGo = navStopDistance;
            tp.NextState = m.PrimaryState;
            tp.RecommendedSpeed = navStopSpeed;
            tp.Type = TravellingType.Navigation;
            tp.UsingSpeed = usingSpeed;
            tp.VehiclesToIgnore = new List<int>();

            // return navigation params
            return tp;

            #endregion
        }
        /// <summary>
        /// Gets the next navigational stop relavant to us (stop or end) in the closest good lane or our current opposing lane
        /// </summary>
        /// <param name="closestGood"></param>
        /// <param name="coordinates"></param>
        /// <param name="ignorable"></param>
        /// <param name="navStopSpeed"></param>
        /// <param name="navStopDistance"></param>
        /// <param name="navStopType"></param>
        /// <param name="navStop"></param>
        private void NextOpposingNavigationalStop(ArbiterLane opposing, ArbiterLane closestGood, Coordinates coordinates, double extraDistance, 
            out double navStopSpeed, out double navStopDistance, out StopType navStopType, out ArbiterWaypoint navStop)
        {
            ArbiterWaypoint current = null;
            double minDist = Double.MaxValue;
            StopType st = StopType.EndOfLane;

            #region Closest Good Parameterization

            foreach (ArbiterWaypoint aw in closestGood.WaypointList)
            {
                if (aw.IsStop || aw.NextPartition == null)
                {
                    double dist = closestGood.DistanceBetween(coordinates, aw.Position);

                    if (dist < minDist && dist >= 0)
                    {
                        current = aw;
                        minDist = dist;
                        st = aw.IsStop ? StopType.StopLine : StopType.EndOfLane;
                    }
                }
            }

            #endregion

            #region Opposing Parameterization

            ArbiterWaypoint opStart = opposing.GetClosestPartition(coordinates).Initial;
            int startIndex = opposing.WaypointList.IndexOf(opStart);

            for (int i = startIndex; i >= 0; i--)
            {
                ArbiterWaypoint aw = opposing.WaypointList[i];
                if (aw.IsStop || aw.PreviousPartition == null)
                {
                    double dist = opposing.DistanceBetween(aw.Position, coordinates);

                    if (dist < minDist && dist >= 0)
                    {
                        current = aw;
                        minDist = dist;
                        st = aw.IsStop ? StopType.StopLine : StopType.EndOfLane;
                    }
                }
            }

            #endregion

            double tmpDistanceIgnore;
            this.StoppingParams(current, closestGood, coordinates, extraDistance, out navStopSpeed, out tmpDistanceIgnore);
            navStop = current;
            navStopDistance = minDist;
            navStopType = st;
        }
Example #46
0
 public Stop(Strategy strategy, Position position, double level, StopType type, StopMode mode)
 {
     this.type = StopType.Trailing;
     this.mode = StopMode.Percent;
     this.traceOnQuote = true;
     this.traceOnTrade = true;
     this.traceOnBar = true;
     this.traceOnBarOpen = true;
     this.trailOnOpen = true;
     this.filterBarSize = -1L;
     this.filterBarType = BarType.Time;
     this.fillMode = StopFillMode.Stop;
     this.strategy = strategy;
     this.position = position;
     this.instrument = position.Instrument;
     this.qty = position.Qty;
     this.side = position.Side;
     this.level = level;
     this.type = type;
     this.mode = mode;
     this.currPrice = GetInstrumentPrice();
     this.trailPrice = this.currPrice;
     this.stopPrice = GetStopPrice();
     this.creationTime = strategy.Framework.Clock.DateTime;
     this.completionTime = DateTime.MinValue;
     this.method_0();
 }
Example #47
0
		public Stop SetStop(double level, StopType type, StopMode mode)
		{
			return this.SetStop(this.Position, level, type, mode);
		}
Example #48
0
		public Stop SetStop(Position position, double level, StopType type, StopMode mode)
		{
			Stop stop = new Stop(position, level, type, mode);
			Map.OQ_SQ_Stop[stop] = stop.stop;
			Map.SQ_OQ_Stop[stop.stop] = stop;
			Map.AddStop(stop.stop, this.strategyName);
			stop.TraceOnBar = this.stopTraceOnBar;
			stop.TraceOnTrade = this.stopTraceOnTrade;
			stop.TraceOnQuote = this.stopTraceOnQuote;
			return stop;
		}
Example #49
0
File: Stop.cs Project: heber/FreeOQ
    public Stop(StrategyBase strategy, double level, StopType type, StopMode mode)
			:  this(strategy, (Position) null, level, type, mode) {
    }
Example #50
0
		public StopBase() : base()
		{
			this.fType = StopType.Trailing;
			this.fMode = StopMode.Percent;
			this.fTraceOnQuote = true;
			this.fTraceOnTrade = true;
			this.fTraceOnBar = true;
			this.fTraceOnBarOpen = true;
			this.fTrailOnOpen = true;
			this.fFilterBarSize = -1L;
			this.fFilterBarType = BarType.Time;
			this.fFillMode = StopFillMode.Stop;
			this.textEnabled = true;
			this.toolTipEnabled = true;
			this.toolTipFormat = "";
			this.activeColor = Color.Purple;
			this.executedColor = Color.RoyalBlue;
			this.canceledColor = Color.Gray;
		}
Example #51
0
        private static void Set( StopType type, WoWUnit unit, WoWPoint pt, double range, SimpleBooleanDelegate stop, SimpleBooleanDelegate and )
        {
            if (MovementManager.IsMovementDisabled)
                return;

            if (SingularSettings.DebugStopMoving)
            {
                int levelsUp = 2;
                if (type == StopType.None)
                    levelsUp++;

                StackFrame frame = new StackFrame(levelsUp);
                if (frame != null)
                {
                    MethodBase method = frame.GetMethod();
                    callerName = method.DeclaringType.FullName + "." + method.Name;
                    callerFile = frame.GetFileName();
                    callerLine = frame.GetFileLineNumber();
                    Logger.WriteDebug(Color.DeepPink, "StopMoving SET: type={0} at {1} @ {2} [{3}]", type, callerFile, callerLine, callerName);
                }
                else
                {
                    callerName = "na";
                    callerFile = "na";
                    callerLine = -1;
                }
            }

            Type = type;
            Unit = unit;
            Point = pt;
            Range = range;

            if (and == null)
                and = ret => true;

            StopRequestDelegate = ret => stop(ret) && and(ret);
        }
Example #52
0
 public Stop(Strategy strategy, Position position, double level, StopType type, StopMode mode)
     :this(strategy, position, DateTime.MinValue, level, type, mode)
 {
 }
Example #53
0
		internal Stop(Position position, double level, StopType type, StopMode mode)
		{
			this.position = position;
			SmartQuant.Trading.StopType type2 = EnumConverter.Convert(type);
			SmartQuant.Trading.StopMode mode2 = EnumConverter.Convert(mode);
			this.stop = new ATSStop(position.position, level, type2, mode2);
			this.stop.TrailOnHighLow = true;
			this.stop.TraceOnBarOpen = true;
			this.stop.TraceOnBar = true;
			this.stop.TraceOnQuote = true;
			this.stop.TraceOnTrade = true;
		}
Example #54
0
 private Stop(Strategy strategy, Position position, DateTime time, double level = 0, StopType type = StopType.Trailing, StopMode mode = StopMode.Percent)
 {
     this.strategy = strategy;
     this.position = position;
     this.instrument = position.Instrument;
     this.qty = position.Qty;
     this.side = position.Side;
     this.type = type;
     this.mode = mode;
     this.creationTime = strategy.framework.Clock.DateTime;
     this.completionTime = time;
     this.stopPrice = GetInstrumentPrice();
     if (this.completionTime > this.creationTime)
         strategy.framework.Clock.AddReminder(new Reminder(this.method_9, this.completionTime, null));
 }
Example #55
0
		public ATSStop SetStop(Position position, double level, StopType type, StopMode mode)
		{
			ATSStop atsStop = new ATSStop(position, level, type, mode);
			this.Strategy.nPMi9oJHY7(atsStop);
			return atsStop;
		}
Example #56
0
        private static void Set( StopType type, WoWUnit unit, WoWPoint pt, double range, SimpleBooleanDelegate stop, SimpleBooleanDelegate and )
        {
            if (MovementManager.IsMovementDisabled)
                return;

            if (SingularSettings.Debug)
            {
                StackFrame frame = new StackFrame(3);
                if (frame != null)
                {
                    MethodBase method = frame.GetMethod();
                    callerName = method.DeclaringType.FullName + "." + method.Name;
                    callerFile = frame.GetFileName();
                    callerLine = frame.GetFileLineNumber();
                }
                else
                {
                    callerName = "na";
                    callerFile = "na";
                    callerLine = -1;
                }
            }

            Type = type;
            Unit = unit;
            Point = pt;
            Range = range;

            if (and == null)
                and = ret => true;

            StopRequestDelegate = ret => stop(ret) && and(ret);
        }
        /// <summary>
        /// Next point at which to stop
        /// </summary>
        /// <param name="lane"></param>
        /// <param name="position"></param>
        /// <param name="stopPoint"></param>
        /// <param name="stopSpeed"></param>
        /// <param name="stopDistance"></param>
        public void NextLaneStop(IFQMPlanable lane, Coordinates position, double[] enCovariance, List<ArbiterWaypoint> ignorable,
            out ArbiterWaypoint stopPoint, out double stopSpeed, out double stopDistance, out StopType stopType)
        {
            // get the stop
            List<WaypointType> wts = new List<WaypointType>();
            wts.Add(WaypointType.Stop);
            wts.Add(WaypointType.End);
            stopPoint = lane.GetNext(position, wts, ignorable);

            // set stop type
            stopType = stopPoint.IsStop ? StopType.StopLine : StopType.EndOfLane;

            // parameterize
            this.StoppingParams(stopPoint, lane, position, enCovariance, out stopSpeed, out stopDistance);
        }
Example #58
0
File: Stop.cs Project: heber/FreeOQ
		internal Stop(Position position, double level, StopType type, StopMode mode)
		{
			this.position = position;
			FreeQuant.Trading.StopType stopType = EnumConverter.Convert(type);
			FreeQuant.Trading.StopMode stopMode = EnumConverter.Convert(mode);
			this.stop = new ATSStop(position.position, level, stopType, stopMode);
			((StopBase)this.stop).TrailOnHighLow = true;
			((StopBase)this.stop).TraceOnBarOpen = true;
			((StopBase)this.stop).TraceOnBar = true;
			((StopBase)this.stop).TraceOnQuote = true;
			((StopBase)this.stop).TraceOnTrade = true;
		}
 public Stop SetStop(double level, StopType type = StopType.Fixed, StopMode mode = StopMode.Absolute)
 {
     var stop = new Stop(this.strategy, this.Position, level, type, mode);
     this.strategy.AddStop(stop);
     return stop;
 }
Example #60
0
		public virtual void AddStop(Strategy strategy, double level, StopType type, StopMode mode)
		{
			PortfolioStop portfolioStop = new PortfolioStop(strategy, level, type, mode, true);
		}