コード例 #1
0
        public override void SetEnablePositions(ISituation situation, out Positions enableMovein, out Positions enableCapture)
        {
            enableCapture = new Positions();
            enableMovein = new Positions();

            Position aPos = this.Position.ShiftWestNorth();
            Position bPos = this.Position.ShiftEastNorth();
            Position cPos = this.Position.ShiftWestSouth();
            Position dPos = this.Position.ShiftEastSouth();
            if (aPos != Position.Empty)
            {
                Position.Shift(this.GameSide, situation, aPos.ShiftNorth(), enableMovein, enableCapture);
                Position.Shift(this.GameSide, situation, aPos.ShiftWest(), enableMovein, enableCapture);
            }
            if (bPos != Position.Empty)
            {
                Position.Shift(this.GameSide, situation, bPos.ShiftNorth(), enableMovein, enableCapture);
                Position.Shift(this.GameSide, situation, bPos.ShiftEast(), enableMovein, enableCapture);
            }
            if (cPos != Position.Empty)
            {
                Position.Shift(this.GameSide, situation, cPos.ShiftWest(), enableMovein, enableCapture);
                Position.Shift(this.GameSide, situation, cPos.ShiftSouth(), enableMovein, enableCapture);
            }
            if (dPos != Position.Empty)
            {
                Position.Shift(this.GameSide, situation, dPos.ShiftEast(), enableMovein, enableCapture);
                Position.Shift(this.GameSide, situation, dPos.ShiftSouth(), enableMovein, enableCapture);
            }
        }
コード例 #2
0
 public void moveNewton(Positions newPosition)
 {
     if( newPosition == Positions.LEVEL1 ){
         transform.position = new Vector3(-77.31179f, 1.984234f, 1.453054f);
     }
     newtonPosition = newPosition;
 }
コード例 #3
0
		/// <summary>
		/// Vérifie si une variable de type Position est en cours ou à déjà été clôturée
		/// </summary>
		/// <param name="position">Used position</param>
		/// <returns>true si la position est active, false sinon</returns>
		public static bool isAlive(this Position position, Positions positions)
		{
			var request = from p in positions select p.Id==position.Id ;

			return request!=null;

		}
コード例 #4
0
    void movePlatform()
    {
        stepCount++;
        if(stepCount >=stepTimer)
        {
            switch(platformDirection)
            {
                case Positions.LEFT:
                    offSet = new Vector3(-stepSize, 0,0);
                    platformPosition--;
                    break;
                case Positions.RIGHT:
                    offSet = new Vector3(stepSize, 0,0);
                    platformPosition++;
                    break;      
            }


            this.transform.position += offSet;
            //Cambio de direccion
            if(platformDirection.Equals(platformPosition))
            {
                if(platformDirection.Equals(Positions.RIGHT))
                {
                    platformDirection = Positions.LEFT;
                }
                else
                {
                    platformDirection = Positions.RIGHT;
                }
            }
        }
    }
コード例 #5
0
 public override void SetEnablePositions(ISituation situation, out Positions enableMovein, out Positions enableCapture)
 {
     enableMovein = new Positions();
     enableCapture = new Positions();
     PieceRook.RookShift(this.GameSide, situation, this.Position, enableMovein, enableCapture);
     PieceBishop.BishopShift(this.GameSide, situation, this.Position, enableMovein, enableCapture);
 }
コード例 #6
0
ファイル: Parser.cs プロジェクト: bidacek/GraphTheoryEditor
 public AddVToPosCommand(Graph gr,Positions pos,int x, int y)
 {
     innGraph = gr;
     _pos = pos;
     _x = x;
     _y = y;
 }
コード例 #7
0
	    public IHttpActionResult Post([FromBody]AddNewPositionModel model)
		{
            var term = termManager.GetById(model.termId);
            ClientTermViewModel result = null;

            var product = productManager.GetById(model.productId);
            var user = userManager.GetByLogin(model.Login);

            if (user != null && user.Token == model.Token &&
                product != null && term != null)
            {
                var newPosition = new Positions()
                {
                    Amount = 1, //TODO
                    Description = product.Name,
                    ProductId = product.Id,
                    Price = product.Price,
                    OrderId = term.OrderId,
                };

                positionsManager.AddEntity(newPosition);
                

                var newTermPosition = new TermPositions()
                {
                    TermId = term.Id,
                    Amount = 1, //TODO
                    Positions = newPosition,
                    TermPositionMaterialRsps = new List<TermPositionMaterialRsp>()
                };

                term.TermPositions.Add(newTermPosition);


                //add linked material to position
                foreach (var material in product.ProductMaterialRsps.Where(o => !o.DeleteDate.HasValue))
                {
                    newTermPosition.TermPositionMaterialRsps.Add(new TermPositionMaterialRsp()
                    {
                        Amount = material.Amount,
                        MaterialId = material.MaterialId,
                        TermPositions = newTermPosition 
                    });
                }

                positionsManager.SaveChanges();



                if (term != null)
                {
                    result = TermViewModelHelper.ToModel(term, true, false);
                }

                return Ok(result);
            }

            return BadRequest();
		}
コード例 #8
0
ファイル: Worker.cs プロジェクト: psyshit42/ZARPLATA1
 public Worker(string Name, int Age, Positions Position, double Wage, int BranchID)
 {
     this.Name = Name;
     this.Age = Age;
     this.Position = Position;
     this.Wage = Wage;
     this.BranchID = BranchID;
 }
コード例 #9
0
ファイル: Position.cs プロジェクト: DIVEROVIEDO/DotSpatial
 /// <summary> 
 /// Returns Positions.Left if the position is Positions.Right, 
 /// Positions.Right if the position is Left, or the position
 /// otherwise.
 /// </summary>
 /// <param name="position"></param>
 public static Positions Opposite(Positions position)
 {
     if (position == Positions.Left)
         return Positions.Right;
     if (position == Positions.Right)
         return Positions.Left;
     return position;
 }
コード例 #10
0
 public void moveNewton(Positions newPosition)
 {
     if( newPosition == Positions.LAB ){
         transform.position = new Vector3(-4.748125f, 1.238406f, -8.060616f);
     } else if ( newPosition == Positions.LEVEL1 ){
         transform.position = new Vector3(-35.4f, 1.238406f, -26.3f);
     }
     newtonPosition = newPosition;
 }
コード例 #11
0
        public VertexVievModel(Vertex v, Graph g, Positions p, Names n)
        {
            vertex= v;

            graph = g;
            positionedGraph = p;

            namedGraph = n;
        }
コード例 #12
0
 void Start()
 {
     state = States.INTRO;
     newtonPosition = Positions.LAB;
     fpsInput = GameObject.Find("Player").GetComponent("FPSInputController") as FPSInputController;
     consoleController = GameObject.Find("console").GetComponent("ConsoleController") as ConsoleController;
     gameController = GameObject.Find("Controller").GetComponent("GameController") as GameController;
     ramTrigger = GameObject.Find("ram").GetComponent("RamTrigger") as RamTrigger;
     Player = GameObject.Find("Player");
 }
