Page 1 of 1

TradingChart: Open Interest and Volume Indicators In Same Segment?

Posted: Wed Oct 07, 2020 1:28 am
by JeffFerguson
For a TradingChart instance, I can define an Open Interest indicator and a Volume indicator. They will appear in separate segments below the main trading chart. Is it possible to have one indicator segment with both Open Interest data and Volume data in the same segment, so that I have two segments in my view, and not three?

Re: TradingChart: Open Interest and Volume Indicators In Same Segment?

Posted: Wed Oct 07, 2020 9:15 am
by Arction_LasseP
Hello Jeff,

Currently, this is not directly supported. However, segment handling in general (showing/hiding segments, reorganizing them, changing indicator properties etc.) is something we are planning to improve in the next releases (not in LightningChart version 10 coming in a week or two). Option to have indicators in the same segment is definitely something we will consider.

Meanwhile, this can still be done. Most likely the easiest way is to configure the internal LightningChart component of the TradingChart. This can be done via tradingChart.GetInternalChart() -method, though you need to have the respective .dll file added to your references (Arction.Wpf.Charting.LightningChartUltimate). Here is an example solution:

Code: Select all

            _chart.BeginUpdate();
            _chart.GetInternalChart().ViewXY.YAxes[2].SegmentIndex = 1;
            _chart.GetInternalChart().ViewXY.AxisLayout.Segments[2].Height = 0;
            _chart.GetInternalChart().ViewXY.YAxes[2].Title.HorizontalAlign = YAxisTitleAlignmentHorizontal.Left;
            _chart.GetInternalChart().ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.LeftThenRight;

            _chart.GetInternalChart().ViewXY.LineCollections[0].Behind = true;

            _chart.ShowSegmentSplitters = false;
            _chart.EndUpdate();
In the above example, we are moving the Y-axis that has the OpenInterest line to another segment which has the Volume. Then we hide the original segment by setting its Height to 0. Note that the Y-axis and SegmentIndex depend on how many segments you have and in which order they are. There are also some layout changes; setting LineCollections[0].Behind = true shows the OpenInterest on top of the Volume.

Since this approach is not fully supported yet, it can break certain features. One of them is resizing segments by dragging the SegmentSplitters. This is why we hide them above.

An alternative would be to implement this kind of feature in the source code, since tradingChart customers have access to it.

Hope this is helpful.
Best regards,
Lasse

Re: TradingChart: Open Interest and Volume Indicators In Same Segment?

Posted: Tue Oct 13, 2020 12:54 am
by JeffFerguson
Hello Lasse,

Thanks for your answer. I'm attaching a chart image from the Arction Web site and have a question about it.

Given your answer to me earlier, was the plotting of the Bollinger Bands and Moving Average done with one of the workarounds you described? Or is it the case that workarounds you described are only in the case where 2 plots have different Y scales?

Re: TradingChart: Open Interest and Volume Indicators In Same Segment?

Posted: Tue Oct 13, 2020 8:55 am
by Arction_LasseP
Hello Jeff,

Bollinger Band and Moving Averages are by default set to be in the same segment as the trading data, as that is where they usually are shown in trading applications, and also because they share the same Y-axis price range. No workaround was used for them though the segment they belong to is determined by assigned Y-axis index. No extra segments are created when a Bollinger or MA is added to the chart.

Technically, it is also possible to move them to another segment by changing their AssignYAxisIndex property (via GetInternalChart() -method). However, you most likely need to create an extra Y-axis as the axes of other indicators don't have the same scale. If the indicators have the same scale, it should be enough to change the axis index.

Best regards,
Lasse