Sample Code to use 2 colors on indicator line and process history

Custom indicators, trading strategies, data export and recording and more...
rickbarlow
Posts: 43
Joined: Mon Feb 08, 2021 5:37 pm
Been thanked: 1 time

Sample Code to use 2 colors on indicator line and process history

Post by rickbarlow » Thu Feb 11, 2021 11:50 pm

I have an indicator created from one of the (Layer1SimpleAttachable) samples that plots in the BOTTOM.
I have not been able to figure out how to change the color when it crosses a value  (e.g Yellow below x, Green above x).  Can you please provide a sample / code snippet that supports this?

Also, I added HistoricalModeListener to the Implementation, but my indicator does not seem to get exercised on the historical data that is loaded prior to the running session. The CVD indicator that comes out of the box does. What else do I need to change to have my indicator do the same? Again, a snippet sample would help. 
Thanks
 

Svyatoslav
Site Admin
Posts: 278
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Sample Code to use 2 colors on indicator line and process history

Post by Svyatoslav » Fri Feb 12, 2021 8:27 am

Both of those features - coloring based on range and ability to run on backfill data (as opposed to only the data received after bookmap start) are part of core layer1 api but are not part of simplified. Core layer1 is more complicated and less clean, but those features are present there already. Andrey should be able to provide you some additional information a bit later.

rickbarlow
Posts: 43
Joined: Mon Feb 08, 2021 5:37 pm
Been thanked: 1 time

Re: Sample Code to use 2 colors on indicator line and process history

Post by rickbarlow » Fri Feb 12, 2021 2:05 pm

Thank you, look forward to getting the code. 

rickbarlow
Posts: 43
Joined: Mon Feb 08, 2021 5:37 pm
Been thanked: 1 time

Re: Sample Code to use 2 colors on indicator line and process history

Post by rickbarlow » Fri Feb 12, 2021 2:07 pm

Thank you, look forward to getting the code. 

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

Re: Sample Code to use 2 colors on indicator line and process history

Post by Andry API support » Fri Feb 12, 2021 2:25 pm

Hi! the implementation depends on API you are using.
For the Simplified API there is no 2 colored lines but you can emulate it with sections colored differently drawn with different colored  IndicatorModifiable instances. That does not look good sometimes (due to data aggregation the sections look separated along the vertical axis).
I have attached the example for the Core API.
 
Attachments
devmarkers.zip
(4.75 KiB) Downloaded 181 times

Post Reply