コード例 #13
0
ファイル: Depth.cs プロジェクト: ExRam/DotSpatial-PCL
 /// <summary>
 /// Calls GetDepth and SetDepth.
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public int this[int geomIndex, Positions posIndex]
 {
     get
     {
         return GetDepth(geomIndex, posIndex);
     }
     set
     {
         SetDepth(geomIndex, posIndex, value);
     }
 }
コード例 #14
0
ファイル: Form1.cs プロジェクト: juristr/codehacks
 public void LoadWindow(Control control, Positions position)
 {
     if (position == Positions.Main)
     {
         flowLayoutPanelMain.Controls.Clear();
         flowLayoutPanelMain.Controls.Add(control);
     }
     else if(position == Positions.Navigation)
     {
         flowLayoutPanelWest.Controls.Clear();
         flowLayoutPanelWest.Controls.Add(control);
     }
 }
コード例 #15
0
        public override void SetEnablePositions(ISituation situation, out Positions enableMovein, out Positions enableCapture)
        {
            enableMovein = new Positions();
            enableCapture = new Positions();

            Position.Shift(this.GameSide, situation, this.Position.ShiftEast(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftSouth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftWest(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftNorth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftEastNorth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftEastSouth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftWestNorth(), enableMovein, enableCapture);
            Position.Shift(this.GameSide, situation, this.Position.ShiftWestSouth(), enableMovein, enableCapture);
        }
コード例 #16
0
ファイル: Player.cs プロジェクト: sphillips9/Draft-Winners
        public Player(Positions pos, String name, int ID, int Salary, double points)
        {
            mPosition = pos;
            mName = name;
            mID = ID;
            mSalary = Salary;
            mAvgFantasyPoints = points;

            if (mAvgFantasyPoints > 0)
            {
                mDollarsPerPoint = (mSalary / mAvgFantasyPoints);
            }
            else
            {
                mDollarsPerPoint = 0;
            }
        }
コード例 #17
0
 private void Awake()
 {
     theTransform = transform;
     anim = GetComponent<Animator>();
     playerH = GetComponent<PlayerHealth>();
     rigid = GetComponent<Rigidbody2D>();
     positions = GameObject.FindWithTag("Scripts").GetComponent<Positions>();
     reset = GameObject.FindWithTag("Scripts").GetComponent<Reset>();
     enemies = GameObject.FindGameObjectsWithTag("Enemy");
     tips = GameObject.FindWithTag("UI").GetComponent<HelpfulTips>();
     showPanels = GameObject.FindWithTag("UI").GetComponent<ShowPanels>();
     scenes = GameObject.FindWithTag("Scripts").GetComponent<Scenes>();
     if (!isRight)
         reset.ResetHelmet();
     rigid.gravityScale = 0f;
     GetComponentInChildren<SpriteRenderer>().enabled = false;
 }
コード例 #18
0
        public IHttpActionResult Put(OrdersModel model)
        {
            var order = manager.GetById(model.Id);

            var newOrder = new Orders()
            {
                AutoBill = order.AutoBill,
                City = order.City,
                Comment = order.Comment,
                CommunicationPartnerId = order.CommunicationPartnerId,
                CustomerId = order.CustomerId,
                Discount = order.Discount,
                Street = order.Street,
                Status = (int)OrderStatusTypes.Open,
                Zip = order.Zip,
                IsOffer = false,
                OrderNumber = numberProvider.GetNextOrderNumber(),
                Positions = new List<Positions>(),
                CreateDate = DateTime.Now,
                ChangeDate = DateTime.Now,
            };
            
            manager.AddEntity(newOrder);

            foreach(var position in order.Positions.Where(o => o.MaterialId.HasValue && !o.DeleteDate.HasValue).ToList())
            {
                var newPosition = new Positions()
                {
                    MaterialId = position.MaterialId.Value,
                    IsAlternative = position.IsAlternative,
                    IsMaterialPosition = position.IsMaterialPosition,
                    Amount = position.Amount,
                    Price = position.Price,
                    PaymentType = position.PaymentType,
                    Orders = newOrder
                };

                positionManager.AddEntity(newPosition);
                newOrder.Positions.Add(newPosition);
            }

            manager.SaveChanges();

            return Ok(new { id = newOrder.Id });
        }
コード例 #19
0
	// Use this for initialization
	void Start () {
        stepCount = 0;
        stepSize = platform.GetComponent<Renderer>().bounds.size.x;
        offSet = new Vector3(0, 0,0);
        InvokeRepeating("movePlatform", 0, stepTimer);

        if (platformDirection.Equals(platformPosition))
        {
            if (platformDirection.Equals(Positions.RIGHT))
            {
                platformDirection = Positions.LEFT;
            }
            else
            {
                platformDirection = Positions.RIGHT;
            }
        }

    }
コード例 #20
0
        /// <summary>
        /// 象的基本路线(即斜向)
        /// </summary>
        internal static void BishopShift(
            Enums.GameSide side, ISituation situation, Position position,
            Positions moveInPs, Positions capturePs)
        {
            bool canContine = true;
            Position tgtPos = Position.Empty;

            canContine = true;
            tgtPos = position;
            while (canContine)
            {
                tgtPos = tgtPos.ShiftEastNorth();
                canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs);
            }

            canContine = true;
            tgtPos = position;
            while (canContine)
            {
                tgtPos = tgtPos.ShiftEastSouth();
                canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs);
            }

            canContine = true;
            tgtPos = position;
            while (canContine)
            {
                tgtPos = tgtPos.ShiftWestNorth();
                canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs);
            }

            canContine = true;
            tgtPos = position;
            while (canContine)
            {
                tgtPos = tgtPos.ShiftWestSouth();
                canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs);
            }
        }
コード例 #21
0
	    public IHttpActionResult Post([FromBody]AddNewMaterialModel model)
		{
            var term = termManager.GetById(model.termId);
            ClientTermViewModel result = null;

            var material = materialManager.GetById(model.materialId);
            var user = userManager.GetByLogin(model.Login);

            if (user != null && user.Token == model.Token &&
                material != null && term != null)
            {
                var newPosition = new Positions()
                {
                    Amount = 1, //TODO
                    Description = material.Name,
                    MaterialId = material.Id,
                    Price = material.Price,
                    OrderId = term.OrderId,
                    IsMaterialPosition = true,
                    TermId = term.Id,
                    CreateDate = DateTime.Now,
                    ChangeDate = DateTime.Now,
                };

                positionsManager.AddEntity(newPosition);

                positionsManager.SaveChanges();

                if (term != null)
                {
                    result = TermViewModelHelper.ToModel(term, false, true);
                }

                return Ok(result);
            }

            return BadRequest();
		}
