Support Board
Date/Time: Thu, 28 Nov 2024 08:30:36 +0000
[Programming Help] - Automatic Scale Adjustment for a custom study
View Count: 367
[2023-05-10 12:33:04] |
User787032 - Posts: 37 |
Hello, I have developed a custom study that plots cumulative values of calculated market values. The study works well, but I have noticed that the scale of the chart region does not adjust with the current visible study values. For example, even if the range of study values for the visible bars on the chart is from a low of 2200 to a high of 2400, the chart region scale runs from zero to 2400 (rather than from the visible low to the visible high), making the study line look flat at the top of the chart region. The scale range for the study is set to Automatic. On the chart region scale, I have checked Interactive Scale Move and Scale Range Automatic. Is there any other parameter that needs to be set to make the chart region scale adjust automatically to the visible range of the study values? I know that the scale on the Cumulative Delta Bars study automatically adjusts to the visible range of values, but I can’t see anything in the code that would influence this. Thanks in advance for any guidance. |
[2023-05-11 20:34:48] |
Tony - Posts: 522 |
Hope I understand your question correctly, you could set range as "User Defined", at this point, you're still able to read/write "Constant Range" number, so, "User Defined"'s range top and range bottom numbers can be calculated based on "Constant Range" number Diff = ConstantNumber - (ChartHighest - ChartLowest); RangeTop = ChartHighest + Diff / 2; RangeBottom = ChartLowest - Diff / 2; Date Time Of Last Edit: 2023-05-11 20:39:22
|
[2023-05-15 12:04:38] |
User787032 - Posts: 37 |
Thanks for your suggestion, Tony. However, that approach means that the study has to keep track of its highest and lowest values in the currently visible part of the chart (which can obviously change as the user stretches or squeezes the chart time scale on the x-axis.) As I mentioned in my original post, studies such as Cumulative Delta Bars adjust the scale automatically and there is nothing in the code to suggest that it's doing any such calculation, which is why I suspect that there is a parameter somewhere that is set incorrectly. Thanks anyway. |
To post a message in this thread, you need to log in with your Sierra Chart account: