상속: TableServiceEntity, Imust
예제 #1
0
 public void SetValue(TA t, string value)
 {
     Value = value;
     State = Func(t, value)
         ? State.Set
         : State.Invalid;
 }
            /// <summary>
            ///  Sets <paramref name="ta"/> in the given <paramref name="hdc"/> using <see cref="SetTextAlign(HDC, TA)"/>.
            /// </summary>
            public SetTextAlignmentScope(HDC hdc, TA ta)
            {
                _previousTa = SetTextAlign(hdc, ta);

                // If we didn't actually change the TA, don't keep the HDC so we skip putting back the same state.
                _hdc = _previousTa == ta ? default : hdc;
            }
예제 #3
0
    /// <summary>显示在中间的提示框 </summary>
    public void ShowCenterTips(string content, float timer, Color color)
    {
        mTipPos = TipPosType.Center;
        CacheTrans.localPosition   = new Vector3(0, 200, 0);
        ChildGoTrans.localPosition = new Vector3(-1, -205, 0);
        ChildGoTrans.localScale    = Vector3.one;
        if (!Spirte.gameObject.activeSelf)
        {
            Spirte.gameObject.SetActive(true);
        }
        TipsLb.text  = content;
        TipsLb.color = color;

        TA.duration = timer;

        Timer.Instance.SetSchedule(timer, (s) =>
        {
            TweenAlpha.Begin(gameObject, 1, 0);
            TA.SetOnFinished(() =>
            {
                TP.enabled = false;
                UIPool.Instance.PushUITipPanel(this);
                // DestroyImmediate(gameObject);
            });
            //if (TA != null)
            //    TA.PlayForward();
        });
        setViewLayer();
    }
        public TA GetTA(string ta, string connectionName)
        {
            Database  db        = DatabaseFactory.CreateDatabase(connectionName);
            DbCommand dbCommand = db.GetStoredProcCommand(Resources.GetAllFirmModulesResources.SP_GetTA);

            db.AddInParameter(dbCommand, Resources.GetAllFirmModulesResources.PARAM_TA, DbType.String, ta);
            TA objTA = new TA();

            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                int _ta      = dr.GetOrdinal(Resources.GetAllFirmModulesResources.PARAM_TA);
                int _type    = dr.GetOrdinal(Resources.GetAllFirmModulesResources.PARAM_TYPE);
                int _pcc     = dr.GetOrdinal(Resources.GetAllFirmModulesResources.PARAM_PCC);
                int _asigned = dr.GetOrdinal(Resources.GetAllFirmModulesResources.PARAM_ASIGNED);

                if (dr.Read())
                {
                    objTA.Code    = (dr[_ta] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_ta);
                    objTA.Type    = (dr[_type] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_type);
                    objTA.Pcc     = (dr[_pcc] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_pcc);
                    objTA.Asigned = (dr[_asigned] == DBNull.Value) ? false : dr.GetBoolean(_asigned);
                }
            }

            return(objTA);
        }
예제 #5
0
        public static TA GetTextAlign(IHandle hdc)
        {
            TA result = GetTextAlign((HDC)hdc.Handle);

            GC.KeepAlive(hdc);
            return(result);
        }
예제 #6
0
        public static TA SetTextAlign(IHandle hdc, TA align)
        {
            TA result = SetTextAlign(hdc.Handle, align);

            GC.KeepAlive(hdc);
            return(result);
        }
예제 #7
0
        public async Task <IEnumerable <TeacherAssignmentModel> > getTeacherForAssignment()
        {
            var query = await(from teacher in PIDBContext.Users
                              join userRole in PIDBContext.UserRoles on teacher.Id equals userRole.UserId
                              join role in PIDBContext.Roles on userRole.RoleId equals role.Id
                              join assignment in PIDBContext.Assignments on teacher.Id equals assignment.UserId into TA
                              from subassignment in TA.DefaultIfEmpty()
                              join area in PIDBContext.Areas on subassignment.AreaId equals area.Id into SA
                              from subarea in SA.DefaultIfEmpty()
                              where role.NormalizedName == "PROFESOR" && teacher.Status == true &&
                              (subassignment == null ? true :(subassignment.Status == true ? true : false))
                              select new TeacherAssignmentModel
            {
                Id           = teacher.Id,
                Name         = teacher.Name,
                LastName     = teacher.LastName,
                RoleName     = role.Name,
                City         = teacher.City,
                Degree       = teacher.Degree,
                Email        = teacher.Email,
                AreaId       = subassignment.AreaId,
                AreaName     = subarea.Name ?? "Sin Area",
                AssignmentId = subassignment.Id.GetValueOrDefault()
            }).AsNoTracking().ToArrayAsync();

            return(query);
        }