コード例 #22
0
ファイル: Cylinder.cs プロジェクト: st1310/masgk
        private void GenerateTorso(ref int index, ref List <List <int> > indexArray, ref float halfHeight)
        {
            Float3 normal = new();
            Float3 vertex = new();

            // this will be used to calculate the normal
            float slope = (radiusBottom - radiusTop) / height;

            // generate vertices, normals and uvs
            for (int y = 0; y <= heightSegments; y++)
            {
                List <int> indexRow = new();

                float v = (float)y / heightSegments;

                // calculate the radius of the current row
                float radius = v * (radiusBottom - radiusTop) + radiusTop;

                for (int x = 0; x <= radialSegments; x++)
                {
                    float u = (float)x / radialSegments;

                    double theta = u * thetaLength + thetaStart;

                    double sinTheta = Math.Sin(theta);
                    double cosTheta = Math.Cos(theta);

                    // vertex
                    vertex.X = (float)(radius * sinTheta);
                    vertex.Y = -v * height + halfHeight;
                    vertex.Z = (float)(radius * cosTheta);
                    Positions.Add(vertex);

                    // normal
                    normal = new((float)sinTheta, slope, (float)cosTheta);
                    Normals.Add(normal.Normalize);

                    // uv
                    TextureCoordinates.Add(new(u, 1.0f - v, 0.0f));

                    // save index of vertex in respective row
                    indexRow.Add(index++);
                }

                // now save vertices of the row in our index array
                indexArray.Add(indexRow);
            }

            // generate indices
            for (int x = 0; x < radialSegments; x++)
            {
                for (int y = 0; y < heightSegments; y++)
                {
                    // we use the index array to access the correct indices
                    int a = indexArray[y][x];
                    int b = indexArray[y + 1][x];
                    int c = indexArray[y + 1][x + 1];
                    int d = indexArray[y][x + 1];

                    // faces
                    Indices.Add(d);
                    Indices.Add(b);
                    Indices.Add(a);

                    Indices.Add(d);
                    Indices.Add(c);
                    Indices.Add(b);
                }
            }
        }
コード例 #23
0
        // Acting.

        private protected override void OnAct(out GoalStatus goalStatus)
        {
            var owner   = Owner;
            var context = Context;

            if (owner is null || context is null)
            {
                goalStatus = GoalStatus.Active;
                return;
            }

            // Check if destination is reached.
            var currentPosition = owner.Body.Position;

            if ((currentPosition - Goal.Destination).magnitude <= Goal.AdmissibleDistance)
            {
                goalStatus = GoalStatus.Achieved;
                return;
            }

            // Choose motion ability.
            var abilityCollection = owner.AbilityCollection;
            IMotionAbilityPresentation chosenAbility = null;

            foreach (var motionAbility in abilityCollection.Motions)
            {
                if (chosenAbility == null || motionAbility.MovementPerSecond > chosenAbility.MovementPerSecond)
                {
                    chosenAbility = motionAbility;
                }
            }

            // Check if unit is in motion.
            IMotionConditionPresentation currentCondition = owner.Condition as IMotionConditionPresentation;

            // Check if destination node is reached.
            var currentNode     = context.UnitSystem[owner];
            var destinationNode = Positions.WorldToNode(Goal.Destination);

            if (currentNode == destinationNode)
            {
                // Use motion ability if condition doesn't agree with plan.
                if (currentCondition != null && (currentCondition.Destination - Goal.Destination).magnitude <= Goal.AdmissibleDistance)
                {
                    goalStatus = GoalStatus.Active;
                    return;
                }
                if (chosenAbility == null)
                {
                    goalStatus = GoalStatus.Failed;
                    return;
                }
                var abilityUsage = new MotionUsageAction(chosenAbility, Goal.Destination);
                owner.PlanAction(abilityUsage);
                goalStatus = GoalStatus.Active;
                return;
            }
            else
            {
                // Plan path.
                if (plannedPath == null)
                {
                    var path = context.Layout.TryFindShortestPath(currentNode, destinationNode);
                    if (path == null)
                    {
                        goalStatus = GoalStatus.Failed;
                        return;
                    }
                    plannedPath = new Stack <Vector2Int>(path);
                }

                // Check if next path node is reached.
                var nextNode = plannedPath.Peek();
                if (currentNode == nextNode)
                {
                    plannedPath.Pop();
                    nextNode = plannedPath.Peek();
                }

                // Use motion ability if condition doesn't agree with plan.
                var nextPosition = Positions.NodeToWorld(nextNode, context.Map[nextNode].Height);
                if (currentCondition != null && (currentCondition.Destination - nextPosition).magnitude <= 0.1f)
                {
                    goalStatus = GoalStatus.Active;
                    return;
                }
                if (chosenAbility == null)
                {
                    goalStatus = GoalStatus.Failed;
                    return;
                }
                var abilityUsage = new MotionUsageAction(chosenAbility, nextPosition);
                owner.PlanAction(abilityUsage);
                goalStatus = GoalStatus.Active;
                return;
            }
        }
コード例 #24
0
 public bool HasOpenPosition(string ticker)
 {
     return(Positions.SingleOrDefault(x => x.Ticker == ticker && x.IsOpen) != null);
 }
コード例 #25
0
 public async Task Create(Positions positions)
 {
     _db.Add(positions);
     await _db.SaveChangesAsync();
 }
