public void Initialize(int maxBars, int barsViewable, string cacheFolder, BarItemType barType, Guid cacheId, string strategyIdentityCode) { multiChart1.Initialize(maxBars, barsViewable); this.SelectedTimeframe = barType; pricebarCache = new PricebarCache(barType, cacheId, CacheModeOption.Read); this.strategyDataFrame = new StrategyDataFrame(strategyIdentityCode, 300, pricebarCache); timeNavigator1.Initialize(pricebarCache.StartBarDate, pricebarCache.EndBarDate); strategyFrameReader = strategyDataFrame.GetFrameReader(pricebarCache.StartBarDate); IPriceActionChart priceChart = this.PriceActionChart; priceChart.Show(); priceChart.SetDataPoints(strategyFrameReader.PriceBars); List <ChartSignalItem> signalItems = new List <ChartSignalItem>(); foreach (BarItem barItem in strategyFrameReader.PriceBars) { MarketOrderState marketOrderState = strategyFrameReader.Read(barItem.Time); if (marketOrderState != MarketOrderState.NoOrder) { signalItems.Add(new ChartSignalItem(marketOrderState == MarketOrderState.Long ? SignalState.Long : marketOrderState == MarketOrderState.Short ? SignalState.Short : SignalState.NoSignal, barItem.Time)); } } priceChart.PlotSignal(signalItems.ToArray()); //foreach (IndicatorChartingInfo chartingInfo in strategyDataFrame.GetIndicatorChartingInfo()) //{ // ChartIndicatorItem[] chartIndicators = strategyDataFrame.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); // } //} }
private void RefreshChart(DateTime currentDateTime) { multiChart1.Clear(); strategyFrameReader = strategyDataFrame.GetFrameReader(currentDateTime); //Get strategies. //Basic SDK can execute only one strategy. Expert SDK can execute multiple strategies. //PlotStrategies(this.strategyDataFrame.Strategies); IPriceActionChart priceChart = this.PriceActionChart; priceChart.Show(); priceChart.SetDataPoints(strategyFrameReader.PriceBars); List <ChartSignalItem> signalItems = new List <ChartSignalItem>(); foreach (BarItem barItem in strategyFrameReader.PriceBars) { MarketOrderState marketOrderState = strategyFrameReader.Read(barItem.Time); if (marketOrderState != MarketOrderState.NoOrder) { signalItems.Add(new ChartSignalItem(marketOrderState == MarketOrderState.Long ? SignalState.Long : marketOrderState == MarketOrderState.Short ? SignalState.Short : SignalState.NoSignal, barItem.Time)); } } priceChart.PlotSignal(signalItems.ToArray()); //foreach (IndicatorChartingInfo chartingInfo in strategyDataFrame.GetIndicatorChartingInfo()) //{ // ChartIndicatorItem[] chartIndicators = strategyDataFrame.GetIndicators(chartingInfo.IdentityCode, chartingInfo.SeriesLabel); // if (chartingInfo.ChartRange == ChartRangeOption.PriceActionRange) // { // ((IPriceActionChart)multiChart1).PlotIndicator(GetSeriesLabel(chartingInfo), chartIndicators, chartingInfo.ChartType); // } // else if (chartingInfo.ChartRange == ChartRangeOption.PositiveHundredRange) // { // if (!((IPercentageChart)multiChart1).Visible) // { // ((IPercentageChart)multiChart1).Show(); // } // ((IPercentageChart)multiChart1).PlotIndicator(GetSeriesLabel(chartingInfo), chartIndicators, chartingInfo.ChartType); // } // else if (chartingInfo.ChartRange == ChartRangeOption.PipRange) // { // if (!((IOscillatorChart)multiChart1).Visible) // { // ((IOscillatorChart)multiChart1).Show(); // } // ((IOscillatorChart)multiChart1).PlotIndicator(GetSeriesLabel(chartingInfo), chartIndicators, chartingInfo.ChartType); // } //} }
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); } } }