예제 #8
0
 public Foo(TA a, TB b, …)
 {
     …     // validate arguments
     this.a = a;
     this.b = b;
     …
 }
예제 #9
0
    public void ShowCenterMoveUpTips(string content, List <UITipsView> list, float delay, float duration, Color color)
    {
        mTipPos = TipPosType.Center;
        //避免由于上次使用时有重叠偏移动画,所以要重置位置
        ChildTP.enabled            = false;
        ChildGoTrans.localPosition = new Vector3(-1f, -190f, 0f);
        //由于有延迟所以必须先手动重置
        CacheTrans.localPosition = new Vector3(0, 290, 0);
        Panel.alpha = 1f;

        if (!Spirte.gameObject.activeSelf)
        {
            Spirte.gameObject.SetActive(true);
        }
        Spirte.width = 230;
        TipsLb.text  = content;
        TipsLb.color = color;

        Utility.PlayTweenScale(ChildTS, new Vector3(0.5f, 0.5f, 0.5f), Vector3.one, 0.1f);
        Utility.PlayTweenPosition(TP, CacheTrans.localPosition, new Vector3(0, 330, 0), duration, delay);
        Utility.PlayTweenAlpha(TA, 1f, 0f, duration, delay);

        if (list.Count > 0)
        {
            Transform  trans    = null;
            UITipsView tipsView = null;
            int        index;
            Vector3    offset;
            for (int i = 0; i < list.Count; i++)
            {
                tipsView = list[i];
                trans    = list[i].transform;
                index    = list.Count - i;
                offset   = Vector3.up * index * 30;
                if ((tipsView.CacheTrans.localPosition - CacheTrans.localPosition).y + (tipsView.ChildGoTrans.localPosition - ChildGoTrans.localPosition).y < offset.y)
                {
                    Utility.PlayTweenPosition(tipsView.ChildTP, tipsView.ChildGoTrans.localPosition, ChildGoTrans.localPosition + offset, 0.2f);
                }
            }
        }

        if (list.Contains(this))
        {
            list.Remove(this);
        }
        list.Add(this);

        TA.SetOnFinished(() =>
        {
            TP.enabled = false;
            TP.delay   = 0f;
            TA.delay   = 0f;
            if (list != null)
            {
                list.Remove(this);
            }
            UIPool.Instance.PushUITipPanel(this);
        });
        setViewLayer();
    }