コード例 #26
0
        protected override void OnBar()
        {
            double Bid   = Symbol.Bid;
            double Ask   = Symbol.Ask;
            double Point = Symbol.TickSize;

            var cBotPositions = Positions.FindAll(cBotLabel);

            if (cBotPositions.Length > MaxPositions)
            {
                return;
            }


            int latest_bar = MarketSeries.Close.Count - 1;
            // Latest bar index
            // Chinkou/Price Cross
            double ChinkouSpanLatest = Ichimoku.ChikouSpan[latest_bar - (Kijun + 1)];
            // Latest closed bar with Chinkou.
            double ChinkouSpanPreLatest = Ichimoku.ChikouSpan[latest_bar - (Kijun + 2)];

            // Bar older than latest closed bar with Chinkou.
            // Bullish entry condition
            if ((ChinkouSpanLatest > MarketSeries.Close[latest_bar - (Kijun + 1)]) && (ChinkouSpanPreLatest <= MarketSeries.Close[latest_bar - (Kijun + 2)]))
            {
                ChinkouPriceBull = true;
                ChinkouPriceBear = false;
            }
            // Bearish entry condition
            else if ((ChinkouSpanLatest < MarketSeries.Close[latest_bar - (Kijun + 1)]) && (ChinkouSpanPreLatest >= MarketSeries.Close[latest_bar - (Kijun + 2)]))
            {
                ChinkouPriceBull = false;
                ChinkouPriceBear = true;
            }
            // Voiding entry conditions if cross is ongoing.
            else if (ChinkouSpanLatest == MarketSeries.Close[latest_bar - (Kijun + 1)])
            {
                ChinkouPriceBull = false;
                ChinkouPriceBear = false;
            }

            // Kumo confirmation. When cross is happening current price (latest close) should be above/below both Senkou Spans, or price should close above/below both Senkou Spans after a cross.
            double SenkouSpanALatestByPrice = Ichimoku.SenkouSpanA[latest_bar - 1];
            // Senkou Span A at time of latest closed price bar.
            double SenkouSpanBLatestByPrice = Ichimoku.SenkouSpanB[latest_bar - 1];

            // Senkou Span B at time of latest closed price bar.
            if ((MarketSeries.Close[latest_bar - 1] > SenkouSpanALatestByPrice) && (MarketSeries.Close[latest_bar - 1] > SenkouSpanBLatestByPrice))
            {
                KumoBullConfirmation = true;
            }
            else
            {
                KumoBullConfirmation = false;
            }
            if ((MarketSeries.Close[latest_bar - 1] < SenkouSpanALatestByPrice) && (MarketSeries.Close[latest_bar - 1] < SenkouSpanBLatestByPrice))
            {
                KumoBearConfirmation = true;
            }
            else
            {
                KumoBearConfirmation = false;
            }

            // Kumo/Chinkou confirmation. When cross is happening Chinkou at its latest close should be above/below both Senkou Spans at that time, or it should close above/below both Senkou Spans after a cross.
            double SenkouSpanALatestByChinkou = Ichimoku.SenkouSpanA[latest_bar - (Kijun + 1)];
            // Senkou Span A at time of latest closed bar of Chinkou span.
            double SenkouSpanBLatestByChinkou = Ichimoku.SenkouSpanB[latest_bar - (Kijun + 1)];

            // Senkou Span B at time of latest closed bar of Chinkou span.
            if ((ChinkouSpanLatest > SenkouSpanALatestByChinkou) && (ChinkouSpanLatest > SenkouSpanBLatestByChinkou))
            {
                KumoChinkouBullConfirmation = true;
            }
            else
            {
                KumoChinkouBullConfirmation = false;
            }
            if ((ChinkouSpanLatest < SenkouSpanALatestByChinkou) && (ChinkouSpanLatest < SenkouSpanBLatestByChinkou))
            {
                KumoChinkouBearConfirmation = true;
            }
            else
            {
                KumoChinkouBearConfirmation = false;
            }

            GetPositionStates();

            if (ChinkouPriceBull)
            {
                if (HaveShortPosition)
                {
                    ClosePrevious();
                }
                if ((KumoBullConfirmation) && (KumoChinkouBullConfirmation))
                {
                    ChinkouPriceBull = false;
                    fBuy();
                }
            }
            else if (ChinkouPriceBear)
            {
                if (HaveLongPosition)
                {
                    ClosePrevious();
                }
                if ((KumoBearConfirmation) && (KumoChinkouBearConfirmation))
                {
                    fSell();
                    ChinkouPriceBear = false;
                }

                // Trailing Stop for all positions
                SetTrailingStop();
            }
        }
コード例 #27
0
//When each tabs are opened
        private void stafftab_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (stafftab.SelectedTab == employees)
            {
                st_emp_ps_dgv_employees.DataSource = mcm.loadEmployees();
                st_emp_ea_dgv_emp.DataSource       = mcm.loadGridView("SELECT EmployeeID,Name FROM Employee");

                String d = DateTime.Today.Date.ToString("yyyy-MM-dd");
                string q = "SELECT * FROM Attendance WHERE Date = '" + d + "'";
                st_emp_ea_dgv_attendance.DataSource = mcm.loadGridView(q);

                st_emp_ea_cb_position.Items.Clear();
                Positions pos = new Positions();
                st_emp_ea_cb_position.Items.Add("All");
                pos.posNames = mcm.AttendancePositionCB();
                for (int i = 0; i < pos.posNames.Length; i++)
                {
                    st_emp_ea_cb_position.Items.Add(pos.posNames[i]);
                }
                st_emp_ea_cb_position.SelectedValue = "";
            }

            else if (stafftab.SelectedTab == allowances)
            {
                string q = "SELECT a.AllowanceID,a.Name as Allowance_Name,p.PosName as Position,pa.Amount FROM Allowances a,Position p, Position_Allowance pa WHERE pa.AllowanceID = a.AllowanceID and pa.PositionID = p.PositionID ORDER BY a.AllowanceID";
                st_alw_v_dgv_allowances.DataSource = mcm.loadGridView(q);

                String q2 = "SELECT * FROM Allowances";
                st_alw_aa_dgv_allowances.DataSource = mcm.loadGridView(q2);

                st_alw_fa_cb_position.DropDownStyle   = ComboBoxStyle.DropDownList;
                st_alw_fa_cb_allowances.DropDownStyle = ComboBoxStyle.DropDownList;
            }
            else if (stafftab.SelectedTab == overtime)
            {
                string q = "SELECT * FROM OT";
                st_ot_vr_dgv_otemp.DataSource = mcm.loadGridView(q);

                string q2 = "SELECT PosName,OTRate FROM Position";
                st_ot_vr_dgv_otrates.DataSource = mcm.loadGridView(q2);

                st_ot_aoth_dtp_date.MaxDate = DateTime.Now;
            }
            else if (stafftab.SelectedTab == positiontab)
            {
                string q = "SELECT * FROM Position";
                st_pos_view_dgv_positions.DataSource = mcm.loadGridView(q);
            }
            else if (stafftab.SelectedTab == leave)
            {
                string q = "SELECT EmployeeID,StartDate,EndDate,Duration,LeaveType,ApproveStatus FROM Leave ";
                st_le_vl_dgv_leaves.DataSource = mcm.loadGridView(q);

                st_le_al_dtp_start.MinDate = DateTime.Today.AddDays(1);
                st_le_al_dtp_end.MinDate   = st_le_al_dtp_start.Value;
                st_le_al_dtp_end.MaxDate   = DateTime.Today.AddMonths(6);

                int currentYear = DateTime.Today.Year;
                for (int i = 2000; i <= currentYear; i++)
                {
                    st_le_vl_cb_year.Items.Add(i);
                }
            }
        }
コード例 #28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <param name="_location"></param>
 public void SetLocation(int geomIndex, Positions posIndex, Location _location)
 {
     elt[geomIndex].SetLocation(posIndex, _location);
 }
コード例 #29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public  Location GetLocation(int geomIndex, Positions posIndex) 
 { 
     return elt[geomIndex].Get(posIndex); 
 }
