Simplified API indicator two colors

Custom indicators, trading strategies, data export and recording and more...
fenepet965
Posts: 24
Joined: Wed May 26, 2021 12:13 pm
Has thanked: 2 times

Simplified API indicator two colors

Post by fenepet965 » Sat Sep 24, 2022 7:21 pm

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 8356 times

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Simplified API indicator two colors

Post by Andry API support » Sat Sep 24, 2022 8:37 pm

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

fenepet965
Posts: 24
Joined: Wed May 26, 2021 12:13 pm
Has thanked: 2 times

Re: Simplified API indicator two colors

Post by fenepet965 » Tue Sep 27, 2022 12:54 pm

Hi Andrey, thanks for your reply. Is there another way to do this with a single indicator? Any examples in the core api?

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Simplified API indicator two colors

Post by Andry API support » Tue Oct 04, 2022 7:08 am

Hi, I will make an example in the Core API soon.

fenepet965
Posts: 24
Joined: Wed May 26, 2021 12:13 pm
Has thanked: 2 times

Re: Simplified API indicator two colors

Post by fenepet965 » Tue Nov 01, 2022 1:03 pm

Hi Andrey, were you able to create the core api example?

Thanks!

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Simplified API indicator two colors

Post by Andry API support » Wed Nov 02, 2022 10:46 am

Hi, sorry, it takes longer than expected. Hope to complete it soon.

fenepet965
Posts: 24
Joined: Wed May 26, 2021 12:13 pm
Has thanked: 2 times

Re: Simplified API indicator two colors

Post by fenepet965 » Mon Dec 19, 2022 4:07 pm

Hi Andrey, wondering if you have any updates about the example core indicator

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Simplified API indicator two colors

Post by Andry API support » Tue Dec 20, 2022 12:12 pm

Hi, haven't finished yet.

Post Reply