I would like to hide or reduce the size of the left side margin when an indicator is on the price panel.
The indicator displays best if it is overlayed on the price but the left margin is indicated in the is:
<NinjaTrader.Gui.Chart.ScaleJustification.Left>
Is there a programmicaly or other way to hide the left margin or shrink the size so it does not take up chart space.
It was set to overlay at first but because the scale is different it will at times exceed the range of the candles. Setting it to use the left scale resolves that issue but uses chart area on the left.
I don’t need to know the indicators value, so hiding or shrinking the width of the left margin is preferable.
To answer the question directly: there’s no supported way to change the width of the left or right scale. NinjaTrader sizes it to fit its labels, and there’s no setting or property for it. Anything else would be a hack, and not one I’d recommend. I also tried blanking the scale’s labels in code (FormatPriceMarker). The scale kept its full width, so that route doesn’t work either.
I tried to reproduce this with RSI on the price panel, since its values have nothing to do with price either. I tested Overlay and Left, each with Auto scale on and off. The line landed in exactly the same place in all four. Left only added the axis on the left side.
One thing worth knowing before you spend more time on it: when an indicator is on its own scale, its line lines up with the candles only by coincidence. Your left scale runs from about -15,800 to -1,980, nowhere near price. When the line rides the tops or bottoms of the bars, that’s just where its own scale happens to put it. Move the chart, or change the visible range, and it will sit somewhere else. So Left isn’t keeping the line inside the candles, it just happened to look that way on your chart.
Can you post a screenshot of your indicator on Overlay next to the same chart on Left? If they really look different on your end, something in the indicator must be scaling itself differently, and that might be worth taking a closer look at.
I partially solved the issue by adding an index scale to the indicator.
It required adding an override (OnCalculateMinMax)
It works but not a great solution IMO. But at least I don’t need to have a left margin.