コード例 #30
0
        protected override void OnBar()
        {
            var cBotPositions = Positions.FindAll(cBotLabel);

            if (Trade.IsExecuting)
            {
                return;
            }

            var  currentHours = Server.Time.TimeOfDay.TotalHours;
            bool tradeTime = StartTime <StopTime?currentHours> StartTime && currentHours < StopTime : currentHours <StopTime || currentHours> StartTime;

            if (!tradeTime)
            {
                return;
            }

            if (cBotPositions.Length > MaxPositions)
            {
                return;
            }

            var longPosition  = Positions.Find(cBotLabel, Symbol, TradeType.Buy);
            var shortPosition = Positions.Find(cBotLabel, Symbol, TradeType.Sell);

            var currenthmaslow  = hmaslow.hmaslow.Last(0);
            var currenthmafast  = hmafast.hmafast.Last(0);
            var previoushmaslow = hmaslow.hmaslow.Last(1);
            var previoushmafast = hmafast.hmafast.Last(1);

            double i = hmaSignal.hma.LastValue;

            if (currenthmafast > previoushmafast && hmaSignal.IsBullish)
            {
                fBuy();
            }
            else if (currenthmafast < previoushmafast && hmaSignal.IsBearish)
            {
                fSell();
            }
            {
                // Trailing Stop for all positions
                SetTrailingStop();
            }

            // Some condition to open extra position
            foreach (var position in cBotPositions)
            {
                if (position.Label == cBotLabel && position.SymbolCode == Symbol.Code)
                {
                    if (position.TradeType == TradeType.Buy)
                    {
                        if (Math.Round(Symbol.Ask, Symbol.Digits) < Math.Round(D_TD(TradeType.Buy) - PipStep * Symbol.PipSize, Symbol.Digits))
                        {
                            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, cBotLabel, StopLoss, TakeProfit);
                        }

                        else if (position.TradeType == TradeType.Sell)
                        {
                            if (Math.Round(Symbol.Bid, Symbol.Digits) > Math.Round(U_TD(TradeType.Sell) + PipStep * Symbol.PipSize, Symbol.Digits))
                            {
                                ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, cBotLabel, StopLoss, TakeProfit);
                            }
                        }
                    }
                }
            }
        }
コード例 #31
0
ファイル: Depth.cs プロジェクト: ExRam/DotSpatial-PCL
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public int GetDepth(int geomIndex, Positions posIndex)
 {
     return depth[geomIndex, (int)posIndex];
 }
コード例 #32
0
ファイル: Depth.cs プロジェクト: ExRam/DotSpatial-PCL
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <param name="location"></param>
 public void Add(int geomIndex, Positions posIndex, Locations location)
 {
     if (location == Locations.Interior)
         depth[geomIndex, (int)posIndex]++;
 }
コード例 #33
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="locIndex"></param>
 /// <param name="locValue"></param>
 public void SetLocation(Positions locIndex, Locations locValue)
 {
     location[(int)locIndex] = locValue;
 }
コード例 #34
0
ファイル: Juggernaut.cs プロジェクト: ajmal017/cBots
 private Position CurrentPosition()
 {
     return(Positions.Find(_instanceLabel));
 }
コード例 #35
0
 public Position GetEarliestJob()
 {
     _ = Positions ?? throw new PositionsNotLoadedException();
     return(Positions.OrderByDescending(p => p.Start).FirstOrDefault());
 }
コード例 #36
0
 public Person(Positions position, string name)
 {
     this.position = position;
     this.Name     = name;
 }
コード例 #37
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public Location GetLocation(int geomIndex, Positions posIndex)
 {
     return(elt[geomIndex].Get(posIndex));
 }
コード例 #38
0
        /// <summary>
        /// This method handles the degenerate cases of single points and lines,
        /// as well as rings.
        /// </summary>
        /// <returns>A Coordinate array representing the curve<br/>
        /// or <c>null</c> if the curve is empty</returns>
        public Coordinate[] GetRingCurve(Coordinate[] inputPts, Positions side, double distance)
        {
            _distance = distance;
            if (inputPts.Length <= 2)
                return GetLineCurve(inputPts, distance);

            // optimize creating ring for for zero distance
            if (distance == 0.0)
            {
                return CopyCoordinates(inputPts);
            }
            OffsetSegmentGenerator segGen = GetSegmentGenerator(distance);
            ComputeRingBufferCurve(inputPts, side, segGen);
            return segGen.GetCoordinates();
        }
コード例 #39
0
ファイル: JointStates.cs プロジェクト: Xamla/graph_system
 /// <summary>
 /// Returns a human readable representation of the <c>JointStates</c> values.
 /// </summary>
 public override string ToString() =>
 $"Positions: {Positions?.ToString() ?? "null"}; Velocities: {Velocities?.ToString() ?? "null"}; Efforts: {Efforts?.ToString() ?? "null"};";
コード例 #40
0
        public BinaryFormat Convert(FAD source)
        {
            source.Containers.Clear();
            //Updating files
            foreach (var child in Navigator.IterateNodes(Container))
            {
                byte[] temp = new byte[(int)child.Stream.Length];
                child.Stream.Read(temp, 0, (int)child.Stream.Length);
                source.Containers.Add(temp);
            }

            //Generate the exported file
            var writer = new DataWriter(Binary.Stream);

            //Write the header
            writer.Write(source.Header);

            //Write the files
            for (int i = 0; i < source.ImagesCount; i++)
            {
                //Add the position
                Positions.Add((uint)writer.Stream.Position);

                //Write the file header
                writer.Write(source.ContainerHeaders[i]);
                writer.Stream.PushCurrentPosition();

                //Write the file
                writer.Write(source.Containers[i]);
                writer.WritePadding(0, 0x10);
                Sizes.Add((uint)writer.Stream.Position - Positions[i]);



                //Updating values

                writer.Stream.PopPosition();
                writer.Stream.Position -= 0x28;
                writer.Write(Sizes[i]);
                writer.Stream.Position += 0x04;
                writer.Write(source.Containers[i].Length);
                writer.Stream.Position += (Sizes[i] - 0x14);
            }

            //Updating Header Values
            writer.Stream.Position = (0x20 * source.AnotherFilesCount) + 0x14 + 0xC;
            for (int i = 0; i < source.ImagesCount; i++)
            {
                //Skip the padding
                writer.Stream.Position += 8;

                //Write the size
                writer.Write(Sizes[i]);

                //Skip the padding
                writer.Stream.Position += 4;

                //Write the position
                writer.Write(Positions[i]);

                //Skip the padding
                writer.Stream.Position += 0xC;
            }

            return(Binary);
        }
コード例 #41
0
        protected override void OnBar()
        {
            if (UseManualStopTrade)
            {
                CloseIfPositionInLoss();
            }

            // Take profit - Close profitable positions
            foreach (var position in Positions.FindAll(Label))
            {
                if (position.Pips > pips)
                {
                    ClosePosition(position);
                }
            }

            // Open new positions
            var totalNetProfit     = Positions.FindAll(Label).Select(p => p.NetProfit).ToList().Sum();
            var totalVolumeInUnits = Positions.FindAll(Label).Select(p => p.VolumeInUnits).Sum();
            var openPositions      = Positions.FindAll(Label).Length;

            if (Positions.FindAll(Label).Length < noOfLivePositions &&
                totalNetProfit > MaxTotalNetProfitLoss &&
                openPositions < MaxOpenPositionsForSymbol &&
                totalVolumeInUnits < MaxTotalVolumeInUnits)
            {
                MakeBuySellOrder(Volume);
            }

            // Update buy count / update sell count
            //int buyCount = 0;
            //int sellCount = 0;
            //foreach (var position in Positions.FindAll(Label))
            //{
            //    if (position.TradeType == TradeType.Buy)
            //        buyCount++;
            //    if (position.TradeType == TradeType.Sell)
            //        sellCount++;
            //}

            // If no positions - up the volume and pip size (why??)
            //if (buyCount == 0 || sellCount == 0)
            //{
            //    if (Volume < MaxVolume)
            //    {
            //        Volume += 1000;
            //    }
            //    //noOfLivePositions += 2;
            //    pips++;

            //    MakeBuySellOrder(Volume);
            //}

            // TODO: if can make buy order - rsi, count of buy < max buy, buy volume < maxvolume, is buy in loss
            // TODO: if can make sell order

            // Close out and start again if account high ?????
            if (Account.Equity > _equity + Account.Equity / 100)
            {
                foreach (var position in Positions.FindAll(Label))
                {
                    ClosePosition(position);
                }
                _equity = Account.Equity;
                Volume  = 1000;
                //noOfLivePositions = 4;
                pips = 2;

                MakeBuySellOrder(Volume);
            }
        }
