public static StrategyGraphic GetGraphic() { KLineKey dataKey = new KLineKey("rb1801", 20170801, 20170901, KLinePeriod.KLinePeriod_15Minute); StrategyGraphic graphic = new StrategyGraphic(dataKey); graphic.Title.X = 10; graphic.Title.Text = "test"; graphic.Title.Color = Color.Red; graphic.Shapes.AddPriceShape(GetLine()); return(graphic); }
public void Load(XmlElement xmlElem) { XmlNodeList nodes = xmlElem.GetElementsByTagName("graphic"); for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes[i]; if (node is XmlElement) { XmlElement elem = (XmlElement)node; StrategyGraphic graphic = new StrategyGraphic(); graphic.Load(elem); this.AddGraphic(graphic); } } }
public IStrategyDrawer_PriceRect GetDrawer_KLine(KLinePeriod klinePeriod) { if (dic_KLinePeriod_Drawer.ContainsKey(klinePeriod)) { return(dic_KLinePeriod_Drawer[klinePeriod]); } if (!dic_KLinePeriod_DataKey.ContainsKey(klinePeriod)) { return(drawer_Empty); } StrategyGraphic strategyGraphic = new StrategyGraphic(dic_KLinePeriod_DataKey[klinePeriod]); int startBarPos = dic_KLinePeriod_Start[klinePeriod]; StrategyDrawer_PriceRect drawer = new StrategyDrawer_PriceRect(strategyGraphic, startBarPos); dic_KLinePeriod_Drawer.Add(klinePeriod, drawer); return(dic_KLinePeriod_Drawer[klinePeriod]); }
public void TestStrategyGraphicSaveLoad() { StrategyGraphic graphic = GetGraphic(); Console.WriteLine(XmlUtils.ToString(graphic)); XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("root"); doc.AppendChild(root); graphic.Save(root); StrategyGraphic graphic2 = new StrategyGraphic(); graphic2.Load(root); Console.WriteLine(XmlUtils.ToString(graphic2)); Assert.AreEqual(XmlUtils.ToString(graphic), XmlUtils.ToString(graphic2)); }
public StrategyDrawer_PriceRect(StrategyGraphic strategyGraphic, int startBarPos) { this.strategyGraphic = strategyGraphic; this.startBarPos = startBarPos; }
public void Load(XmlElement xmlElem) { this.startBarPos = int.Parse(xmlElem.GetAttribute("startBarPos")); strategyGraphic = new StrategyGraphic(); strategyGraphic.Load(xmlElem); }