Indicator positive and negative colors on Simplified API

Custom indicators, trading strategies, data export and recording and more...
blk
Posts: 44
Joined: Fri Nov 01, 2019 8:59 pm
Has thanked: 7 times

Indicator positive and negative colors on Simplified API

Post by blk » Fri Aug 14, 2020 9:56 pm

Hi,

Is there a way to have the same indicator with different positive/negative colors using the Simplified API Wrapper? 

Something similar to what the Bookmap Cumulative Volume Delta does.

I know we can do something with 2 indicators and set the other indicator do Double.NaN but I'm wondering if this can be done in a single indicator.

Thanks,

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

Re: Indicator positive and negative colors on Simplified API

Post by Andry API support » Mon Aug 17, 2020 5:25 am

Hi blk,
this cannot be done in a single indicator. Just like you said, you need to use two IndicatorModifiable instances which will alternate between visible and invisible (once Double.NaN value is added) states.

Code: Select all

                // t is time value in nanos
                line0.addPoint(t + 1, Double.NaN);
                line1.addPoint(t, value);

blk
Posts: 44
Joined: Fri Nov 01, 2019 8:59 pm
Has thanked: 7 times

Re: Indicator positive and negative colors on Simplified API

Post by blk » Mon Aug 17, 2020 4:42 pm

Thanks Andrey

Post Reply