コード例 #42
0
ファイル: MeshIntegrator.cs プロジェクト: vrm-c/UniVRM
        public MeshIntegrationResult Integrate(MeshEnumerateOption onlyBlendShapeRenderers)
        {
            var mesh = new Mesh();

            if (Positions.Count > ushort.MaxValue)
            {
                Debug.LogFormat("exceed 65535 vertices: {0}", Positions.Count);
                mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
            }

            mesh.vertices     = Positions.ToArray();
            mesh.normals      = Normals.ToArray();
            mesh.uv           = UV.ToArray();
            mesh.tangents     = Tangents.ToArray();
            mesh.boneWeights  = BoneWeights.ToArray();
            mesh.subMeshCount = SubMeshes.Count;
            for (var i = 0; i < SubMeshes.Count; ++i)
            {
                mesh.SetIndices(SubMeshes[i].Indices.ToArray(), MeshTopology.Triangles, i);
            }
            mesh.bindposes = BindPoses.ToArray();

            // blendshape
            switch (onlyBlendShapeRenderers)
            {
            case MeshEnumerateOption.OnlyWithBlendShape:
            {
                AddBlendShapesToMesh(mesh);
                mesh.name = INTEGRATED_MESH_WITH_BLENDSHAPE_NAME;
                break;
            }

            case MeshEnumerateOption.All:
            {
                AddBlendShapesToMesh(mesh);
                mesh.name = INTEGRATED_MESH_ALL_NAME;
                break;
            }

            case MeshEnumerateOption.OnlyWithoutBlendShape:
            {
                mesh.name = INTEGRATED_MESH_WITHOUT_BLENDSHAPE_NAME;
                break;
            }
            }

            // meshName
            var meshNode = new GameObject();

            switch (onlyBlendShapeRenderers)
            {
            case MeshEnumerateOption.OnlyWithBlendShape:
            {
                meshNode.name = INTEGRATED_MESH_WITH_BLENDSHAPE_NAME;
                break;
            }

            case MeshEnumerateOption.OnlyWithoutBlendShape:
            {
                meshNode.name = INTEGRATED_MESH_WITHOUT_BLENDSHAPE_NAME;
                break;
            }

            case MeshEnumerateOption.All:
            {
                meshNode.name = INTEGRATED_MESH_ALL_NAME;
                break;
            }
            }

            var integrated = meshNode.AddComponent <SkinnedMeshRenderer>();

            integrated.sharedMesh      = mesh;
            integrated.sharedMaterials = SubMeshes.Select(x => x.Material).ToArray();
            integrated.bones           = Bones.ToArray();
            Result.IntegratedRenderer  = integrated;
            Result.MeshMap.Integrated  = mesh;
            return(Result);
        }
コード例 #43
0
        protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            base.OnPropertyChanged(propertyName);

            switch (propertyName)
            {
            case nameof(Positions):
                ((Mapsui.Geometries.Polygon)Feature.Geometry).ExteriorRing = new LinearRing(Positions.Select(p => p.ToMapsui()).ToList());
                break;

            case nameof(Holes):
                ((Mapsui.Geometries.Polygon)Feature.Geometry).InteriorRings = Holes.Select(h => new LinearRing(h.Select(p => p.ToMapsui()).ToList())).ToList();
                break;

            case nameof(FillColor):
                ((VectorStyle)Feature.Styles.First()).Fill = new Brush(FillColor.ToMapsui());
                break;

            case nameof(StrokeColor):
                ((VectorStyle)Feature.Styles.First()).Outline.Color = StrokeColor.ToMapsui();
                break;

            case nameof(StrokeWidth):
                ((VectorStyle)Feature.Styles.First()).Outline.Width = StrokeWidth;
                break;
            }
        }
コード例 #44
0
ファイル: PositionBUS.cs プロジェクト: thanhtai113/test
 public static Positions insert(Positions pos)
 {
     return(pos_act.insert(pos));
 }
コード例 #45
0
 public Manager(Positions position, string name) : base(position, name)
 {
 }
コード例 #46
0
ファイル: PositionBUS.cs プロジェクト: thanhtai113/test
 public static void edit(Positions pos)
 {
     pos_act.edit(pos);
 }
コード例 #47
0
ファイル: PositionBUS.cs プロジェクト: thanhtai113/test
 public static void delete(Positions pos)
 {
     pos_act.delete(pos);
 }
コード例 #48
0
 public bool Contains(Vector3 other)
 {
     return(Positions.Contains(other));
 }
コード例 #49
0
ファイル: SimAccount.cs プロジェクト: w1r2p1/Core-1
 public void OnFill(Trade t)
 {
     Positions.GotFill(t);
     _mutations = Positions.TotalClosedPL;
 }
コード例 #50
0
ファイル: Cylinder.cs プロジェクト: st1310/masgk
        private void GenerateCap(bool top, ref int index, ref List <List <int> > indexArray, ref float halfHeight)
        {
            // save the index of the first center vertex
            int centerIndexStart = index;

            Float3 uv     = new();
            Float3 vertex = new();

            float radius = top ? radiusTop : radiusBottom;
            float sign   = top ? 1.0f : -1.0f;

            // first we generate the center vertex data of the cap.
            // because the geometry needs one set of uvs per face,
            // we must generate a center vertex per face/segment
            for (int x = 1; x <= radialSegments; x++)
            {
                // vertex
                Positions.Add(new(0.0f, halfHeight * sign, 0.0f));

                // normal
                Normals.Add(new(0.0f, sign, 0.0f));

                // uv
                TextureCoordinates.Add(new(0.5f, 0.5f, 0.0f));

                // increase index
                index++;
            }

            // save the index of the last center vertex
            int centerIndexEnd = index;

            // now we generate the surrounding vertices, normals and uvs
            for (int x = 0; x <= radialSegments; x++)
            {
                float  u     = (float)x / radialSegments;
                double theta = u * thetaLength + thetaStart;

                double cosTheta = Math.Cos(theta);
                double sinTheta = Math.Sin(theta);

                // vertex
                vertex.X = (float)(radius * sinTheta);
                vertex.Y = halfHeight * sign;
                vertex.Z = (float)(radius * cosTheta);
                Positions.Add(vertex);

                // normal
                Normals.Add(new(0.0f, sign, 0.0f));

                // uv
                uv.X = (float)((cosTheta * 0.5) + 0.5);
                uv.Y = (float)((sinTheta * 0.5 * sign) + 0.5);
                TextureCoordinates.Add(uv);

                // increase index
                index++;
            }

            // generate indices
            for (int x = 0; x < radialSegments; x++)
            {
                int c = centerIndexStart + x;
                int i = centerIndexEnd + x;

                if (top)
                {
                    // face top
                    Indices.Add(c);
                    Indices.Add(i + 1);
                    Indices.Add(i);
                }
                else
                {
                    // face bottom
                    Indices.Add(c);
                    Indices.Add(i);
                    Indices.Add(i + 1);
                }
            }
        }
