Hello everyone!
I am trying to dynamically change the color of an indicator on the MotiveWave side bar.
Based on the values of the study, I need that color (currently green) to change to some other color (like red). What happens currently is that wherever I start the study, the color is correct, but it never changes color when it should. So if the color should be green when the study is added to the chart, it will be green, and if it should be red, it will be red. However it will never switch from green to red or red to green. It always stays the initial color.
This is the code I am using to set up the colors
and this is the code I am using to actually change the color when the study values change to the opposite values.
This code seems to do nothing after the study is added to the chart. Without this code, it will not even have the correct initial color, so it seems like it is doing something, but it never updates. Is there a way to do this or am I running into some kind of limitation?
I am trying to dynamically change the color of an indicator on the MotiveWave side bar.
Based on the values of the study, I need that color (currently green) to change to some other color (like red). What happens currently is that wherever I start the study, the color is correct, but it never changes color when it should. So if the color should be green when the study is added to the chart, it will be green, and if it should be red, it will be red. However it will never switch from green to red or red to green. It always stays the initial color.
This is the code I am using to set up the colors
Java:
var settings = getSettings();
var upColor = getSettings().getColor(Inputs.UP_COLOR);
var downColor = getSettings().getColor(Inputs.DOWN_COLOR);
IndicatorInfo ind = new IndicatorInfo(get("Indicator"), null, null, false, true);
and this is the code I am using to actually change the color when the study values change to the opposite values.
Code:
ind = new IndicatorInfo(get("LBL_INDICATOR"), upColor, null, false, true);
settings.setIndicator(Inputs.IND, ind);
This code seems to do nothing after the study is added to the chart. Without this code, it will not even have the correct initial color, so it seems like it is doing something, but it never updates. Is there a way to do this or am I running into some kind of limitation?