Exemplo n.º 1
0
        private void PushPeriodKLines(string dtString, Monitor m, KLine k)
        {
            // add klines of this symbol
            List<KLine> klines = symbolKs[k.Symbol];

            // process periods
            Dictionary<int, Zone> pZone = symbolPeriods[k.Symbol];
            foreach (int p in pZone.Keys)
            {
                int minutes = Utils.GetLastingMinutes(Utils.UtcToDateTime(k.UTC));
                if (klines.Count > 0 && minutes - pZone[p].lastM >= p)
                {
                    m.TA.PushKLine(p, SumKLines(klines, pZone[p].x));

                    pZone[p].x = klines.Count;
                    pZone[p].lastM = (minutes / p) * p;
                }
            }

            m.TA.PushKLine(1, k);
            klines.Add(k);
        }
Exemplo n.º 2
0
Arquivo: TA.cs Projeto: jiangyimin/QTP
        public void PushKLine(int ktype, KLine k)
        {
            if (!dictKS.ContainsKey(ktype))
                return;

            // Add to rlist of this ktype
            dictKS[ktype].Add(k);

            // Push To AList and BList
            foreach (FormulaInfo fi in FList)
                if (fi.KType == ktype) 
                    fi.Formula.Push(dictKS[ktype]);

            if (enabled)
            {
                 CheckBuyPoints(BPList, ktype, k);
            }
        }
Exemplo n.º 3
0
Arquivo: TA.cs Projeto: jiangyimin/QTP
        private void CheckBuyPoints(List<BuyPointInfo> buyPoints, int ktype, KLine k)
        {
            foreach (BuyPointInfo bpi in buyPoints)
            {
                FormulaInfo fi = FList[bpi.Index];
                if (fi.KType != ktype) continue;

                if (CheckFilters(bpi.Filters))
                {
                    if (fi.Formula.IsBuyPoint())
                    {
                        monitor.IssueOpenLongSignal(fi.Name, fi.KType, k);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public RiskOrder IssueOpenLongSignal(string fname, int ktype, KLine thisK)
        {
            double stoplessRisk = ta.GetATR(60);

            strategy.WriteTDLog(string.Format("{0}({1} {2})", thisK.Symbol, Utils.DTLongString(Utils.UtcToDateTime(thisK.UTC)), thisK.CLOSE));
            return null;
        }
Exemplo n.º 5
0
 public void PushKLine(int ktype, KLine k)
 {
     ta.PushKLine(ktype, k);
 }
Exemplo n.º 6
0
        public void PushBar(Bar bar, float factor)
        {
            if (!IsBench)
                Adj_factor(bar, factor);

            string symbol = string.Format("{0}.{1}", bar.exchange, bar.sec_id);
            KLine k = new KLine(symbol, bar.utc_time, bar.open, bar.close, bar.high, bar.low, bar.volume);
            ta.PushKLine(bar.bar_type / 60, k);

            // Process focusInstument
            if (Focus) strategy.FireFocusBarArrived(bar);
        }