コード例 #51
0
ファイル: Depth.cs プロジェクト: ExRam/DotSpatial-PCL
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public bool IsNull(int geomIndex, Positions posIndex)
 {
     return depth[geomIndex,(int)posIndex] == Null;
 }
コード例 #52
0
        /// <summary>Called when new data is received</summary>
        public override void Step()
        {
            base.Step();
            if (!Instrument.NewCandle)
            {
                return;
            }

            var mcs = Instrument.MCS;

            // If there is an existing position, wait for it to close
            if (Positions.Count() >= MaxPositions)
            {
                return;
            }

            // If there is no price channel
            if (Channel == null)
            {
                return;
            }

            // Cancel any pending orders and replace them with new ones based on this channel
            Broker.CancelAllPendingOrders(Label);

            Dump();

            // The Channel
            var chan = Channel.Value;
            var risk = Risk / MaxPositions;
            var sign = chan.PrecedingTrendSign;

            //		// Create a pending order on the side opposite the preceding trend
            //		var ep = sign > 0 ? chan.Price.End + 0.5*mcs : chan.Price.Beg - 0.5*mcs;
            //		var sl = (QuoteCurrency?)null;//sign > 0 ? chan.Price.Beg : chan.Price.End;
            //		var tp = (QuoteCurrency?)null;//ep + sign * Math.Abs(ep - sl);
            //		var sl_rel = 5*mcs;//Math.Abs(ep - sl);
            //		var vol = Broker.ChooseVolume(Instrument, sl_rel, risk:risk);
            //		var trade = new Trade(Instrument, CAlgo.SignToTradeType(chan.PrecedingTrendSign), Label, ep, sl, tp, vol);
            //		trade.Expiration = Instrument.ExpirationTime(5);
            //		Broker.CreatePendingOrder(trade);

            // Create pending orders on either side of the channel
            {
                var ep    = chan.Price.End + 0.5 * mcs;
                var sl    = chan.Price.Beg;
                var tp    = (QuoteCurrency?)null;             // ep + chan.Price.Size * 5;
                var vol   = Broker.ChooseVolume(Instrument, Math.Abs(ep - sl), risk: risk);
                var trade = new Trade(Instrument, TradeType.Buy, Label, ep, sl, tp, vol);
                trade.Expiration = Instrument.ExpirationTime(5);
                Broker.CreatePendingOrder(trade);
            }
            {
                var ep    = chan.Price.Beg - 0.5 * mcs;
                var sl    = chan.Price.End;
                var tp    = (QuoteCurrency?)null;             // ep - chan.Price.Size * 5;
                var vol   = Broker.ChooseVolume(Instrument, Math.Abs(ep - sl), risk: risk);
                var trade = new Trade(Instrument, TradeType.Sell, Label, ep, sl, tp, vol);
                trade.Expiration = Instrument.ExpirationTime(5);
                Broker.CreatePendingOrder(trade);
            }

            // Debugging
            {
                var c = chan;
                for (; Channels.Count != 0 && c.Idx.Contains(Channels.Back().Idx);)
                {
                    Channels.PopBack();
                }
                Channels.Add(c);
            }
        }
コード例 #53
0
ファイル: Depth.cs プロジェクト: ExRam/DotSpatial-PCL
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <param name="depthValue"></param>
 public void SetDepth(int geomIndex, Positions posIndex, int depthValue)
 {
     depth[geomIndex, (int)posIndex] = depthValue;
 }
コード例 #54
0
ファイル: TazzieBot.cs プロジェクト: JMRSquared/TazzieBot
        protected override void OnTick()
        {
            if (superProfit.Entry.Count == 0 || isLooping || !Symbol.MarketHours.IsOpened())
            {
                return;
            }

            var now = DateTime.Now;

            Positions.ToList().ForEach(pos =>
            {
                if (now.Subtract(pos.EntryTime).TotalHours > 24 && pos.Pips > PIPS)
                {
                    ClosePosition(pos);
                }
            });

            if (superProfit.profitPositions.Count > 0)
            {
                isLooping = true;
                var positions = superProfit.profitPositions;

                foreach (var position in positions)
                {
                    if (now.Subtract(position.DateTime).TotalHours > 24)
                    {
                        Print("Late signal " + position.ToString());
                        continue;
                    }

                    if (((position.entryPrice > position.takeProfit || position.entryPrice < position.stopLoss) && position.type == TradeType.Buy) || ((position.entryPrice < position.takeProfit || position.entryPrice > position.stopLoss) && position.type == TradeType.Sell))
                    {
                        Print("Fails signal " + position.ToString());
                        continue;
                    }

                    Positions.Where(p => p.TradeType != position.type && p.Pips >= PIPS).ToList().ForEach(pos =>
                    {
                        Print("Floating pips => " + pos.Pips);
                        ClosePosition(pos);
                    });

                    var lastLoss = Positions.Where(p => p.TradeType == position.type).LastOrDefault();
                    if (lastLoss == null)
                    {
                        if (Positions.Count <= MAXPOSITIONS)
                        {
                            var result = ExecuteMarketOrder(position.type, Symbol, Volume, position.ToString(), null, Math.Round((double)position.takeProfit));
                        }
                    }
                    else
                    {
                        if (lastLoss.Pips < 0)
                        {
                            if (position.type == TradeType.Buy)
                            {
                                if (position.stopLoss < Symbol.Bid && position.takeProfit > Symbol.Bid)
                                {
                                    ModifyPosition(lastLoss, position.stopLoss, position.takeProfit);
                                }
                                else
                                {
                                    Print("Trying to buy too late .... buying at " + Symbol.Bid + " from signal : " + position.ToString());
                                }
                            }

                            if (position.type == TradeType.Sell)
                            {
                                if (position.stopLoss > Symbol.Ask && position.takeProfit < Symbol.Ask)
                                {
                                    ModifyPosition(lastLoss, position.stopLoss, position.takeProfit);
                                }
                                else
                                {
                                    Print("Trying to sell too late .... selling at " + Symbol.Bid + " from signal : " + position.ToString());
                                }
                            }
                        }
                        else if (lastLoss.Pips >= PIPS)
                        {
                            ClosePosition(lastLoss);
                            if (Positions.Count <= MAXPOSITIONS)
                            {
                                var result = ExecuteMarketOrder(position.type, Symbol, Volume, position.ToString(), Math.Round((double)position.stopLoss), Math.Round((double)position.takeProfit));
                            }
                        }
                    }
                }
                superProfit.profitPositions.Clear();
                isLooping = false;
            }
        }
