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); }
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); } }
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); } } } }
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; }
public void PushKLine(int ktype, KLine k) { ta.PushKLine(ktype, k); }
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); }