private void LoadConfigStudies() { ConfigurePropertyGridStudies(); btnApplyStudies.Text = Program.LanguageDefault.DictionarySettings["btnApply"]; ConfigStudies configStudies = ListConfigStudies.Instance().LoadListConfigStudies(); StudieInfo studieInfo = new StudieInfo { LineThickness = configStudies.LineThickness, Color = Color.FromArgb(configStudies.Color.ToArgb()), Retraction0 = bool.Parse(configStudies.Retracements[0, 1]), Retraction38 = bool.Parse(configStudies.Retracements[1, 1]), Retraction50 = bool.Parse(configStudies.Retracements[2, 1]), Retraction61 = bool.Parse(configStudies.Retracements[3, 1]), Retraction100 = bool.Parse(configStudies.Retracements[4, 1]), Projection0 = bool.Parse(configStudies.Projections[0, 1]), Projection38 = bool.Parse(configStudies.Projections[1, 1]), Projection50 = bool.Parse(configStudies.Projections[2, 1]), Projection61 = bool.Parse(configStudies.Projections[3, 1]), Projection100 = bool.Parse(configStudies.Projections[4, 1]), Projection161 = bool.Parse(configStudies.Projections[5, 1]), Projection261 = bool.Parse(configStudies.Projections[6, 1]), }; pgrdStudies.SelectedObject = studieInfo; }
public void Update(ConfigStudies configStudies) { XmlDocument xmlDocument = GetXmlTemplate(); XmlNode node = xmlDocument.DocumentElement.GetElementsByTagName("STUDIES")[0]; XmlNode nLinethickness = node.SelectSingleNode("LINETHICKNESS"); nLinethickness.InnerText = configStudies.LineThickness.ToString(); XmlNode nColor = node.SelectSingleNode("COLOR"); nColor.InnerText = configStudies.Color.ToArgb().ToString(); XmlNodeList nRetracements = node.SelectSingleNode("RETRACEMENTSREG").ChildNodes; int index = 0; foreach (XmlNode retracement in nRetracements) { retracement["RETRACEMENT"].InnerText = configStudies.Retracements[index, 0]; retracement["STATUS"].InnerText = configStudies.Retracements[index, 1]; index++; } XmlNodeList nProjection = node.SelectSingleNode("PROJECTIONSREG").ChildNodes; index = 0; foreach (XmlNode projection in nProjection) { projection["PROJECTION"].InnerText = configStudies.Projections[index, 0]; projection["STATUS"].InnerText = configStudies.Projections[index, 1]; index++; } xmlDocument.Save(_nameArchiveXml); }
private void SaveStudies() { StudieInfo studieInfo = (StudieInfo)pgrdStudies.SelectedObject; const double nullValue = -987654321.0; ConfigStudies configStudies = new ConfigStudies { Color = studieInfo.Color, LineThickness = studieInfo.LineThickness, Retracements = new[, ] { { studieInfo.Retraction0.ToString(), studieInfo.Retraction0.ToString() }, { studieInfo.Retraction38.ToString(), studieInfo.Retraction38.ToString() }, { studieInfo.Retraction50.ToString(), studieInfo.Retraction50.ToString() }, { studieInfo.Retraction61.ToString(), studieInfo.Retraction61.ToString() }, { studieInfo.Retraction100.ToString(), studieInfo.Retraction100.ToString() } }, Projections = new[, ] { { studieInfo.Projection0.ToString(), studieInfo.Projection0.ToString() }, { studieInfo.Projection38.ToString(), studieInfo.Projection38.ToString() }, { studieInfo.Projection50.ToString(), studieInfo.Projection50.ToString() }, { studieInfo.Projection61.ToString(), studieInfo.Projection61.ToString() }, { studieInfo.Projection100.ToString(), studieInfo.Projection100.ToString() }, { studieInfo.Projection161.ToString(), studieInfo.Projection161.ToString() }, { studieInfo.Projection261.ToString(), studieInfo.Projection261.ToString() } }, }; ListConfigStudies.Instance().Update(configStudies); //PERCORRER TODOS OS DOCUMENTOS DO MAIN PARA ATUALIZAR GRÁFICOS ABERTOS: foreach (DockWindow document in _mFrMain2.documentManager.Where(document => (!document.Text.Equals(Program.LanguageDefault.DictionaryPlena["webBrowser"])) && (!document.Text.Equals(Program.LanguageDefault.DictionaryPlena["tradeDiary"])) && (!document.Text.Equals(Program.LanguageDefault.DictionarySelectTools["selectTools"]))).Where(document => document.AccessibleName.Equals("CtlPainelChart"))) { ((CtlPainelChart)document.Controls[0]).StockChartX1.LineColor = configStudies.Color; ((CtlPainelChart)document.Controls[0]).StockChartX1.LineThickness = (int)configStudies.LineThickness; ((CtlPainelChart)document.Controls[0]).StockChartX1.SetFibonacciRetParams( bool.Parse(configStudies.Retracements[4, 1]) ? 0.0 : nullValue, bool.Parse(configStudies.Retracements[3, 1]) ? 0.382 : nullValue, bool.Parse(configStudies.Retracements[2, 1]) ? 0.5 : nullValue, bool.Parse(configStudies.Retracements[1, 1]) ? 0.618 : nullValue, bool.Parse(configStudies.Retracements[0, 1]) ? 1.0 : nullValue, nullValue, nullValue, nullValue, nullValue, nullValue); ((CtlPainelChart)document.Controls[0]).StockChartX1.SetFibonacciProParams( bool.Parse(configStudies.Projections[4, 1]) ? 0.0 : nullValue, bool.Parse(configStudies.Projections[3, 1]) ? 0.382 : nullValue, bool.Parse(configStudies.Projections[2, 1]) ? 0.5 : nullValue, bool.Parse(configStudies.Projections[1, 1]) ? 0.618 : nullValue, bool.Parse(configStudies.Projections[0, 1]) ? 1.0 : nullValue, bool.Parse(configStudies.Projections[5, 1]) ? 1.0 : nullValue, bool.Parse(configStudies.Projections[6, 1]) ? 1.0 : nullValue, nullValue, nullValue, nullValue); } }
private void GridStudies() { for (int i = 0; i < 3; i++) { AppendNewColumn(i); } ConfigStudies configStudies = ListConfigStudies.Instance().LoadListConfigStudies(); rseLineThickness.Value = configStudies.LineThickness; boxColor.Value = Color.FromArgb(configStudies.Color.ToArgb()); string[] valuesFibonacci = new[] { "0%", "38,2%", "50%", "61,8%", "100%", "161,8%", "261,8%" }; int index = 0; foreach (string value in valuesFibonacci) { GridViewRowInfo rowInfo = grdFibonacci.Rows.AddNew(); rowInfo.Cells[0].Value = value; rowInfo.Cells[0].ReadOnly = true; if ((value == "161,8%") || (value == "261,8%")) { rowInfo.Cells[1].Value = false; rowInfo.Cells[1].ReadOnly = true; } else { rowInfo.Cells[1].Value = bool.Parse(configStudies.Retracements[index, 1]); rowInfo.Cells[1].ReadOnly = false; } rowInfo.Cells[2].Value = bool.Parse(configStudies.Projections[index, 1]); rowInfo.Cells[2].ReadOnly = false; index++; } grdFibonacci.CurrentRow = grdFibonacci.Rows[0]; }
/// <summary> /// Carrega as configuração de estudos do XML /// </summary> /// <returns>Arquivo de configuração de estudos</returns> public ConfigStudies LoadListConfigStudies() { ConfigStudies configStudies = new ConfigStudies(); VerifyPath(); try { XmlDocument xmlDocument = Utility.LoadXmlWithXmlDocument(_nameArchiveXml); XmlNode node = xmlDocument.DocumentElement.GetElementsByTagName("STUDIES")[0]; configStudies = new ConfigStudies { Color = Color.FromArgb(int.Parse(node.SelectSingleNode("COLOR").InnerText)), LineThickness = decimal.Parse(node.SelectSingleNode("LINETHICKNESS").InnerText), Retracements = new[, ] { { node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[0]["RETRACEMENT"].InnerText, node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[0]["STATUS"].InnerText }, { node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[1]["RETRACEMENT"].InnerText, node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[1]["STATUS"].InnerText }, { node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[2]["RETRACEMENT"].InnerText, node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[2]["STATUS"].InnerText }, { node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[3]["RETRACEMENT"].InnerText, node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[3]["STATUS"].InnerText }, { node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[4]["RETRACEMENT"].InnerText, node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[4]["STATUS"].InnerText }, { node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[5]["RETRACEMENT"].InnerText, node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[5]["STATUS"].InnerText }, { node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[6]["RETRACEMENT"].InnerText, node.SelectSingleNode("RETRACEMENTSREG"). ChildNodes[6]["STATUS"].InnerText }, }, Projections = new[, ] { { node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[0]["PROJECTION"].InnerText, node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[0]["STATUS"].InnerText }, { node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[1]["PROJECTION"].InnerText, node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[1]["STATUS"].InnerText }, { node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[2]["PROJECTION"].InnerText, node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[2]["STATUS"].InnerText }, { node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[3]["PROJECTION"].InnerText, node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[3]["STATUS"].InnerText }, { node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[4]["PROJECTION"].InnerText, node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[4]["STATUS"].InnerText }, { node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[5]["PROJECTION"].InnerText, node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[5]["STATUS"].InnerText }, { node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[6]["PROJECTION"].InnerText, node.SelectSingleNode("PROJECTIONSREG"). ChildNodes[6]["STATUS"].InnerText }, }, }; } catch (Exception ex) { configStudies = new ConfigStudies { Color = Color.Red, LineThickness = 1, Retracements = new[, ] { { "true", "true" }, { "true", "true" }, { "true", "true" }, { "true", "true" }, { "true", "true" }, { "true", "true" }, { "true", "true" }, }, Projections = new[, ] { { "true", "true" }, { "true", "true" }, { "true", "true" }, { "true", "true" }, { "true", "true" }, { "true", "true" }, { "true", "true" }, }, }; } return(configStudies); }