public TA(Monitor monitor, TAInfo taInfo, string dllName) { this.monitor = monitor; this.TickTA = new TickTA(monitor); // Create KLines storage dictKS = new Dictionary<int, RList<KLine>>() { { 0, new RList<KLine>() } // 缺省有日线 }; foreach (int p in TAInfo.Periods) { dictKS[p] = new RList<KLine>(); } // create Formula in taInfo's List Assembly assembly = Assembly.LoadFrom(dllName + ".DLL"); FList = new List<FormulaInfo>(); foreach (FormulaInfo fi in taInfo.FList) { FormulaInfo fiClone = fi.Copy(); Type type = assembly.GetType(string.Format("{0}.{1}_Formula", dllName, fi.Name)); fiClone.Formula = (TAFormula)Activator.CreateInstance(type, fi.Parameters); FList.Add(fiClone); } BPList = taInfo.BuyPoints; }
public Monitor(MyStrategy strategy, TInstrument target, TAInfo taInfo, string dllName) { this.strategy = strategy; this.target = target; this.ta = new TA(this, taInfo, dllName); this.barBuffer = new List<Bar>(); this.tickBuffer = new List<Tick>(); }
// Create public MyStrategy(TStrategy s, TLogin login) { strategyT = s; this.gmLogin = login; // pm manager pm = (PoolManager)Activator.CreateInstance(strategyT.Pool.ManagerType, this, strategyT.Pool); // monitors TAInfo info = new TAInfo(strategyT.TAInfoParameters); monitors = new Dictionary<string, Monitor>(); foreach (TInstrument ins in strategyT.Instruments) { Monitor monitor = new Monitor(this, ins, info, strategyT.DLLName); symbols += ins.Symbol + ","; monitors.Add(ins.Symbol, monitor); if (monitor.Target.Symbol == pm.SymbolBench) monitor.IsBench = true; } // RiskM riskM = new RiskM(this, strategyT.RiskMInfoParameters); // heartTimer heartTimer = new System.Timers.Timer(); heartTimer.Elapsed += new System.Timers.ElapsedEventHandler(heartTimer_Elapsed); heartTimer.Interval = 1000; // 1s }