Oscillator fixed height and dynamic levels.
Oscillator fixed height and dynamic levels.
10 Apr 2019, 16:11
Hi! I have 2 issues that I cannot aproach.
First is I want to set a fixed height for my Oscillator. The closest to what I need is
IndicatorArea.SetYRange(-120, 20);
The problem with the above is that when I scroll the chart the the Oscillator automatically resizes and when I stop scrolling then it fixes itself back into place. I want it to stay fixed when scrolling aswell. I tried to place the above code both on Calculate() and on Initialize() with no luck. I also tried Autorescale = false as shown below but it had no effect.
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None, AutoRescale = false)]
My second issue is that I have Levels in my indicator that I need to set after the initialization as they depend on user set parameters. So [Levels()] before the class doesn't help. I ended up doing this on Initialize():
IndicatorArea.DrawHorizontalLine("Oversold level", levelOs, "MediumOrchid", 1, LineStyle.DotsRare); IndicatorArea.DrawHorizontalLine("Overbought level", levelOb, "MediumOrchid", 1, LineStyle.DotsRare);
which is not what I want, as the numbers of the levels don't appear at the right. Is there any way to do this?
Thanks for the help.
gakazas
10 Apr 2019, 16:16
I aproach the second issue with the following "hack", but there must be something better.
@gakazas