public void RemovePane(baseClass.controls.graphPanel myPane) { mainContainer.Controls.Remove(myPane); mainContainer.RemoveChild(myPane.Name); myPane.Dispose(); ReArrangePanes(); }
public baseClass.controls.graphPanel CreatePane(baseClass.controls.graphPanel myPane, string underPaneName) { mainContainer.Controls.Add(myPane); myPane.myContainer = mainContainer; mainContainer.InsertChild(underPaneName, myPane, myPane.Name); mainContainer.ArrangeChildren(); return(myPane); }
/// <summary> /// Draw curve for indicator /// </summary> /// <param name="meta"></param> private void DrawCurveIndicator(application.Indicators.Meta meta) { //Indicators.Meta meta = Indicators.Libs.FindMetaByName(indicatorName); string curveName = constCurveNamePrefixIndicator + meta.ClassType.Name + "-" + meta.ParameterString; string paraStr = meta.ParameterString; if (paraStr == string.Empty) { curveName = meta.ClassType.Name; } else { curveName = meta.ClassType.Name + "-" + paraStr; } //Remove the old one if any if (this.CurrentEditCurveName.Trim() != "") { RemoveCurveIndicator(this.CurrentEditCurveName, true); this.CurrentEditCurveName = curveName; } //Determine panel for drawing. //TUAN-BEGIN baseClass.controls.graphPanel myGraphPanel = null; myGraphPanel = myNewPanelList.Find(meta.SelectedWindowName); if (myGraphPanel == null) { myGraphPanel = CreateNewPanel(MakeNewPanelName(curveName)); } //TUAN-END //DataValues[] indicatorValue = DataAccess.Libs.GetIndicatorData(myData.DataStockCode,myData.myDataParam, meta.ClassType.Name); //TUAN - fix bug - SMA 5 and 10 are the same curve line data when draw both of them. DataValues[] indicatorValue = application.Indicators.Libs.GetIndicatorData(myData, meta); this.myData.DateTime.FirstValidValue = indicatorValue[0].FirstValidValue; for (int idx = 0; idx < indicatorValue.Length; idx++) { curveName = constCurveNamePrefixIndicator + meta.ClassType.Name + "-" + meta.ParameterString + "-" + idx.ToString(); switch (meta.Output[idx].ChartType) { case AppTypes.ChartTypes.Bar: PlotCurveBar(curveName, myGraphPanel, this.myData.DateTime, indicatorValue[idx], meta.Output[idx].Color, Color.Black, meta.Output[idx].Weight); break; case AppTypes.ChartTypes.Line: PlotCurveLine(curveName, myGraphPanel, this.myData.DateTime, indicatorValue[idx], meta.Output[idx].Color, meta.Output[idx].Weight); break; } } myGraphPanel.myGraphObj.myViewportX = pricePanel.myGraphObj.myViewportX; string text = meta.ClassType.Name + (paraStr == "" ? "" : "(" + paraStr + ")"); ListViewItem item = activeIndicatorLV.Add(curveName, text, meta.Output[0].Color); item.Tag = new IndicatorCurveInfo(curveName, meta); }
/// <summary> /// Manipulate the closing action /// </summary> /// <param name="sender"></param> /// <returns></returns> public bool NewPane_OnClosing(object sender) { //Remove Curves in Panel baseClass.controls.graphPanel closingPane = sender as baseClass.controls.graphPanel; myNewPanelList.Remove(closingPane); RemovePane(closingPane); Charts.DrawCurve[] list = myCurveList.CurveInPane(closingPane.Name); for (int idx = 0; idx < list.Length; idx++) { RemoveCurveIndicator(list[idx].CurveName, true); } this.ReArrangePanes(); return(true); }
public baseClass.controls.graphPanel CreatePane(string name, int weight, string underPaneName) { baseClass.controls.graphPanel myPane = new baseClass.controls.graphPanel(); myPane.myWeight = weight; myPane.Name = name; myPane.myOnClosing += new common.controls.basePanel.OnClosing(PaneClosingdHandler); mainContainer.Controls.Add(myPane); myPane.myContainer = mainContainer; if (underPaneName == null) mainContainer.AddChild(myPane, myPane.Name); else mainContainer.InsertChild(underPaneName, myPane, myPane.Name); mainContainer.ArrangeChildren(); return myPane; }
private void RemoveEmptyCurveLinePanel() { int count = 0; foreach (DictionaryEntry item in myNewPanelList) { baseClass.controls.graphPanel pane = (item.Value as baseClass.controls.graphPanel); if (myCurveList.CurveInPane(pane.Name).Length == 0) { myNewPanelList.Remove(pane); RemovePane(pane); break; } count++; } if (count < myNewPanelList.Count) { RemoveEmptyCurveLinePanel(); } }
public baseClass.controls.graphPanel CreatePane(string name, int weight, string underPaneName) { baseClass.controls.graphPanel myPane = new baseClass.controls.graphPanel(); myPane.myWeight = weight; myPane.Name = name; myPane.myOnClosing += new common.controls.basePanel.OnClosing(PaneClosingdHandler); mainContainer.Controls.Add(myPane); myPane.myContainer = mainContainer; if (underPaneName == null) { mainContainer.AddChild(myPane, myPane.Name); } else { mainContainer.InsertChild(underPaneName, myPane, myPane.Name); } mainContainer.ArrangeChildren(); return(myPane); }
internal void Remove(baseClass.controls.graphPanel pane) { this.Remove(pane.Name); }
protected void ClearStrategyTradepoints(baseClass.controls.graphPanel toPanel) { toPanel.myGraphObj.myGraphPane.GraphObjList.Clear(); toPanel.myGraphObj.UpdateChart(); }
/// <summary> /// Draw tradepoints/recommendations for buy/sell decision /// </summary> protected void PlotStrategyTradepoints(application.TradePoints tradePoints, baseClass.controls.graphPanel toPanel) { ClearStrategyTradepoints(toPanel); Charts.DrawCurve[] curveList = myCurveList.CurveInPane(toPanel.Name); if (curveList.Length == 0) { return; } CurveItem curveItem = curveList[0].Curve; TradePointInfo tradePointInfo; for (int idx = 0; idx < tradePoints.Count; idx++) { tradePointInfo = (TradePointInfo)tradePoints[idx]; if (!tradePointInfo.isValid) { continue; } TextObj obj = new TextObj(); obj.FontSpec.Size = Settings.sysTradePointMarkerFontSize; obj.FontSpec.IsBold = true; obj.FontSpec.Border.IsVisible = true; obj.FontSpec.Fill.IsVisible = true; obj.FontSpec.Fill.Color = Settings.sysTradePointMarkerColorBG; switch (toPanel.myGraphObj.myViewportState.myAxisType) { case Charts.AxisType.DateAsOrdinal: obj.Location.X = tradePointInfo.DataIdx + 1; break; default: obj.Location.X = curveItem.Points[tradePointInfo.DataIdx].X; break; } obj.Location.Y = curveItem.Points[tradePointInfo.DataIdx].Y; obj.Location.CoordinateFrame = CoordType.AxisXYScale; obj.Location.AlignH = AlignH.Center; switch (tradePointInfo.TradeAction) { case AppTypes.TradeActions.Buy: case AppTypes.TradeActions.Accumulate: obj.Text = Settings.sysTradePointMarkeBUY; obj.FontSpec.FontColor = Settings.sysTradePointMarkerColorBUY; break; case AppTypes.TradeActions.Sell: case AppTypes.TradeActions.ClearAll: obj.Text = Settings.sysTradePointMarkerSELL; obj.FontSpec.FontColor = Settings.sysTradePointMarkerColorSELL; break; default: obj.Text = Settings.sysTradePointMarkerOTHER; obj.FontSpec.FontColor = Settings.sysTradePointMarkerColorOTHER; break; } toPanel.myGraphObj.myGraphPane.GraphObjList.Add(obj); } toPanel.myGraphObj.UpdateChart(); }
//Hashtable list = new Hashtable(); internal void Add(baseClass.controls.graphPanel panel) { this.Add(panel.Name, panel); }
private void DrawCurveIndicator(application.Indicators.Meta meta) { //Indicators.Meta meta = Indicators.Libs.FindMetaByName(indicatorName); string curveName = constCurveNamePrefixIndicator + meta.ClassType.Name + "-" + meta.ParameterString; //Remove the old one if any if (this.CurrentEditCurveName.Trim() != "") { RemoveCurveIndicator(this.CurrentEditCurveName, true); this.CurrentEditCurveName = curveName; } baseClass.controls.graphPanel myGraphPanel = (meta.DrawInNewWindow ? this.newPanel : this.pricePanel); DataSeries indicatorSeries = application.Indicators.Libs.GetIndicatorData(this.myData, meta); this.myData.DateTime.FirstValidValue = indicatorSeries.FirstValidValue; switch (meta.Output[0].ChartType) { case AppTypes.ChartTypes.Bar: PlotCurveBar(curveName, myGraphPanel, this.myData.DateTime, indicatorSeries, meta.Output[0].Color, Color.Black, meta.Output[0].Weight); break; case AppTypes.ChartTypes.Line: PlotCurveLine(curveName, myGraphPanel, this.myData.DateTime, indicatorSeries, meta.Output[0].Color, meta.Output[0].Weight); break; } // Some indicator such as MACD having more than one output series. // In such case, indicator form MUST have [form.ExtraInfo] propery to provide information for the output series. DataSeries[] extraSeries = null; if (meta.Output.Length > 1) { extraSeries = application.Indicators.Libs.GetIndicatorData(indicatorSeries, meta); } if (extraSeries != null) { for (int idx = 0, metaIdx = 1; idx < extraSeries.Length && metaIdx < meta.Output.Length; idx++, metaIdx++) { this.myData.DateTime.FirstValidValue = extraSeries[idx].FirstValidValue; curveName = constCurveNamePrefixIndicator + meta.ClassType.Name + "-" + meta.ParameterString + "-" + idx.ToString(); switch (meta.Output[metaIdx].ChartType) { case AppTypes.ChartTypes.Bar: PlotCurveBar(curveName, myGraphPanel, this.myData.DateTime, extraSeries[idx], meta.Output[metaIdx].Color, Color.Black, meta.Output[metaIdx].Weight); break; case AppTypes.ChartTypes.Line: PlotCurveLine(curveName, myGraphPanel, this.myData.DateTime, extraSeries[idx], meta.Output[metaIdx].Color, meta.Output[metaIdx].Weight); break; } } } if (meta.DrawInNewWindow) { newPanel.myGraphObj.myViewportX = pricePanel.myGraphObj.myViewportX; } string paraStr = meta.ParameterString; curveName = constCurveNamePrefixIndicator + meta.ClassType.Name + "-" + paraStr; string text = meta.ClassType.Name + (paraStr == "" ? "" : "(" + paraStr + ")"); ListViewItem item = activeIndicatorLV.Add(curveName, text, meta.Output[0].Color); item.Tag = new IndicatorCurveInfo(curveName, meta); }