Simplified API indicator two colors
-
- Posts: 24
- Joined: Wed May 26, 2021 12:13 pm
- Has thanked: 2 times
Simplified API indicator two colors
Hi, is there a way to have an indicator in the bottom chart using the Simplified API and have 2 colors? e.g: when the indicator goes above zero I want the color to be green and bellow zero the color should be red (same line but 2 colors, depending on the value the color changes).
The Bookmap CVD does that but I can't find a way to do the same using the simplified API.
Here is an example of what I want to do:
The Bookmap CVD does that but I can't find a way to do the same using the simplified API.
Here is an example of what I want to do:
Re: Simplified API indicator two colors
Hi. Simplified API does not have this feature. Only Core API has.
With Simplified API you can make something that looks similar with 2 instances of indicator of different colors. Points of Double.NaN value make a line stop (or become transparent) so you can alternate lines. But it won't look very smooth, esp. aggregated.
Example:
(t==1_000_000_000) indicatorRed.addPoint(100); indicatorGreen.addPoint(Double.NaN);
(t==2_000_000_000) indicatorGreen.addPoint(Double.NaN); indicatorRed.addPoint(100);
(t==3_000_000_000) indicatorRed.addPoint(100); indicatorGreen.addPoint(Double.NaN);
etc. one line has a numerical value, another one disappears
With Simplified API you can make something that looks similar with 2 instances of indicator of different colors. Points of Double.NaN value make a line stop (or become transparent) so you can alternate lines. But it won't look very smooth, esp. aggregated.
Example:
(t==1_000_000_000) indicatorRed.addPoint(100); indicatorGreen.addPoint(Double.NaN);
(t==2_000_000_000) indicatorGreen.addPoint(Double.NaN); indicatorRed.addPoint(100);
(t==3_000_000_000) indicatorRed.addPoint(100); indicatorGreen.addPoint(Double.NaN);
etc. one line has a numerical value, another one disappears
-
- Posts: 24
- Joined: Wed May 26, 2021 12:13 pm
- Has thanked: 2 times
Re: Simplified API indicator two colors
Hi Andrey, thanks for your reply. Is there another way to do this with a single indicator? Any examples in the core api?
-
- Posts: 24
- Joined: Wed May 26, 2021 12:13 pm
- Has thanked: 2 times
Re: Simplified API indicator two colors
Hi Andrey, were you able to create the core api example?
Thanks!
Thanks!
-
- Posts: 24
- Joined: Wed May 26, 2021 12:13 pm
- Has thanked: 2 times
Re: Simplified API indicator two colors
Hi Andrey, wondering if you have any updates about the example core indicator