Pre loader

Shifted Series on a Stock Chart

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hello.
I’m trying to implement leading indicators. I have OHLC series as main (RenderableSeries[0]) and when I’m adding leading series with future DateTime value they still render as non-leading.

Code snippet:

XyDataSeries<DateTime, double> ser = (XyDataSeries<DateTime, double>) chartControl.RenderableSeries[series.index].DataSeries;

                if (candles.Count <= 0 || ser == null) { return; }

                if (ser.Count == 0)
                { ser.Append(candles[0].BeginTime, candles[0].Close); series.last = 0; }
                else { ser.Update(candles[series.last].BeginTime, candles[series.last].Close); }

                //ChartData.BaseXValues не идут в будущее
                
                List<DateTime> time = new List<DateTime>();
                List<double> open = new List<double>();
                List<double> close = new List<double>();
                List<double> high = new List<double>();
                List<double> low = new List<double>();

                for (int i = series.last + 1; i < candles.Count && candles[i]!=null; i++)
                {
                    time.Add(candles[i].BeginTime);
                    close.Add(candles[i].Close);
                }

                if (time.Count > 0)
                {
                    ser.Append(time, close);
                }

Screenshot:

Debugger screenshot:

  • You must to post comments
0
0

Hi VReuda,

CategoryDateTimeAxis looks at the index of each data-point to determine where to place it. This is by design.

If you wish to have a leading indicator, you can pre-pend the series with Y=double.NaN. We do this in our SciTrader examples to show moving averages for example.

I hope this helps,
Andrew

  • VRueda
    That works fine. And one more question: how can I change some kind of "max limit" of XAxis VisibleRange? I mean not just changing VisibleRange.Max, but setting the right border offset from the end of the main series. Is there a way to avoid scripting all VisibleRange changes manually?
  • Andrew Burnett-Thompson
    Hi there, There are a few things you can do. You can use Axis.GrowBy which adds a padding to the axis. You can use Axis.AutoRange, which zooms to fit data or leaves this manual You can use SciChartSurface.ViewportManager, which gives full control over the viewport. I hope this helps, Andrew
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies