Exemplo n.º 1
0
        public void Initialize(int maxBars, int barsViewable, string cacheFolder, BarItemType barType, Guid cacheId, string signalIdentityCode)
        {
            multiChart1.Initialize(maxBars, barsViewable);

            this.SelectedTimeframe = barType;

            this.signalCacheNavigator = new SignalCacheNavigator(cacheFolder, barType, cacheId, signalIdentityCode);

            signalDataFrame = signalCacheNavigator.GetSignalDataFrame(signalCacheNavigator.StartBarDate, 300);

            //timeNavigator1.Initialize(signalCacheNavigator.StartBarDate, signalCacheNavigator.EndBarDate);

            IPriceActionChart priceChart = this.PriceActionChart;

            priceChart.Show();
            priceChart.SetDataPoints(signalDataFrame.GetPriceBars());

            SignalDataItem[] signals = signalDataFrame.GetSignals();

            List <ChartSignalItem> signalItems = new List <ChartSignalItem>();

            foreach (SignalDataItem signal in signals)
            {
                signalItems.Add(new ChartSignalItem(signal.Position == PositionMode.Long ? SignalState.Long : signal.Position == PositionMode.Short? SignalState.Short: SignalState.NoSignal, signal.ClosingBarTime));
            }

            priceChart.PlotSignal(signalItems.ToArray());

            foreach (IndicatorChartingInfo chartingInfo in signalDataFrame.GetIndicatorChartingInfo())
            {
                ChartIndicatorItem[] chartIndicators = signalDataFrame.GetIndicators(chartingInfo.IdentityCode, chartingInfo.SeriesLabel);
                if (chartingInfo.ChartRange == ChartRangeOption.PriceActionRange)
                {
                    priceChart.PlotIndicator(GetSeriesLabel(chartingInfo), chartIndicators, chartingInfo.ChartType);
                }
                else if (chartingInfo.ChartRange == ChartRangeOption.PositiveHundredRange)
                {
                    if (!PercentageChart.Visible)
                    {
                        PercentageChart.Show();
                    }

                    PercentageChart.PlotIndicator(GetSeriesLabel(chartingInfo), chartIndicators, chartingInfo.ChartType);
                }
                else if (chartingInfo.ChartRange == ChartRangeOption.PipRange)
                {
                    if (!OscillatorChart.Visible)
                    {
                        OscillatorChart.Show();
                    }

                    OscillatorChart.PlotIndicator(GetSeriesLabel(chartingInfo), chartIndicators, chartingInfo.ChartType);
                }
            }
        }
Exemplo n.º 2
0
        public MultiChart()
        {
            InitializeComponent();

            //this.SelectedTimeFrame = BarItemType.M1;

            priceActionChart = new PriceActionChart();
            oscillatorChart  = new OscillatorChart();
            percentageChart  = new PercentageChart();
            pipChart         = new PipChart();

            //panel1.Width = 50;
        }