public void LoadIndicatorSettings(XmlNode chartNode) { if (chartNode == null) { return; } var list = chartNode.SelectNodes("indicator"); if (list == null) { return; } foreach (XmlElement node in list) { // - 1 - создать экземпляр класса var indi = BaseChartIndicator.LoadIndicator(node); if (indi == null) { continue; } if (indi is IChartQueryIndicator) { ((IChartQueryIndicator)indi).GetOuterCharts += getOuterCharts; } // - 2 - добавить в список индикаторов и на график // добавляем в список индикаторов indicators.Add(indi); indi.Add(chart, null); indi.AcceptSettings(); } }
public void SaveIndicatorSettings(XmlElement chartNode) { foreach (var indi in indicators) { var xmlNode = chartNode.AppendChild(chartNode.OwnerDocument.CreateElement("indicator")); BaseChartIndicator.MakeIndicatorXMLNode(indi, xmlNode); } }
public void ActivateIndiRemoveEvent(BaseChartIndicator indi) { timeUpdateIndicators.Touch(); if (IndiRemoveEvent == null) { return; } var eventArg = new IndiEventArgs(indi); IndiRemoveEvent(this, eventArg); }
public void ActivateIndiEditEvent(string oldName, BaseChartIndicator indi) { timeUpdateIndicators.Touch(); if (IndiEditEvent == null) { return; } var eventArg = new IndiEventArgs(indi); IndiEditEvent(oldName, eventArg); }
public void TestIndicators() { var doc = new XmlDocument(); foreach (var indicator in indicators) { var node = doc.CreateElement("indicator"); BaseChartIndicator.MakeIndicatorXMLNode(indicator, node); var loadedIndicator = BaseChartIndicator.LoadIndicator(node); Assert.IsTrue(CopmareIndicators(indicator, loadedIndicator)); } }
public override void Copy(BaseChartIndicator indi) { var indiTf = (DemoTrendFlat)indi; CopyBaseSettings(indiTf); indiTf.ClLine = ClLine; indiTf.PriceType = PriceType; indiTf.seriesLine = seriesLine; indiTf.seriesDeltas = seriesDeltas; indiTf.periodSlow = periodSlow; indiTf.periodFast = periodFast; indiTf.ClBarsPositive = ClBarsPositive; indiTf.ClBarsNegative = ClBarsNegative; indiTf.LineWidth = LineWidth; }
/// <summary> /// вспомогательный метод, нопосредствено сохраняющий/пересохраняющий шаблон /// </summary> /// <param name="templateNode">XmlElement представляющий описание шаблона</param> /// <param name="doc">XmlDocument, в который нужно записать орисание шаблона</param> private void SaveTemplate(XmlElement templateNode, XmlDocument doc) { if (templateNode != null && templateNode.OwnerDocument != null) { var xmlAttrTicker = templateNode.OwnerDocument.CreateAttribute(ChartTemplate.AttributeSymbol); xmlAttrTicker.Value = chbxBindCurrencyTicket.Checked ? txtCurrentTickerValue.Text : ChartTemplate.UniversalSymbol; templateNode.Attributes.Append(xmlAttrTicker); var xmlAttrChartType = templateNode.OwnerDocument.CreateAttribute(ChartTemplate.AttributeChartType); xmlAttrChartType.Value = chart.chart.ChartType.ToString(); templateNode.Attributes.Append(xmlAttrChartType); var xmlAttrName = templateNode.OwnerDocument.CreateAttribute(ChartTemplate.AttributeName); xmlAttrName.Value = cbTemplateName.Text; templateNode.Attributes.Append(xmlAttrName); if (chbxSaveChartSettings.Checked) { var xmlAttrSize = templateNode.OwnerDocument.CreateAttribute(ChartTemplate.AttributeChartSize); xmlAttrSize.Value = string.Format("{0};{1}", chart.Parent.Size.Width, chart.Parent.Size.Height); templateNode.Attributes.Append(xmlAttrSize); } if (chebxSaveIndicators.Checked) { foreach (var indcator in chart.indicators) { var indicatorNode = (XmlElement)templateNode.AppendChild(doc.CreateElement(ToolSettingsStorageFile.NodeNameChartTemplateIndicator)); BaseChartIndicator.MakeIndicatorXMLNode(indcator, indicatorNode); } } ToolSettingsStorageFile.SaveXml(doc); } }
public IndiEventArgs(BaseChartIndicator indi) { this.indi = indi; }