コード例 #55
0
ファイル: Depth.cs プロジェクト: ExRam/DotSpatial-PCL
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <returns></returns>
 public Locations GetLocation(int geomIndex, Positions posIndex)
 {
     if (depth[geomIndex, (int)posIndex] <= 0) 
         return Locations.Exterior;
     return Locations.Interior;
 }
コード例 #56
0
    Calibration CalibrationWindow; // = new Calibration();

    MainWindow()
    {
        Vars              = new Model(this);
        Positions         = new Positions(this);
        CalibrationWindow = new Calibration(this);
    }
コード例 #57
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="posIndex"></param>
 /// <param name="_location"></param>
 public  void SetLocation(int geomIndex, Positions posIndex, Location _location)
 {
     elt[geomIndex].SetLocation(posIndex, _location);
 }
コード例 #58
0
ファイル: MeshIntegrator.cs プロジェクト: vrm-c/UniVRM
        public void Push(MeshRenderer renderer)
        {
            var meshFilter = renderer.GetComponent <MeshFilter>();

            if (meshFilter == null)
            {
                Debug.LogWarningFormat("{0} has no mesh filter", renderer.name);
                return;
            }
            var mesh = meshFilter.sharedMesh;

            if (mesh == null)
            {
                Debug.LogWarningFormat("{0} has no mesh", renderer.name);
                return;
            }
            Result.SourceMeshRenderers.Add(renderer);
            Result.MeshMap.Sources.Add(mesh);

            var indexOffset     = Positions.Count;
            var boneIndexOffset = Bones.Count;

            Positions.AddRange(mesh.vertices
                               .Select(x => renderer.transform.TransformPoint(x))
                               );
            Normals.AddRange(mesh.normals
                             .Select(x => renderer.transform.TransformVector(x))
                             );
            UV.AddRange(mesh.uv);
            Tangents.AddRange(mesh.tangents
                              .Select(t =>
            {
                var v = renderer.transform.TransformVector(t.x, t.y, t.z);
                return(new Vector4(v.x, v.y, v.z, t.w));
            })
                              );

            var self = renderer.transform;
            var bone = self.parent;

            if (bone == null)
            {
                Debug.LogWarningFormat("{0} is root gameobject.", self.name);
                return;
            }
            var bindpose = bone.worldToLocalMatrix;

            BoneWeights.AddRange(Enumerable.Range(0, mesh.vertices.Length)
                                 .Select(x => new BoneWeight()
            {
                boneIndex0 = Bones.Count,
                weight0    = 1,
            })
                                 );

            BindPoses.Add(bindpose);
            Bones.Add(bone);

            for (int i = 0; i < mesh.subMeshCount && i < renderer.sharedMaterials.Length; ++i)
            {
                var indices = mesh.GetIndices(i).Select(x => x + indexOffset);
                var mat     = renderer.sharedMaterials[i];
                var sameMaterialSubMeshIndex = SubMeshes.FindIndex(x => ReferenceEquals(x.Material, mat));
                if (sameMaterialSubMeshIndex >= 0)
                {
                    SubMeshes[sameMaterialSubMeshIndex].Indices.AddRange(indices);
                }
                else
                {
                    SubMeshes.Add(new SubMesh
                    {
                        Indices  = indices.ToList(),
                        Material = mat,
                    });
                }
            }
        }
コード例 #59
0
        private void ComputeRingBufferCurve(Coordinate[] inputPts, Positions side, OffsetSegmentGenerator segGen)
        {
            // simplify input line to improve performance
            var distTol = SimplifyTolerance(_distance);
            // ensure that correct side is simplified
            if (side == Positions.Right)
                distTol = -distTol;
            var simp = BufferInputLineSimplifier.Simplify(inputPts, distTol);
            // MD - used for testing only (to eliminate simplification)
            // Coordinate[] simp = inputPts;

            var n = simp.Length - 1;
            segGen.InitSideSegments(simp[n - 1], simp[0], side);
            for (var i = 1; i <= n; i++)
            {
                var addStartPoint = i != 1;
                segGen.AddNextSegment(simp[i], addStartPoint);
            }
            segGen.CloseRing();
        }
コード例 #60
0
ファイル: MeshIntegrator.cs プロジェクト: vrm-c/UniVRM
        public void Push(SkinnedMeshRenderer renderer)
        {
            var mesh = renderer.sharedMesh;

            if (mesh == null)
            {
                Debug.LogWarningFormat("{0} has no mesh", renderer.name);
                return;
            }
            Result.SourceSkinnedMeshRenderers.Add(renderer);
            Result.MeshMap.Sources.Add(mesh);

            var indexOffset     = Positions.Count;
            var boneIndexOffset = Bones.Count;

            Positions.AddRange(mesh.vertices);
            Normals.AddRange(mesh.normals);
            UV.AddRange(mesh.uv);
            Tangents.AddRange(mesh.tangents);

            if (mesh.vertexCount == mesh.boneWeights.Length)
            {
                BoneWeights.AddRange(mesh.boneWeights.Select(x => AddBoneIndexOffset(x, boneIndexOffset)).ToArray());
                BindPoses.AddRange(mesh.bindposes);
                Bones.AddRange(renderer.bones);
            }
            else
            {
                // Bone Count 0 уБо SkinnedMeshRenderer
                var rigidBoneWeight = new BoneWeight
                {
                    boneIndex0 = boneIndexOffset,
                    weight0    = 1f,
                };
                BoneWeights.AddRange(Enumerable.Range(0, mesh.vertexCount).Select(x => rigidBoneWeight).ToArray());
                BindPoses.Add(renderer.transform.localToWorldMatrix);
                Bones.Add(renderer.transform);
            }

            for (int i = 0; i < mesh.subMeshCount && i < renderer.sharedMaterials.Length; ++i)
            {
                var indices = mesh.GetIndices(i).Select(x => x + indexOffset);
                var mat     = renderer.sharedMaterials[i];
                var sameMaterialSubMeshIndex = SubMeshes.FindIndex(x => ReferenceEquals(x.Material, mat));
                if (sameMaterialSubMeshIndex >= 0)
                {
                    SubMeshes[sameMaterialSubMeshIndex].Indices.AddRange(indices);
                }
                else
                {
                    SubMeshes.Add(new SubMesh
                    {
                        Indices  = indices.ToList(),
                        Material = mat,
                    });
                }
            }

            for (int i = 0; i < mesh.blendShapeCount; ++i)
            {
                var positions = (Vector3[])mesh.vertices.Clone();
                var normals   = (Vector3[])mesh.normals.Clone();
                var tangents  = mesh.tangents.Select(x => (Vector3)x).ToArray();

                mesh.GetBlendShapeFrameVertices(i, 0, positions, normals, tangents);
                BlendShapes.Add(new BlendShape
                {
                    VertexOffset = indexOffset,
                    FrameWeight  = mesh.GetBlendShapeFrameWeight(i, 0),
                    Name         = mesh.GetBlendShapeName(i),
                    Positions    = positions,
                    Normals      = normals,
                    Tangents     = tangents,
                });
            }
        }