Have problem showing a double in DataWindow, keeps rounding to int

MrHwang

Member
Joined
Apr 9, 2021
Posts
15
Likes
16
So, in this indicator, I have a value that does not have a path associated (meaning no line or histo is drawn using this value).

But I want the value to be shown in the Cursor Data Window (Alt-D).

I create the value in the Values enum, I use the .exportValue() method from the Runtime Descriptor object, then I assign a double value with the series.setDouble() method, but the Cursor Data Window only shows a rounded whole number. For example, I hard code in 3.994, the number 4 is shown in the Data Window.

How do I get the Data Window to show double values? I've looked at code for other indicators, but can't seem to find what affects this.

I appreciate any

Code:
enum Values {DATA_WINDOW_VALUE, PATH_1, PATH_2}
...

public void initialize(Defaults defaults) {
    ...
    var desc = createRD();
    ...
    desc.exportValue(new ValueDescriptor(Values.DATA_WINDOW_VALUE, "TheValue", new String[]{Input_LookbackPeriod}));
    }

protected void calculate(int index, DataContext ctx) {
    ...
    series.setDouble(index, Values.DATA_WINDOW_VALUE, 3.99456); //hardcoded value but normally uses the variable for the value
    series.setComplete(index);
    }
 
Top