예제 #10
0
     this IEnumerable <TA> a,
     IEnumerable <TB> b,
     Func <TA, TKey> selectKeyA,
     Func <TB, TKey> selectKeyB,
     TA defaultA = default(TA),
     TB defaultB = default(TB),
     IEqualityComparer <TKey> cmp = null)
 {
예제 #11
0
    static void Test()
    {
        TA ta = new TA();

        ta.list = new List <string>();
        var ptr = UnsafeOperation.GetObjectAddr(ta);
        var obj = UnsafeOperation.GetObject(ptr + 16);
    }
예제 #12
0
    private void Start()
    {
        MainScript.StartVid  = true;
        MainScript.GameStart = false;
        PlayerPrefs.SetInt("bestscore", Mathf.Max(PlayerPrefs.GetInt("bestscore"), MainScript.Score));
        text.GetComponent <Text>().text += MainScript.Score;

        var fi    = JsonConvert.DeserializeObject <ArrayList>(MainScript.List[0][MainScript.Round][1].ToString());
        var first = JsonConvert.DeserializeObject <Dictionary <string, string> >(fi[0].ToString());

        TA.GetComponent <Text>().text = first["title_ru"];
        MainScript.Score = 0;
    }
예제 #13
0
        public object BindCalendars(string action, Dictionary <string, object> extraParams)
        {
            StoreRequestParameters prms = new StoreRequestParameters(extraParams);



            List <WorkingCalendar> data = TA.GetCalendars();

            return(new
            {
                data
            });
        }
예제 #14
0
 void run_Actions()
 {
     Debug.Log("Battles are running");
     foreach (TurnAction TA in Turns)
     {
         if (TA != null)
         {
             TA.Action();
             Debug.Log(TA.c_Ship + " has attacked " + TA.t_Ship + " With " + TA.c_Wep);
             //b_Turn_Anim_Timer();
         }
         //here we can add in real animations rather than a standard turn timer
     }
 }
예제 #15
0
        static void Connecting()
        {
            if (!TA.isAnonymous("vpn.anonine.net"))
            {
                string[] asd = getCred();
                string   v   = "Anonine";
                string   u   = asd[0];
                string   p   = asd[1];

                string conPar = v + " " + u + " " + p;
                //System.Diagnostics.Process.Start("rasdial.exe", v + u + p);
                System.Diagnostics.Process.Start("rasdial.exe", conPar);
                //System.Diagnostics.Process.Start("rasdial.exe", "Anonine krigaruffe aqdymn56lk");
            }
            SendMessage(Process.GetCurrentProcess().MainWindowHandle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
            Thread.Sleep(21600000);
        }
예제 #16
0
        public async Task <TeacherAssignmentModel> getAssignment(string userId)
        {
            /*
             * var query = await(from a in PIDBContext.Assignments
             *                join ar in PIDBContext.Areas on a.AreaId equals ar.Id
             *                join u in PIDBContext.Users on a.UserId equals u.Id
             *                where a.Status == true && ar.Status == true && u.Status == true &&
             *                      u.Id == userId
             *                select new AssignmentRequestModel
             *                {
             *                    id = a.Id.GetValueOrDefault(),
             *                    nameArea = ar.Name,
             *                    nameUser = u.Name + " " + u.LastName,
             *                    areaId = ar.Id,
             *                    userId = u.Id
             *                }
             *                 ).AsNoTracking().FirstOrDefaultAsync();
             * return query;
             */
            var query = await(from teacher in PIDBContext.Users
                              join userRole in PIDBContext.UserRoles on teacher.Id equals userRole.UserId
                              join role in PIDBContext.Roles on userRole.RoleId equals role.Id
                              join assignment in PIDBContext.Assignments on teacher.Id equals assignment.UserId into TA
                              from subassignment in TA.DefaultIfEmpty()
                              join area in PIDBContext.Areas on subassignment.AreaId equals area.Id into SA
                              from subarea in SA.DefaultIfEmpty()
                              where role.NormalizedName == "PROFESOR" && teacher.Status == true && teacher.Id == userId &&
                              (subassignment == null ? true : (subassignment.Status == true ? true : false))
                              select new TeacherAssignmentModel
            {
                Id           = teacher.Id,
                Name         = teacher.Name,
                LastName     = teacher.LastName,
                RoleName     = role.Name,
                City         = teacher.City,
                Degree       = teacher.Degree,
                Email        = teacher.Email,
                AreaId       = subassignment.AreaId,
                AreaName     = subarea.Name ?? "Sin Area",
                AssignmentId = subassignment.Id.GetValueOrDefault()
            }).AsNoTracking().FirstOrDefaultAsync();

            return(query);
        }
        public TA GetTA(string pcc, string connectionName)
        {
            Database  db        = DatabaseFactory.CreateDatabase(connectionName);
            DbCommand dbCommand = db.GetStoredProcCommand(Resources.GetAllFirmMOdulesForNewUserResources.SP_GetTAForNewUser);

            db.AddInParameter(dbCommand, Resources.GetAllFirmMOdulesForNewUserResources.PARAM_PCC, DbType.String, pcc);
            TA ta = new TA();

            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                int _ta = dr.GetOrdinal(Resources.GetAllFirmMOdulesForNewUserResources.PARAM_TA);

                if (dr.Read())
                {
                    ta.Code = (dr[_ta] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_ta);
                }
            }

            return(ta);
        }
예제 #18
0
        public static TA GetTA(string ta)
        {
            TA objTA = new TA();
            GetAllFirmModulesDAL objGet = new GetAllFirmModulesDAL();

            try
            {
                try
                {
                    objTA = objGet.GetTA(ta, CommonENT.MYCTSDBSECURITY_CONNECTION);
                }
                catch
                {
                    objTA = objGet.GetTA(ta, CommonENT.MYCTSDBSECURITYBACKUP_CONNECTION);
                }
            }
            catch {}

            return(objTA);
        }
예제 #19
0
    /// <summary>显示在中间向上飘的提示框 </summary>
    public void ShowCenterMoveUpTips(string content, float timer, Color color)
    {
        mTipPos = TipPosType.Center;
        Utility.TipsList.Add(this);

        ChildGoTrans.localPosition = new Vector3(0, 80, 0);
        if (!Spirte.gameObject.activeSelf)
        {
            Spirte.gameObject.SetActive(true);
        }
        TipsLb.text  = content;
        TipsLb.color = color;

        Spirte.width = 230;

        TweenAlpha ta = this.GetComponent <TweenAlpha>();

        ta.duration             = 1f;
        ChildGoTrans.localScale = new Vector3(0.5f, 0.5f, 0.5f);

        Vector3 childPos = ChildGoTrans.localPosition;

        TweenScale.Begin(ChildGo, 0.1f, new Vector3(1, 1, 1));
        TweenPosition.Begin(ChildGo, 0.1f, new Vector3(0, childPos.y + 20f, 0f));

        Timer.Instance.SetSchedule(1f, (s) =>
        {
            TweenPosition.Begin(ChildGo, 1f, new Vector3(0, 120, 0));
            TweenAlpha.Begin(gameObject, 1, 0);
            TA.SetOnFinished(() =>
            {
                ChildTP.enabled = false;
                ChildTS.enabled = false;
                TP.enabled      = false;
                Utility.TipsList.Remove(this);
                UIPool.Instance.PushUITipPanel(this);
            });
        });
        setViewLayer();
    }
        public static TA GetTA(string pcc)
        {
            TA ta = new TA();
            GetAllFirmModulesForNewUserDAL objGetTA = new GetAllFirmModulesForNewUserDAL();

            try
            {
                try
                {
                    ta = objGetTA.GetTA(pcc, CommonENT.MYCTSDBSECURITY_CONNECTION);
                }
                catch
                {
                    ta = objGetTA.GetTA(pcc, CommonENT.MYCTSDBSECURITYBACKUP_CONNECTION);
                }
            }
            catch
            {
            }

            return(ta);
        }
예제 #21
0
 public void ImmediatelyBeginAlpha(bool flag = false)
 {
     if (mSchedule != null)
     {
         Timer.Instance.RemoveSchedule(mSchedule);
     }
     TA.SetOnFinished(() =>
     {
         TP.enabled = false;
         UIPool.Instance.PushUITipPanel(this);
         if (!flag)
         {
             Utility.TipsList.Remove(this);
         }
         else
         {
             Utility.GameTipsList.Remove(this);
         }
     });
     TA.ResetToBeginning();
     TA.duration = 0;
     TA.PlayForward();
 }
        /// <summary>
        /// Handles the TextChanged event of the txtTA control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The event<see cref="System.EventArgs"/> instance containing the event data.</param>
        private void txtTA_TextChanged(object sender, EventArgs e)
        {
            if (txtTA.Text.Length == 6)
            {
                TA ta = GetAllFirmModulesBL.GetTA(txtTA.Text);

                if (!string.IsNullOrEmpty(ta.Code))
                {
                    txtTA.Text   = ta.Code;
                    cmbType.Text = ta.Type;
                    txtPCC.Text  = ta.Pcc;
                    cmbType.Focus();
                }
                else
                {
                    MessageBox.Show("El número de TA no existe, debe ser dado de alta", Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtTA.Text   = string.Empty;
                    cmbType.Text = string.Empty;
                    txtPCC.Text  = string.Empty;
                    cmbType.Focus();
                }
            }
        }
예제 #23
0
    // Start is called before the first frame update
    void Start()
    {
        var raw = new TA()
        {
            a = 2, b = "abc"
        };

        using (var p1 = new SharedObj <TA>()) {
            Debug.Assert(p1.Count == 0);
            p1.Set(raw, n => { Debug.Log("删除!"); });
            Debug.Assert(p1.Count == 1);

            using (var p2 = p1.Share()) {
                Debug.Assert(p1.Count == 2);
                Debug.Assert(p2.Count == 2);
                p2.Tar.a = 3;
                p2.Tar.b = "456";
                Debug.Assert(p1.Tar.a == 3);
                Debug.Assert(p1.Tar.b == "456");
            }

            Debug.Assert(p1.Count == 1);
        }
    }
예제 #24
0
 public void TwitchAuthorize()
 {
     TA.TwitchAuthorize();
 }
예제 #25
0
        protected void signalPerformance(TA.PriceVolumeSeries series, double stopLoss, int maxDays, int idx, bool isBuy, double diffSell, double diffBuy, int sigDays, out Trade trade)
        {
            trade = new Trade();
            trade.isBuy = isBuy;
            trade.idx = idx;

            int count = series.Data.Count;
            TA.Candle candle = (TA.Candle)series.Data[idx];
            trade.candleEntry = candle;
            double entryPoint = candle.close;
            double close = entryPoint;
            double bestClose = close;
            bool isSell = !isBuy;
            int i;
            int days = 0;
            for (i = idx + 1; i < count; i++)
            {
                candle = (TA.Candle)series.Data[i];
                days++;
                if (signalStop(isBuy, stopLoss, maxDays, entryPoint, close, candle.close, days, bestClose))
                {
                    break;
                }
                if (isBuy && signalSell(series, idx, diffSell, sigDays))
                {
                    break;
                }
                if (isSell && signalBuy(series, idx, diffSell, sigDays))
                {
                    break;
                }
                close = candle.close;
                if (isBuy)
                {
                    if (bestClose < close) bestClose = close;
                }
                else
                {
                    if (bestClose > close) bestClose = close;
                }
            }
            double delta;
            delta = entryPoint - candle.close;
            if (isBuy) delta = -delta;

            double p = delta / entryPoint;
            trade.candleExit = candle;
            trade.entry = entryPoint;
            trade.exit = candle.close;
            trade.p = p;
            trade.days = days;
        }
예제 #26
0
 public static extern TA SetTextAlign(Gdi32.HDC hdc, TA align);
예제 #27
0
        protected void signalPerformanceOptimization(TA.PriceVolumeSeries series, double[] data, int windowSize,
            double stopLoss,
            int maxDays, double diffSell, double diffBuy, int days,
            System.Collections.Generic.List<TradeSession> bestBlocks)
        {
            Trade trade;
            System.Collections.Generic.List<Trade> trades = new System.Collections.Generic.List<Trade>(10);
            int i = 0;
            while (i < (data.Length - 1))
            {
                int idx = i + windowSize;
                TA.Candle candle = (TA.Candle)series.Data[idx];
                double p;
                if (signalSell(series, idx, diffSell, days))
                {
                    signalPerformance(series, stopLoss, maxDays, idx, false, diffSell, diffBuy, days, out trade);
                    if (trades.Count < 200) trades.Add(trade);
                    else break;
                    i += Math.Max(1, trade.days);
                    //                        System.Console.Write("\tSell at "+idx+" entry="+trade.entry+" exit="+trade.exit+" "+candle.ToString());
                    //                        System.Console.WriteLine(" p="+trade.p+", days="+trade.days+", exit at "+(idx+trade.days));
                }
                else if (signalBuy(series, idx, diffBuy, days))  // buy condition and trigger
                {
                    signalPerformance(series, stopLoss, maxDays, idx, true, diffSell, diffBuy, days, out trade);
                    if (trades.Count < 200) trades.Add(trade);
                    else break;
                    i += Math.Max(1, trade.days);
                    //                        System.Console.Write("\tBuy at "+idx+" entry="+trade.entry+" exit="+trade.exit+" "+candle.ToString());
                    //                        System.Console.WriteLine(" p="+trade.p+", days="+trade.days+", exit at "+(idx+trade.days));
                }
                else i++;
            }

            double pTotal;
            int daysTotal;
            int hits;
            double maxDrawDown;
            signalPerformanceGetTrades(trades, out daysTotal, out hits, out pTotal, out maxDrawDown);
            int misses = trades.Count - hits;
            if ((pTotal > 1.1) && (trades.Count > 5) && (bestBlocks.Count < 1000))
            {
                TradeSession ts = new TradeSession();
                ts.trades = trades;
                ts.maxDays = maxDays;
                ts.p = pTotal;
                ts.days = daysTotal;
                ts.hits = hits;
                ts.stopLoss = stopLoss;
                ts.sellSignal = diffSell;
                ts.buySignal = diffBuy;
                ts.maxDays = maxDays;
                ts.maxDrawDown = maxDrawDown;
                bestBlocks.Add(ts);
                System.Console.Write("+");
                //                System.Console.WriteLine("p="+pTotal);
                //                signalPerformancePrintTrades(trades);
            }
            if ((pTotal > 2) && (trades.Count > 5) && (bestBlocks.Count > 1000))
                System.Console.Write("-");
            //            System.Console.Write("1");
        }
예제 #28
0
        protected void signalPerformanceOptimization(TA.PriceVolumeSeries series, double[] data, int windowSize)
        {
            double stopLossFrom = 0.02;
            double stopLossTo = 0.04;
            double stopLossStep = 0.001;
            double buySignalFrom = 0.9; ;
            double buySignalTo = 1.1;
            double sellSignalFrom = 0.9;
            double sellSignalTo = 1.1;
            double signalStep = 0.002;
            int maxDays = 1000;
            int daysFrom = 1;
            int daysTo = 10;
            int daysStep = 1;
            long loopsTotal = (long)(((buySignalTo - buySignalFrom) / signalStep) * ((sellSignalFrom - sellSignalTo) / signalStep) * ((stopLossTo - stopLossFrom) / stopLossStep) * (daysFrom - daysTo));

            System.Collections.Generic.List<TradeSession> bestBlocks = new System.Collections.Generic.List<TradeSession>(40);

            double buySignal = buySignalFrom;
            while (buySignal < buySignalTo)
            {
                double sellSignal = sellSignalFrom;
                while (sellSignal < sellSignalTo)
                {
                    double stopLoss = stopLossFrom;
                    while (stopLoss < stopLossTo)
                    {
                        int days = daysFrom;
                        while (days < daysTo)
                        {
                            signalPerformanceOptimization(series, data, windowSize, stopLoss, maxDays, sellSignal, buySignal, days, bestBlocks);
                            loopsTotal--;
                            if ((loopsTotal & 0xFFFF) == 0) System.Console.Write("." + loopsTotal);
                            days = days + daysStep;
                        }
                        stopLoss += stopLossStep;
                    }
                    sellSignal += signalStep;
                }
                buySignal += signalStep;
            }

            TradeSession bs = findBest(bestBlocks);
            System.Console.WriteLine("pTotal=" + (int)(100 * bs.p) + ", days=" + bs.days +
                                      ", hits=" + bs.hits + ", maxDrawDown=" + (int)(100 * bs.maxDrawDown) + "" +
                                         ", trades=" + bs.trades.Count + ", stopLoss=" + bs.stopLoss + ", maxDays=" + bs.maxDays +
                                         ", sellSig=" + bs.sellSignal + ", buySig=" + bs.buySignal + ", wind=" + windowSize);
            signalPerformancePrintTrades(bs.trades);
        }
예제 #29
0
파일: EffectFnSeq.cs 프로젝트: hfz-r/nbb
 public override Effect <TB> Apply(TA a)
 => Head(a).Bind2(Tail);
예제 #30
0
        protected bool signalSell(TA.PriceVolumeSeries series, int idx, double diff, int days)
        {
            bool res = false;

            if (idx >= days)
            {
                TA.Candle candleCur = (TA.Candle)series.Data[idx];
                TA.Candle candlePrev = (TA.Candle)series.Data[idx - days];
                res = (candleCur.high * diff < candlePrev.high);
            }

            return res;
        }
예제 #31
0
 public void TwitchLogOut()
 {
     TA.TwitchLogOut();
     AuthorizedName = AuthorizedName;
 }
예제 #32
0
        protected void _signalPerformanceOptimization(TA.PriceVolumeSeries series, double[] data, int windowSize)
        {
            double stopLossStep = 0.001;

            System.Collections.Generic.List<TradeSession> bestBlocks = new System.Collections.Generic.List<TradeSession>(40);

            double buySignal = -1.94;
            double sellSignal = 1.7;
            double stopLoss = 0.026;
            signalPerformanceOptimization(series, data, windowSize, stopLoss, 1000, 1.05, 0.9, 3, bestBlocks);

            TradeSession bs = findBest(bestBlocks);
            System.Console.WriteLine("pTotal=" + (int)(100 * bs.p) + ", days=" + bs.days +
                                      ", hits=" + bs.hits + ", maxDrawDown=" + (int)(100 * bs.maxDrawDown) + "" +
                                         ", trades=" + bs.trades.Count + ", stopLoss=" + bs.stopLoss + ", maxDays=" + bs.maxDays +
                                         ", sellSig=" + bs.sellSignal + ", buySig=" + bs.buySignal + ", wind=" + windowSize);
            signalPerformancePrintTrades(bs.trades);
        }
예제 #33
0
        public bool GetSeries(DateTime start, DateTime end, Equity equity, DataFeed.DataType dataType, out TA.PriceVolumeSeries series)
        {
            string symbol = equity.Symbol;
            bool result = false;
            series = null;

            do
            {
                int size = (int)Math.Round((end - start).TotalDays);
                if (size <= 0)
                {
                    break;
                }

                // preallocate some memory
                series = new TA.PriceVolumeSeries(size);

                string url;
                result = buildURL(symbol, start, end, dataType, out url);
                if (!result)
                {
                    break;
                }

                Console.WriteLine("Get data from URL " + url + " between " + start + " and " + end);

                HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url);

                HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();

                Stream readStream = httpResponse.GetResponseStream();

                result = fillDataArray(readStream, series);
            }
            while (false);

            return result;
        }
예제 #34
0
    //显示tips
    public void ShowTips(string content, float timer, Color color, bool flag = false)
    {
        if (!flag)
        {
            mTipPos = TipPosType.Down;
            CacheTrans.localPosition = Vector3.zero;
            if (!Spirte.gameObject.activeSelf)
            {
                Spirte.gameObject.SetActive(true);
            }
            Spirte.width = 540;
        }
        else
        {
            mTipPos = TipPosType.LeftDown;
            if (Spirte.gameObject.activeSelf)
            {
                Spirte.gameObject.SetActive(false);
            }
            CacheTrans.localPosition = new Vector3(-560, -85, 0);
        }

        ChildGoTrans.localPosition = new Vector3(-1, -205, 0);
        ChildGoTrans.localScale    = Vector3.one;
        CacheTrans.localScale      = Vector3.one;

        int count     = !flag ? Utility.TipsList.Count : Utility.GameTipsList.Count;
        int moveIndex = 0;

        for (int i = 0; i < count; i++)
        {
            int        index = i + 1;
            UITipsView view  = !flag ? Utility.TipsList[count - index] : Utility.GameTipsList[count - index];
            if (view.TipPos == TipPosType.LeftDown || view.TipPos == TipPosType.Down)
            {
                moveIndex++;
                view.MoveUp(moveIndex, flag);
            }
        }
        if (!flag)
        {
            Utility.TipsList.Add(this);
            TipsLb.text  = content;
            TipsLb.color = color;
        }
        else
        {
            Utility.GameTipsList.Add(this);
            TipsGame.text  = content;
            TipsGame.color = color;
        }

        mSchedule = Timer.Instance.SetSchedule(timer, (s) =>
        {
            TA.SetOnFinished(() =>
            {
                TP.enabled = false;
                UIPool.Instance.PushUITipPanel(this);
                if (!flag)
                {
                    Utility.TipsList.Remove(this);
                }
                else
                {
                    Utility.GameTipsList.Remove(this);
                }
            });
            TweenAlpha.Begin(gameObject, 1, 0);
        });
        setViewLayer();
    }
예제 #35
0
 public static extern TA SetTextAlign(IntPtr hdc, TA align);
예제 #36
0
 public static partial TA SetTextAlign(Gdi32.HDC hdc, TA align);
예제 #37
0
        static bool fillDataArray(Stream streamReader, TA.PriceVolumeSeries series)
        {
            bool result = false;
            byte[] buf = new byte[8192];
            StringBuilder sb = new StringBuilder();

            // read all data from the stream
            while (true)
            {
                int count = streamReader.Read(buf, 0, buf.Length);
                // nothing to read ?
                if (count == 0)
                {
                    break;
                }

                // translate from bytes to ASCII text
                string tempString = Encoding.ASCII.GetString(buf, 0, count);

                // continue building the string
                sb.Append(tempString);
            }

            string str = sb.ToString();

            // buffer sb contains lines separated by 0x0A (line feed)
            // skip first line
            int indexEnd;
            int indexStart = str.IndexOf((char)0x0A, 0);
            result = false;

            do
            {
                indexStart += 1;
                indexEnd = str.IndexOf((char)0x0A, indexStart);

                if (indexEnd <= 0)
                {
                    System.Console.WriteLine("195:Failed to parse price data " + str);
                    break;
                }

                result = ((indexEnd - indexStart) > 1);
                if (!result)
                {
                    System.Console.WriteLine("202:Failed to parse price data " + str);
                    break;
                }

                string data = str.Substring(indexStart, indexEnd - indexStart);
                TA.Candle candle;
                result = strToCandle(data, out candle);
                if (!result)
                {
                    System.Console.WriteLine("211:Failed to parse candle data " + data + " indexStart=" + indexStart + " indexEnd=" + indexEnd);
                    break;
                }

                series.Data.Insert(0, candle);
                indexStart = indexEnd;

                // end of data ?
                if (indexEnd >= (str.Length - 1))
                {
                    result = true;
                    break;
                }
            }
            while (true);

            if (!result)
            {
            }

            return result;
        }
예제 #38
0
        /// <summary>
        /// Example
        /// Date,Open,High,Low,Close,Volume,Adj Close
        /// 2009-09-25,74.04,74.39,73.37,73.80,3470700,73.80
        /// </summary>
        static bool strToCandle(string str, out TA.Candle candle)
        {
            candle = null;
            int start = 0;
            int end = 0;
            bool result = true;

            // skip date
            end = str.IndexOf(',', start);
            if (end <= 1) // no date ?
            {
                System.Console.WriteLine("242:Failed to parse candle data " + str);
                return false;
            }
            start = end + 1;

            double open, close, max, min;
            int volume;
            string strVal;

            // open
            end = str.IndexOf(',', start);
            if ((end <= 1) || (end <= start)) // no open ?
            {
                System.Console.WriteLine("255:Failed to parse candle data " + str);
                return false;
            }
            strVal = str.Substring(start, end - start);
            result = Double.TryParse(strVal, out open);
            if (!result)
            {
                System.Console.WriteLine("262:Failed to parse candle data " + str + "!" + strVal);
                return false;
            }
            start = end + 1;

            // max
            end = str.IndexOf(',', start);
            if ((end <= 1) || (end <= start)) // no max ?
            {
                System.Console.WriteLine("271:Failed to parse candle data " + str);
                return false;
            }
            strVal = str.Substring(start, end - start);
            result = Double.TryParse(strVal, out max);
            if (!result)
            {
                System.Console.WriteLine("278:Failed to parse candle data " + str + "!" + strVal);
                return false;
            }
            start = end + 1;

            // min
            end = str.IndexOf(',', start);
            if ((end <= 1) || (end <= start)) // no min ?
            {
                System.Console.WriteLine("287:Failed to parse candle data " + str);
                return false;
            }
            strVal = str.Substring(start, end - start);
            result = Double.TryParse(strVal, out min);
            if (!result)
            {
                System.Console.WriteLine("294:Failed to parse candle data " + str + "!" + strVal);
                return false;
            }
            start = end + 1;

            // close
            end = str.IndexOf(',', start);
            if ((end <= 1) || (end <= start)) // no close ?
            {
                System.Console.WriteLine("304:Failed to parse candle data " + str);
                return false;
            }
            strVal = str.Substring(start, end - start);
            result = Double.TryParse(strVal, out close);
            if (!result)
            {
                System.Console.WriteLine("311:Failed to parse candle data " + str + "!" + strVal);
                return false;
            }
            start = end + 1;

            // volume
            end = str.IndexOf(',', start);
            if ((end <= 1) || (end <= start)) // no open ?
            {
                System.Console.WriteLine("320:Failed to parse candle data " + str);
                return false;
            }
            strVal = str.Substring(start, end - start);
            result = Int32.TryParse(strVal, out volume);
            if (!result)
            {
                System.Console.WriteLine("327:Failed to parse candle data " + str + "!" + strVal);
                return false;
            }
            start = end + 1;

            candle = new TA.Candle(open, close, min, max, volume);

            return true;
        }
예제 #39
0
        public bool GetSeries(string fileName, out TA.PriceVolumeSeries series)
        {
            bool result = false;
            series = null;
            FileStream fileStream = null;
            do
            {
                try
                {
                    fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                }
                catch (IOException e)
                {
                    System.Console.WriteLine("Failed to open file " + fileName + " for reading");
                    System.Console.WriteLine(e.ToString());
                    break;
                }

                // preallocate some memory
                series = new TA.PriceVolumeSeries(50);
                result = fillDataArray(fileStream, series);
                if (!result)
                {
                    System.Console.WriteLine("Failed to parse file " + fileName);
                }
            }
            while (false);

            if (fileStream != null)
            {
                fileStream.Close();
            }

            return result;
        }