Page 1 of 1

Simplified API indicator two colors

Posted: Sat Sep 24, 2022 7:21 pm
by fenepet965
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:
Screenshot 2022-09-24 122107.png
CVD Line
Screenshot 2022-09-24 122107.png (34.18 KiB) Viewed 8297 times

Re: Simplified API indicator two colors

Posted: Sat Sep 24, 2022 8:37 pm
by Andry API support
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

Re: Simplified API indicator two colors

Posted: Tue Sep 27, 2022 12:54 pm
by fenepet965
Hi Andrey, thanks for your reply. Is there another way to do this with a single indicator? Any examples in the core api?

Re: Simplified API indicator two colors

Posted: Tue Oct 04, 2022 7:08 am
by Andry API support
Hi, I will make an example in the Core API soon.

Re: Simplified API indicator two colors

Posted: Tue Nov 01, 2022 1:03 pm
by fenepet965
Hi Andrey, were you able to create the core api example?

Thanks!

Re: Simplified API indicator two colors

Posted: Wed Nov 02, 2022 10:46 am
by Andry API support
Hi, sorry, it takes longer than expected. Hope to complete it soon.

Re: Simplified API indicator two colors

Posted: Mon Dec 19, 2022 4:07 pm
by fenepet965
Hi Andrey, wondering if you have any updates about the example core indicator

Re: Simplified API indicator two colors

Posted: Tue Dec 20, 2022 12:12 pm
by Andry API support
Hi, haven't finished yet.